[Midnightbsd-cvs] src: dev/oltr:
laffer1 at midnightbsd.org
laffer1 at midnightbsd.org
Thu Sep 18 21:57:44 EDT 2008
Log Message:
-----------
Modified Files:
--------------
src/sys/contrib/dev/acpica:
CHANGES.txt (r1.1.1.1 -> r1.2)
acapps.h (r1.1.1.1 -> r1.2)
acconfig.h (r1.1.1.2 -> r1.2)
acdebug.h (r1.1.1.2 -> r1.2)
acdisasm.h (r1.1.1.2 -> r1.2)
acdispat.h (r1.1.1.2 -> r1.2)
acefi.h (r1.1.1.2 -> r1.2)
acenv.h (r1.1.1.2 -> r1.2)
acevents.h (r1.1.1.2 -> r1.2)
acexcep.h (r1.1.1.2 -> r1.2)
acfreebsd.h (r1.1.1.2 -> r1.2)
acgcc.h (r1.1.1.2 -> r1.2)
acglobal.h (r1.1.1.2 -> r1.2)
achware.h (r1.1.1.2 -> r1.2)
acinterp.h (r1.1.1.2 -> r1.2)
aclocal.h (r1.1.1.2 -> r1.2)
acmacros.h (r1.1.1.2 -> r1.2)
acnamesp.h (r1.1.1.2 -> r1.2)
acobject.h (r1.1.1.2 -> r1.2)
acoutput.h (r1.1.1.2 -> r1.2)
acparser.h (r1.1.1.2 -> r1.2)
acpi.h (r1.1.1.2 -> r1.2)
acpica_prep.sh (r1.1.1.1 -> r1.2)
acpiosxf.h (r1.1.1.1 -> r1.2)
acpixf.h (r1.1.1.1 -> r1.2)
acresrc.h (r1.1.1.2 -> r1.2)
acstruct.h (r1.1.1.2 -> r1.2)
actables.h (r1.1.1.2 -> r1.2)
actbl.h (r1.1.1.2 -> r1.2)
actbl1.h (r1.1.1.2 -> r1.2)
actbl2.h (r1.1.1.2 -> r1.2)
actypes.h (r1.1.1.2 -> r1.2)
acutils.h (r1.1.1.2 -> r1.2)
amlcode.h (r1.1.1.2 -> r1.2)
amlresrc.h (r1.1.1.2 -> r1.2)
dbcmds.c (r1.1.1.2 -> r1.2)
dbdisply.c (r1.1.1.2 -> r1.2)
dbexec.c (r1.1.1.2 -> r1.2)
dbfileio.c (r1.1.1.2 -> r1.2)
dbhistry.c (r1.1.1.2 -> r1.2)
dbinput.c (r1.1.1.2 -> r1.2)
dbstats.c (r1.1.1.2 -> r1.2)
dbutils.c (r1.1.1.2 -> r1.2)
dbxface.c (r1.1.1.2 -> r1.2)
dmbuffer.c (r1.1.1.2 -> r1.2)
dmnames.c (r1.1.1.2 -> r1.2)
dmobject.c (r1.1.1.2 -> r1.2)
dmopcode.c (r1.1.1.2 -> r1.2)
dmresrc.c (r1.1.1.2 -> r1.2)
dmresrcl.c (r1.1.1.2 -> r1.2)
dmresrcs.c (r1.1.1.2 -> r1.2)
dmutils.c (r1.1.1.2 -> r1.2)
dmwalk.c (r1.1.1.2 -> r1.2)
dsfield.c (r1.1.1.2 -> r1.2)
dsinit.c (r1.1.1.2 -> r1.2)
dsmethod.c (r1.1.1.2 -> r1.2)
dsmthdat.c (r1.1.1.2 -> r1.2)
dsobject.c (r1.1.1.2 -> r1.2)
dsopcode.c (r1.1.1.2 -> r1.2)
dsutils.c (r1.1.1.2 -> r1.2)
dswexec.c (r1.1.1.2 -> r1.2)
dswload.c (r1.1.1.2 -> r1.2)
dswscope.c (r1.1.1.2 -> r1.2)
dswstate.c (r1.1.1.2 -> r1.2)
evevent.c (r1.1.1.2 -> r1.2)
evgpe.c (r1.1.1.2 -> r1.2)
evgpeblk.c (r1.1.1.2 -> r1.2)
evmisc.c (r1.1.1.2 -> r1.2)
evregion.c (r1.1.1.2 -> r1.2)
evrgnini.c (r1.1.1.2 -> r1.2)
evsci.c (r1.1.1.2 -> r1.2)
evxface.c (r1.1.1.2 -> r1.2)
evxfevnt.c (r1.1.1.2 -> r1.2)
evxfregn.c (r1.1.1.2 -> r1.2)
exconfig.c (r1.1.1.2 -> r1.2)
exconvrt.c (r1.1.1.2 -> r1.2)
excreate.c (r1.1.1.2 -> r1.2)
exdump.c (r1.1.1.2 -> r1.2)
exfield.c (r1.1.1.2 -> r1.2)
exfldio.c (r1.1.1.2 -> r1.2)
exmisc.c (r1.1.1.2 -> r1.2)
exmutex.c (r1.1.1.2 -> r1.2)
exnames.c (r1.1.1.2 -> r1.2)
exoparg1.c (r1.1.1.2 -> r1.2)
exoparg2.c (r1.1.1.2 -> r1.2)
exoparg3.c (r1.1.1.2 -> r1.2)
exoparg6.c (r1.1.1.2 -> r1.2)
exprep.c (r1.1.1.2 -> r1.2)
exregion.c (r1.1.1.2 -> r1.2)
exresnte.c (r1.1.1.2 -> r1.2)
exresolv.c (r1.1.1.2 -> r1.2)
exresop.c (r1.1.1.2 -> r1.2)
exstore.c (r1.1.1.2 -> r1.2)
exstoren.c (r1.1.1.2 -> r1.2)
exstorob.c (r1.1.1.2 -> r1.2)
exsystem.c (r1.1.1.2 -> r1.2)
exutils.c (r1.1.1.2 -> r1.2)
hwacpi.c (r1.1.1.2 -> r1.2)
hwgpe.c (r1.1.1.2 -> r1.2)
hwregs.c (r1.1.1.2 -> r1.2)
hwsleep.c (r1.1.1.2 -> r1.2)
hwtimer.c (r1.1.1.2 -> r1.2)
nsaccess.c (r1.1.1.2 -> r1.2)
nsalloc.c (r1.1.1.2 -> r1.2)
nsdump.c (r1.1.1.2 -> r1.2)
nsdumpdv.c (r1.1.1.2 -> r1.2)
nseval.c (r1.1.1.2 -> r1.2)
nsinit.c (r1.1.1.2 -> r1.2)
nsload.c (r1.1.1.2 -> r1.2)
nsnames.c (r1.1.1.2 -> r1.2)
nsobject.c (r1.1.1.2 -> r1.2)
nsparse.c (r1.1.1.2 -> r1.2)
nssearch.c (r1.1.1.2 -> r1.2)
nsutils.c (r1.1.1.2 -> r1.2)
nswalk.c (r1.1.1.2 -> r1.2)
nsxfeval.c (r1.1.1.2 -> r1.2)
nsxfname.c (r1.1.1.2 -> r1.2)
nsxfobj.c (r1.1.1.2 -> r1.2)
osunixxf.c (r1.1.1.1 -> r1.2)
psargs.c (r1.1.1.2 -> r1.2)
psopcode.c (r1.1.1.2 -> r1.2)
psparse.c (r1.1.1.2 -> r1.2)
psscope.c (r1.1.1.2 -> r1.2)
pstree.c (r1.1.1.2 -> r1.2)
psutils.c (r1.1.1.2 -> r1.2)
pswalk.c (r1.1.1.2 -> r1.2)
psxface.c (r1.1.1.2 -> r1.2)
rsaddr.c (r1.1.1.2 -> r1.2)
rscalc.c (r1.1.1.2 -> r1.2)
rscreate.c (r1.1.1.2 -> r1.2)
rsdump.c (r1.1.1.2 -> r1.2)
rsio.c (r1.1.1.2 -> r1.2)
rsirq.c (r1.1.1.2 -> r1.2)
rslist.c (r1.1.1.2 -> r1.2)
rsmemory.c (r1.1.1.2 -> r1.2)
rsmisc.c (r1.1.1.2 -> r1.2)
rsutils.c (r1.1.1.2 -> r1.2)
rsxface.c (r1.1.1.2 -> r1.2)
tbinstal.c (r1.1.1.2 -> r1.2)
tbutils.c (r1.1.1.2 -> r1.2)
tbxface.c (r1.1.1.2 -> r1.2)
tbxfroot.c (r1.1.1.2 -> r1.2)
utalloc.c (r1.1.1.2 -> r1.2)
utclib.c (r1.1.1.2 -> r1.2)
utcopy.c (r1.1.1.2 -> r1.2)
utdebug.c (r1.1.1.2 -> r1.2)
utdelete.c (r1.1.1.2 -> r1.2)
uteval.c (r1.1.1.2 -> r1.2)
utglobal.c (r1.1.1.2 -> r1.2)
utinit.c (r1.1.1.2 -> r1.2)
utmath.c (r1.1.1.2 -> r1.2)
utmisc.c (r1.1.1.2 -> r1.2)
utobject.c (r1.1.1.2 -> r1.2)
utxface.c (r1.1.1.2 -> r1.2)
src/sys/contrib/dev/acpica/common:
adisasm.c (r1.1.1.2 -> r1.2)
getopt.c (r1.1.1.2 -> r1.2)
src/sys/contrib/dev/acpica/compiler:
aslanalyze.c (r1.1.1.2 -> r1.2)
aslcodegen.c (r1.1.1.2 -> r1.2)
aslcompile.c (r1.1.1.2 -> r1.2)
aslcompiler.h (r1.1.1.2 -> r1.2)
aslcompiler.l (r1.1.1.2 -> r1.2)
aslcompiler.y (r1.1.1.2 -> r1.2)
aslerror.c (r1.1.1.2 -> r1.2)
aslfiles.c (r1.1.1.2 -> r1.2)
aslfold.c (r1.1.1.2 -> r1.2)
aslglobal.h (r1.1.1.2 -> r1.2)
asllength.c (r1.1.1.2 -> r1.2)
asllisting.c (r1.1.1.2 -> r1.2)
aslload.c (r1.1.1.2 -> r1.2)
asllookup.c (r1.1.1.2 -> r1.2)
aslmain.c (r1.1.1.2 -> r1.2)
aslmap.c (r1.1.1.2 -> r1.2)
aslopcodes.c (r1.1.1.2 -> r1.2)
asloperands.c (r1.1.1.2 -> r1.2)
aslopt.c (r1.1.1.2 -> r1.2)
aslresource.c (r1.1.1.2 -> r1.2)
aslrestype1.c (r1.1.1.2 -> r1.2)
aslrestype2.c (r1.1.1.2 -> r1.2)
aslstubs.c (r1.1.1.2 -> r1.2)
asltransform.c (r1.1.1.2 -> r1.2)
asltree.c (r1.1.1.2 -> r1.2)
asltypes.h (r1.1.1.2 -> r1.2)
aslutils.c (r1.1.1.2 -> r1.2)
src/sys/contrib/dev/oltr:
if_oltr.c (r1.1.1.1 -> r1.2)
Added Files:
-----------
src/sys/contrib/dev/acpica/common:
adfile.c (r1.1)
adwalk.c (r1.1)
dmrestag.c (r1.1)
dmtable.c (r1.1)
dmtbdump.c (r1.1)
dmtbinfo.c (r1.1)
src/sys/contrib/dev/acpica/compiler:
asldefine.h (r1.1)
-------------- next part --------------
Index: dmresrc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmresrc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmresrc.c -L sys/contrib/dev/acpica/dmresrc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmresrc.c
+++ sys/contrib/dev/acpica/dmresrc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrc.c - Resource Descriptor disassembly
- * $Revision: 13 $
+ * $Revision: 1.35 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,133 @@
ACPI_MODULE_NAME ("dbresrc")
+/* Dispatch tables for Resource disassembly functions */
+
+typedef
+void (*ACPI_RESOURCE_HANDLER) (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+static ACPI_RESOURCE_HANDLER AcpiGbl_DumpResourceDispatch [] =
+{
+ /* Small descriptors */
+
+ NULL, /* 0x00, Reserved */
+ NULL, /* 0x01, Reserved */
+ NULL, /* 0x02, Reserved */
+ NULL, /* 0x03, Reserved */
+ AcpiDmIrqDescriptor, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */
+ AcpiDmDmaDescriptor, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */
+ AcpiDmStartDependentDescriptor, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
+ AcpiDmEndDependentDescriptor, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
+ AcpiDmIoDescriptor, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
+ AcpiDmFixedIoDescriptor, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
+ NULL, /* 0x0A, Reserved */
+ NULL, /* 0x0B, Reserved */
+ NULL, /* 0x0C, Reserved */
+ NULL, /* 0x0D, Reserved */
+ AcpiDmVendorSmallDescriptor, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
+ NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
+
+ /* Large descriptors */
+
+ NULL, /* 0x00, Reserved */
+ AcpiDmMemory24Descriptor, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
+ AcpiDmGenericRegisterDescriptor,/* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
+ NULL, /* 0x03, Reserved */
+ AcpiDmVendorLargeDescriptor, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */
+ AcpiDmMemory32Descriptor, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */
+ AcpiDmFixedMemory32Descriptor, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */
+ AcpiDmDwordDescriptor, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */
+ AcpiDmWordDescriptor, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
+ AcpiDmInterruptDescriptor, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
+ AcpiDmQwordDescriptor, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
+ AcpiDmExtendedDescriptor /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
+};
+
+
+/* Only used for single-threaded applications */
+/* TBD: remove when name is passed as parameter to the dump functions */
+
+static UINT32 ResourceName;
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDescriptorName
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Emit a name for the descriptor if one is present (indicated
+ * by the name being changed from the default name.) A name is only
+ * emitted if a reference to the descriptor has been made somewhere
+ * in the original ASL code.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDescriptorName (
+ void)
+{
+
+ if (ResourceName == ACPI_DEFAULT_RESNAME)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("%4.4s", (char *) &ResourceName);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpInteger*
+ *
+ * PARAMETERS: Value - Value to emit
+ * Name - Associated name (emitted as a comment)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Integer output helper functions
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpInteger8 (
+ UINT8 Value,
+ char *Name)
+{
+ AcpiOsPrintf ("0x%2.2X, // %s\n", Value, Name);
+}
+
+void
+AcpiDmDumpInteger16 (
+ UINT16 Value,
+ char *Name)
+{
+ AcpiOsPrintf ("0x%4.4X, // %s\n", Value, Name);
+}
+
+void
+AcpiDmDumpInteger32 (
+ UINT32 Value,
+ char *Name)
+{
+ AcpiOsPrintf ("0x%8.8X, // %s\n", Value, Name);
+}
+
+void
+AcpiDmDumpInteger64 (
+ UINT64 Value,
+ char *Name)
+{
+ AcpiOsPrintf ("0x%8.8X%8.8X, // %s\n", ACPI_FORMAT_UINT64 (Value), Name);
+}
+
+
/*******************************************************************************
*
* FUNCTION: AcpiDmBitList
@@ -148,7 +275,7 @@
/* Open the initializer list */
- AcpiOsPrintf (") {");
+ AcpiOsPrintf ("{");
/* Examine each bit */
@@ -177,7 +304,7 @@
/*******************************************************************************
*
- * FUNCTION: AcpiDmResourceDescriptor
+ * FUNCTION: AcpiDmResourceTemplate
*
* PARAMETERS: Info - Curent parse tree walk info
* ByteData - Pointer to the byte list data
@@ -185,67 +312,65 @@
*
* RETURN: None
*
- * DESCRIPTION: Dump the contents of one ResourceTemplate descriptor.
+ * DESCRIPTION: Dump the contents of a Resource Template containing a set of
+ * Resource Descriptors.
*
******************************************************************************/
void
-AcpiDmResourceDescriptor (
+AcpiDmResourceTemplate (
ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op,
UINT8 *ByteData,
UINT32 ByteCount)
{
+ ACPI_STATUS Status;
ACPI_NATIVE_UINT CurrentByteOffset;
- UINT8 CurrentByte;
- UINT8 DescriptorId;
- UINT32 Length;
- void *DescriptorBody;
+ UINT8 ResourceType;
+ UINT32 ResourceLength;
+ void *Aml;
UINT32 Level;
BOOLEAN DependentFns = FALSE;
+ UINT8 ResourceIndex;
+ ACPI_NAMESPACE_NODE *Node;
Level = Info->Level;
+ ResourceName = ACPI_DEFAULT_RESNAME;
+ Node = Op->Common.Node;
+ if (Node)
+ {
+ Node = Node->Child;
+ }
for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount; )
{
- CurrentByte = ByteData[CurrentByteOffset];
- DescriptorBody = &ByteData[CurrentByteOffset];
+ Aml = &ByteData[CurrentByteOffset];
- if (CurrentByte & ACPI_RDESC_TYPE_LARGE)
- {
- DescriptorId = CurrentByte;
- Length = (* (ACPI_CAST_PTR (UINT16, &ByteData[CurrentByteOffset + 1])));
- CurrentByteOffset += 3;
- }
- else
- {
- DescriptorId = (UINT8) (CurrentByte & 0xF8);
- Length = (ByteData[CurrentByteOffset] & 0x7);
- CurrentByteOffset += 1;
- }
+ /* Get the descriptor type and length */
- CurrentByteOffset += (ACPI_NATIVE_UINT) Length;
+ ResourceType = AcpiUtGetResourceType (Aml);
+ ResourceLength = AcpiUtGetResourceLength (Aml);
- /* Determine type of resource */
+ /* Validate the Resource Type and Resource Length */
- switch (DescriptorId)
+ Status = AcpiUtValidateResource (Aml, &ResourceIndex);
+ if (ACPI_FAILURE (Status))
{
- /*
- * "Small" type descriptors
- */
- case ACPI_RDESC_TYPE_IRQ_FORMAT:
-
- AcpiDmIrqDescriptor (DescriptorBody, Length, Level);
- break;
-
+ AcpiOsPrintf ("/*** Could not validate Resource, type (%X) %s***/\n",
+ ResourceType, AcpiFormatException (Status));
+ return;
+ }
- case ACPI_RDESC_TYPE_DMA_FORMAT:
+ /* Point to next descriptor */
- AcpiDmDmaDescriptor (DescriptorBody, Length, Level);
- break;
+ CurrentByteOffset += AcpiUtGetDescriptorLength (Aml);
+ /* Descriptor pre-processing */
- case ACPI_RDESC_TYPE_START_DEPENDENT:
+ switch (ResourceType)
+ {
+ case ACPI_RESOURCE_NAME_START_DEPENDENT:
/* Finish a previous StartDependentFns */
@@ -255,131 +380,58 @@
AcpiDmIndent (Level);
AcpiOsPrintf ("}\n");
}
-
- AcpiDmStartDependentDescriptor (DescriptorBody, Length, Level);
- DependentFns = TRUE;
- Level++;
break;
-
- case ACPI_RDESC_TYPE_END_DEPENDENT:
+ case ACPI_RESOURCE_NAME_END_DEPENDENT:
Level--;
DependentFns = FALSE;
- AcpiDmEndDependentDescriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_IO_PORT:
-
- AcpiDmIoDescriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_FIXED_IO_PORT:
-
- AcpiDmFixedIoDescriptor (DescriptorBody, Length, Level);
break;
+ case ACPI_RESOURCE_NAME_END_TAG:
- case ACPI_RDESC_TYPE_SMALL_VENDOR:
-
- AcpiDmVendorSmallDescriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_END_TAG:
+ /* Normal exit, the resource list is finished */
if (DependentFns)
{
/*
- * Close an open StartDependentDescriptor. This indicates a missing
- * EndDependentDescriptor.
+ * Close an open StartDependentDescriptor. This indicates a
+ * missing EndDependentDescriptor.
*/
Level--;
DependentFns = FALSE;
- AcpiDmIndent (Level);
- AcpiOsPrintf ("}\n");
- AcpiDmIndent (Level);
- AcpiOsPrintf ("/*** Missing EndDependentFunctions descriptor */");
+ /* Go ahead and insert EndDependentFn() */
- /*
- * We could fix the problem, but then the ASL would not match the AML
- * So, we don't do this:
- * AcpiDmEndDependentDescriptor (DescriptorBody, Length, Level);
- */
+ AcpiDmEndDependentDescriptor (Aml, ResourceLength, Level);
+
+ AcpiDmIndent (Level);
+ AcpiOsPrintf (
+ "/*** Disassembler: inserted missing EndDependentFn () ***/\n");
}
return;
-
- /*
- * "Large" type descriptors
- */
- case ACPI_RDESC_TYPE_MEMORY_24:
-
- AcpiDmMemory24Descriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_GENERAL_REGISTER:
-
- AcpiDmGenericRegisterDescriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_LARGE_VENDOR:
-
- AcpiDmVendorLargeDescriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_MEMORY_32:
-
- AcpiDmMemory32Descriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
-
- AcpiDmFixedMem32Descriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
-
- AcpiDmDwordDescriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
-
- AcpiDmWordDescriptor (DescriptorBody, Length, Level);
- break;
-
-
- case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
-
- AcpiDmInterruptDescriptor (DescriptorBody, Length, Level);
+ default:
break;
+ }
+ /* Disassemble the resource structure */
- case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+ if (Node)
+ {
+ ResourceName = Node->Name.Integer;
+ Node = Node->Peer;
+ }
- AcpiDmQwordDescriptor (DescriptorBody, Length, Level);
- break;
+ AcpiGbl_DumpResourceDispatch [ResourceIndex] (
+ Aml, ResourceLength, Level);
+ /* Descriptor post-processing */
- default:
- /*
- * Anything else is unrecognized.
- *
- * Since the entire resource buffer has been already walked and
- * validated, this is a very serious error indicating that someone
- * overwrote the buffer.
- */
- AcpiOsPrintf ("/* Unknown Resource type (%X) */\n", DescriptorId);
- return;
+ if (ResourceType == ACPI_RESOURCE_NAME_START_DEPENDENT)
+ {
+ DependentFns = TRUE;
+ Level++;
}
}
}
@@ -387,150 +439,71 @@
/*******************************************************************************
*
- * FUNCTION: AcpiDmIsResourceDescriptor
+ * FUNCTION: AcpiDmIsResourceTemplate
*
* PARAMETERS: Op - Buffer Op to be examined
*
- * RETURN: TRUE if this Buffer Op contains a valid resource
- * descriptor.
+ * RETURN: Status. AE_OK if valid template
*
* DESCRIPTION: Walk a byte list to determine if it consists of a valid set
* of resource descriptors. Nothing is output.
*
******************************************************************************/
-BOOLEAN
-AcpiDmIsResourceDescriptor (
+ACPI_STATUS
+AcpiDmIsResourceTemplate (
ACPI_PARSE_OBJECT *Op)
{
- UINT8 *ByteData;
- UINT32 ByteCount;
+ ACPI_STATUS Status;
ACPI_PARSE_OBJECT *NextOp;
- ACPI_NATIVE_UINT CurrentByteOffset;
- UINT8 CurrentByte;
- UINT8 DescriptorId;
- UINT32 Length;
+ UINT8 *Aml;
+ UINT8 *EndAml;
+ ACPI_SIZE Length;
/* This op must be a buffer */
if (Op->Common.AmlOpcode != AML_BUFFER_OP)
{
- return FALSE;
+ return (AE_TYPE);
}
- /* Get to the ByteData list */
+ /* Get the ByteData list and length */
NextOp = Op->Common.Value.Arg;
NextOp = NextOp->Common.Next;
if (!NextOp)
{
- return (FALSE);
+ return (AE_TYPE);
}
- /* Extract the data pointer and data length */
-
- ByteCount = (UINT32) NextOp->Common.Value.Integer;
- ByteData = NextOp->Named.Data;
+ Aml = NextOp->Named.Data;
+ Length = (ACPI_SIZE) NextOp->Common.Value.Integer;
- /* Absolute minimum descriptor is an END_TAG (2 bytes) */
+ /* Walk the byte list, abort on any invalid descriptor type or length */
- if (ByteCount < 2)
+ Status = AcpiUtWalkAmlResources (Aml, Length, NULL, &EndAml);
+ if (ACPI_FAILURE (Status))
{
- return (FALSE);
- }
-
- /* The list must have a valid 2-byte END_TAG */
-
- if (ByteData[ByteCount-2] != (ACPI_RDESC_TYPE_END_TAG | 1))
- {
- return FALSE;
+ return (AE_TYPE);
}
/*
- * Walk the byte list. Abort on any invalid descriptor ID or
- * or length
+ * For the resource template to be valid, one EndTag must appear
+ * at the very end of the ByteList, not before. (For proper disassembly
+ * of a ResourceTemplate, the buffer must not have any extra data after
+ * the EndTag.)
*/
- for (CurrentByteOffset = 0; CurrentByteOffset < ByteCount;)
+ if ((Aml + Length - sizeof (AML_RESOURCE_END_TAG)) != EndAml)
{
- CurrentByte = ByteData[CurrentByteOffset];
-
- /* Large or small resource? */
-
- if (CurrentByte & ACPI_RDESC_TYPE_LARGE)
- {
- DescriptorId = CurrentByte;
- Length = (* (ACPI_CAST_PTR (UINT16, (&ByteData[CurrentByteOffset + 1]))));
- CurrentByteOffset += 3;
- }
- else
- {
- DescriptorId = (UINT8) (CurrentByte & 0xF8);
- Length = (ByteData[CurrentByteOffset] & 0x7);
- CurrentByteOffset += 1;
- }
-
- CurrentByteOffset += (ACPI_NATIVE_UINT) Length;
-
- /* Determine type of resource */
-
- switch (DescriptorId)
- {
- /*
- * "Small" type descriptors
- */
- case ACPI_RDESC_TYPE_IRQ_FORMAT:
- case ACPI_RDESC_TYPE_DMA_FORMAT:
- case ACPI_RDESC_TYPE_START_DEPENDENT:
- case ACPI_RDESC_TYPE_END_DEPENDENT:
- case ACPI_RDESC_TYPE_IO_PORT:
- case ACPI_RDESC_TYPE_FIXED_IO_PORT:
- case ACPI_RDESC_TYPE_SMALL_VENDOR:
-
- /*
- * "Large" type descriptors
- */
- case ACPI_RDESC_TYPE_MEMORY_24:
- case ACPI_RDESC_TYPE_GENERAL_REGISTER:
- case ACPI_RDESC_TYPE_LARGE_VENDOR:
- case ACPI_RDESC_TYPE_MEMORY_32:
- case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
- case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
- case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
- case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
- case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
-
- /* Valid descriptor ID, keep going */
-
- break;
-
-
- case ACPI_RDESC_TYPE_END_TAG:
-
- /* We must be at the end of the ByteList */
-
- if (CurrentByteOffset != ByteCount)
- {
- return (FALSE);
- }
-
- /* All descriptors/lengths valid, this is a valid descriptor */
-
- return (TRUE);
-
-
- default:
-
- /* Bad descriptor, abort */
-
- return (FALSE);
- }
+ return (AE_AML_NO_RESOURCE_END_TAG);
}
- /* Did not find an END_TAG, something seriously wrong */
-
- return (FALSE);
+ /*
+ * All resource descriptors are valid, therefore this list appears
+ * to be a valid resource template
+ */
+ return (AE_OK);
}
-
#endif
Index: exfield.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exfield.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exfield.c -L sys/contrib/dev/acpica/exfield.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exfield.c
+++ sys/contrib/dev/acpica/exfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfield - ACPI AML (p-code) execution - field manipulation
- * $Revision: 120 $
+ * $Revision: 1.131 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -151,10 +151,9 @@
ACPI_OPERAND_OBJECT *BufferDesc;
ACPI_SIZE Length;
void *Buffer;
- BOOLEAN Locked;
- ACPI_FUNCTION_TRACE_PTR ("ExReadDataFromField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExReadDataFromField, ObjDesc);
/* Parameter validation */
@@ -163,6 +162,10 @@
{
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
+ if (!RetBufferDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
{
@@ -194,16 +197,16 @@
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/*
* Perform the read.
* Note: Smbus protocol value is passed in upper 16-bits of Function
*/
Status = AcpiExAccessRegion (ObjDesc, 0,
- ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer),
- ACPI_READ | (ObjDesc->Field.Attribute << 16));
- AcpiExReleaseGlobalLock (Locked);
+ ACPI_CAST_PTR (ACPI_INTEGER, BufferDesc->Buffer.Pointer),
+ ACPI_READ | (ObjDesc->Field.Attribute << 16));
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
goto Exit;
}
@@ -255,12 +258,12 @@
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Read from the field */
Status = AcpiExExtractFromField (ObjDesc, Buffer, (UINT32) Length);
- AcpiExReleaseGlobalLock (Locked);
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
Exit:
@@ -268,7 +271,7 @@
{
AcpiUtRemoveReference (BufferDesc);
}
- else if (RetBufferDesc)
+ else
{
*RetBufferDesc = BufferDesc;
}
@@ -283,6 +286,7 @@
*
* PARAMETERS: SourceDesc - Contains data to write
* ObjDesc - The named field
+ * ResultDesc - Where the return value is returned, if any
*
* RETURN: Status
*
@@ -301,11 +305,10 @@
UINT32 RequiredLength;
void *Buffer;
void *NewBuffer;
- BOOLEAN Locked;
ACPI_OPERAND_OBJECT *BufferDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExWriteDataToField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExWriteDataToField, ObjDesc);
/* Parameter validation */
@@ -341,15 +344,18 @@
*/
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
{
- ACPI_REPORT_ERROR (("SMBus write requires Buffer, found type %s\n",
+ ACPI_ERROR ((AE_INFO, "SMBus write requires Buffer, found type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
+
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
if (SourceDesc->Buffer.Length < ACPI_SMBUS_BUFFER_SIZE)
{
- ACPI_REPORT_ERROR (("SMBus write requires Buffer of length %X, found length %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "SMBus write requires Buffer of length %X, found length %X",
ACPI_SMBUS_BUFFER_SIZE, SourceDesc->Buffer.Length));
+
return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
}
@@ -360,28 +366,29 @@
}
Buffer = BufferDesc->Buffer.Pointer;
- ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer, ACPI_SMBUS_BUFFER_SIZE);
+ ACPI_MEMCPY (Buffer, SourceDesc->Buffer.Pointer,
+ ACPI_SMBUS_BUFFER_SIZE);
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/*
- * Perform the write (returns status and perhaps data in the same buffer)
+ * Perform the write (returns status and perhaps data in the
+ * same buffer)
* Note: SMBus protocol type is passed in upper 16-bits of Function.
*/
Status = AcpiExAccessRegion (ObjDesc, 0,
(ACPI_INTEGER *) Buffer,
ACPI_WRITE | (ObjDesc->Field.Attribute << 16));
- AcpiExReleaseGlobalLock (Locked);
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
*ResultDesc = BufferDesc;
return_ACPI_STATUS (Status);
}
- /*
- * Get a pointer to the data to be written
- */
+ /* Get a pointer to the data to be written */
+
switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
{
case ACPI_TYPE_INTEGER:
@@ -410,13 +417,14 @@
* the ACPI specification.
*/
NewBuffer = NULL;
- RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength);
+ RequiredLength = ACPI_ROUND_BITS_UP_TO_BYTES (
+ ObjDesc->CommonField.BitLength);
if (Length < RequiredLength)
{
/* We need to create a new buffer */
- NewBuffer = ACPI_MEM_CALLOCATE (RequiredLength);
+ NewBuffer = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!NewBuffer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -436,6 +444,7 @@
"FieldWrite [FROM]: Obj %p (%s:%X), Buf %p, ByteLen %X\n",
SourceDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (SourceDesc)),
ACPI_GET_OBJECT_TYPE (SourceDesc), Buffer, Length));
+
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"FieldWrite [TO]: Obj %p (%s:%X), BitLen %X, BitOff %X, ByteOff %X\n",
ObjDesc, AcpiUtGetTypeName (ACPI_GET_OBJECT_TYPE (ObjDesc)),
@@ -446,18 +455,18 @@
/* Lock entire transaction if requested */
- Locked = AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
+ AcpiExAcquireGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Write to the field */
Status = AcpiExInsertIntoField (ObjDesc, Buffer, Length);
- AcpiExReleaseGlobalLock (Locked);
+ AcpiExReleaseGlobalLock (ObjDesc->CommonField.FieldFlags);
/* Free temporary buffer if we used one */
if (NewBuffer)
{
- ACPI_MEM_FREE (NewBuffer);
+ ACPI_FREE (NewBuffer);
}
return_ACPI_STATUS (Status);
Index: rsmemory.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsmemory.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsmemory.c -L sys/contrib/dev/acpica/rsmemory.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsmemory.c
+++ sys/contrib/dev/acpica/rsmemory.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmem24 - Memory resource descriptors
- * $Revision: 25 $
+ * $Revision: 1.34 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,516 +125,199 @@
/*******************************************************************************
*
- * FUNCTION: AcpiRsMemory24Resource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertMemory24
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsMemory24Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[4] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
-
-
- ACPI_FUNCTION_TRACE ("RsMemory24Resource");
-
-
- /*
- * Point past the Descriptor to get the number of bytes consumed
- */
- Buffer += 1;
-
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- Buffer += 2;
- *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
- OutputStruct->Id = ACPI_RSTYPE_MEM24;
-
- /*
- * Check Byte 3 the Read/Write bit
- */
- Temp8 = *Buffer;
- Buffer += 1;
- OutputStruct->Data.Memory24.ReadWriteAttribute = Temp8 & 0x01;
-
- /*
- * Get MinBaseAddress (Bytes 4-5)
- */
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- Buffer += 2;
- OutputStruct->Data.Memory24.MinBaseAddress = Temp16;
-
- /*
- * Get MaxBaseAddress (Bytes 6-7)
- */
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- Buffer += 2;
- OutputStruct->Data.Memory24.MaxBaseAddress = Temp16;
-
- /*
- * Get Alignment (Bytes 8-9)
- */
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- Buffer += 2;
- OutputStruct->Data.Memory24.Alignment = Temp16;
-
- /*
- * Get RangeLength (Bytes 10-11)
- */
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- OutputStruct->Data.Memory24.RangeLength = Temp16;
-
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY24,
+ ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY24),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemory24)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY24,
+ sizeof (AML_RESOURCE_MEMORY24),
+ 0},
+
+ /* Read/Write bit */
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory24.WriteProtect),
+ AML_OFFSET (Memory24.Flags),
+ 0},
+ /*
+ * These fields are contiguous in both the source and destination:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Base Alignment
+ * Range Length
+ */
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Memory24.Minimum),
+ AML_OFFSET (Memory24.Minimum),
+ 4}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsMemory24Stream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsConvertMemory32
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsMemory24Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[4] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
-
-
- ACPI_FUNCTION_TRACE ("RsMemory24Stream");
-
-
- /*
- * The descriptor field is static
- */
- *Buffer = 0x81;
- Buffer += 1;
-
- /*
- * The length field is static
- */
- Temp16 = 0x09;
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
-
- /*
- * Set the Information Byte
- */
- Temp8 = (UINT8) (LinkedList->Data.Memory24.ReadWriteAttribute & 0x01);
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the Range minimum base address
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MinBaseAddress);
- Buffer += 2;
-
- /*
- * Set the Range maximum base address
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.MaxBaseAddress);
- Buffer += 2;
-
- /*
- * Set the base alignment
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.Alignment);
- Buffer += 2;
-
- /*
- * Set the range length
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Memory24.RangeLength);
- Buffer += 2;
-
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_MEMORY32,
+ ACPI_RS_SIZE (ACPI_RESOURCE_MEMORY32),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemory32)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_MEMORY32,
+ sizeof (AML_RESOURCE_MEMORY32),
+ 0},
+
+ /* Read/Write bit */
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Memory32.WriteProtect),
+ AML_OFFSET (Memory32.Flags),
+ 0},
+ /*
+ * These fields are contiguous in both the source and destination:
+ * Minimum Base Address
+ * Maximum Base Address
+ * Address Base Alignment
+ * Range Length
+ */
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Memory32.Minimum),
+ AML_OFFSET (Memory32.Minimum),
+ 4}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsMemory32RangeResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertFixedMemory32
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsMemory32RangeResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[4] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
-
-
- ACPI_FUNCTION_TRACE ("RsMemory32RangeResource");
-
-
- /*
- * Point past the Descriptor to get the number of bytes consumed
- */
- Buffer += 1;
-
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- Buffer += 2;
- *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
-
- OutputStruct->Id = ACPI_RSTYPE_MEM32;
-
- /*
- * Point to the place in the output buffer where the data portion will
- * begin.
- * 1. Set the RESOURCE_DATA * Data to point to its own address, then
- * 2. Set the pointer to the next address.
- *
- * NOTE: OutputStruct->Data is cast to UINT8, otherwise, this addition adds
- * 4 * sizeof(RESOURCE_DATA) instead of 4 * sizeof(UINT8)
- */
-
- /*
- * Check Byte 3 the Read/Write bit
- */
- Temp8 = *Buffer;
- Buffer += 1;
-
- OutputStruct->Data.Memory32.ReadWriteAttribute = Temp8 & 0x01;
-
- /*
- * Get MinBaseAddress (Bytes 4-7)
- */
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MinBaseAddress, Buffer);
- Buffer += 4;
-
- /*
- * Get MaxBaseAddress (Bytes 8-11)
- */
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.MaxBaseAddress, Buffer);
- Buffer += 4;
-
- /*
- * Get Alignment (Bytes 12-15)
- */
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.Alignment, Buffer);
- Buffer += 4;
-
- /*
- * Get RangeLength (Bytes 16-19)
- */
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Memory32.RangeLength, Buffer);
-
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_MEMORY32,
+ ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_MEMORY32),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedMemory32)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_MEMORY32,
+ sizeof (AML_RESOURCE_FIXED_MEMORY32),
+ 0},
+
+ /* Read/Write bit */
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.FixedMemory32.WriteProtect),
+ AML_OFFSET (FixedMemory32.Flags),
+ 0},
+ /*
+ * These fields are contiguous in both the source and destination:
+ * Base Address
+ * Range Length
+ */
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.FixedMemory32.Address),
+ AML_OFFSET (FixedMemory32.Address),
+ 2}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsFixedMemory32Resource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsGetVendorSmall
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsFixedMemory32Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[3] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
-
-
- ACPI_FUNCTION_TRACE ("RsFixedMemory32Resource");
-
-
- /*
- * Point past the Descriptor to get the number of bytes consumed
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- Buffer += 2;
- *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
-
- OutputStruct->Id = ACPI_RSTYPE_FIXED_MEM32;
-
- /*
- * Check Byte 3 the Read/Write bit
- */
- Temp8 = *Buffer;
- Buffer += 1;
- OutputStruct->Data.FixedMemory32.ReadWriteAttribute = Temp8 & 0x01;
-
- /*
- * Get RangeBaseAddress (Bytes 4-7)
- */
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeBaseAddress, Buffer);
- Buffer += 4;
-
- /*
- * Get RangeLength (Bytes 8-11)
- */
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.FixedMemory32.RangeLength, Buffer);
-
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
+ ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
+ ACPI_RSC_TABLE_SIZE (AcpiRsGetVendorSmall)},
+
+ /* Length of the vendor data (byte count) */
+
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
+ 0,
+ sizeof (UINT8)},
+
+ /* Vendor data */
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
+ sizeof (AML_RESOURCE_SMALL_HEADER),
+ 0}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsMemory32RangeStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsGetVendorLarge
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsMemory32RangeStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[3] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
-
-
- ACPI_FUNCTION_TRACE ("RsMemory32RangeStream");
-
-
- /*
- * The descriptor field is static
- */
- *Buffer = 0x85;
- Buffer += 1;
-
- /*
- * The length field is static
- */
- Temp16 = 0x11;
-
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
-
- /*
- * Set the Information Byte
- */
- Temp8 = (UINT8) (LinkedList->Data.Memory32.ReadWriteAttribute & 0x01);
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the Range minimum base address
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MinBaseAddress);
- Buffer += 4;
-
- /*
- * Set the Range maximum base address
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.MaxBaseAddress);
- Buffer += 4;
-
- /*
- * Set the base alignment
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.Alignment);
- Buffer += 4;
-
- /*
- * Set the range length
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Memory32.RangeLength);
- Buffer += 4;
-
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_VENDOR,
+ ACPI_RS_SIZE (ACPI_RESOURCE_VENDOR),
+ ACPI_RSC_TABLE_SIZE (AcpiRsGetVendorLarge)},
+
+ /* Length of the vendor data (byte count) */
+
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
+ 0,
+ sizeof (UINT8)},
+
+ /* Vendor data */
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
+ sizeof (AML_RESOURCE_LARGE_HEADER),
+ 0}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsFixedMemory32Stream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsSetVendor
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsFixedMemory32Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsSetVendor[7] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
+ /* Default is a small vendor descriptor */
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_SMALL,
+ sizeof (AML_RESOURCE_SMALL_HEADER),
+ ACPI_RSC_TABLE_SIZE (AcpiRsSetVendor)},
- ACPI_FUNCTION_TRACE ("RsFixedMemory32Stream");
+ /* Get the length and copy the data */
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
+ 0,
+ 0},
- /*
- * The descriptor field is static
- */
- *Buffer = 0x86;
- Buffer += 1;
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
+ sizeof (AML_RESOURCE_SMALL_HEADER),
+ 0},
/*
- * The length field is static
+ * All done if the Vendor byte length is 7 or less, meaning that it will
+ * fit within a small descriptor
*/
- Temp16 = 0x09;
+ {ACPI_RSC_EXIT_LE, 0, 0, 7},
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
+ /* Must create a large vendor descriptor */
- /*
- * Set the Information Byte
- */
- Temp8 = (UINT8) (LinkedList->Data.FixedMemory32.ReadWriteAttribute & 0x01);
- *Buffer = Temp8;
- Buffer += 1;
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_VENDOR_LARGE,
+ sizeof (AML_RESOURCE_LARGE_HEADER),
+ 0},
- /*
- * Set the Range base address
- */
- ACPI_MOVE_32_TO_32 (Buffer,
- &LinkedList->Data.FixedMemory32.RangeBaseAddress);
- Buffer += 4;
+ {ACPI_RSC_COUNT16, ACPI_RS_OFFSET (Data.Vendor.ByteLength),
+ 0,
+ 0},
- /*
- * Set the range length
- */
- ACPI_MOVE_32_TO_32 (Buffer,
- &LinkedList->Data.FixedMemory32.RangeLength);
- Buffer += 4;
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Vendor.ByteData[0]),
+ sizeof (AML_RESOURCE_LARGE_HEADER),
+ 0}
+};
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
Index: utdebug.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utdebug.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utdebug.c -L sys/contrib/dev/acpica/utdebug.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utdebug.c
+++ sys/contrib/dev/acpica/utdebug.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utdebug - Debug print routines
- * $Revision: 111 $
+ * $Revision: 1.133 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,8 +128,14 @@
static char *AcpiGbl_FnEntryStr = "----Entry";
static char *AcpiGbl_FnExitStr = "----Exit-";
+/* Local prototypes */
-/*****************************************************************************
+static const char *
+AcpiUtTrimFunctionName (
+ const char *FunctionName);
+
+
+/*******************************************************************************
*
* FUNCTION: AcpiUtInitStackPtrTrace
*
@@ -137,22 +143,22 @@
*
* RETURN: None
*
- * DESCRIPTION: Save the current stack pointer
+ * DESCRIPTION: Save the current CPU stack pointer at subsystem startup
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtInitStackPtrTrace (
void)
{
- UINT32 CurrentSp;
+ UINT32 CurrentSp;
AcpiGbl_EntryStackPointer = ACPI_PTR_DIFF (&CurrentSp, NULL);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtTrackStackPtr
*
@@ -160,15 +166,15 @@
*
* RETURN: None
*
- * DESCRIPTION: Save the current stack pointer
+ * DESCRIPTION: Save the current CPU stack pointer
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtTrackStackPtr (
void)
{
- ACPI_SIZE CurrentSp;
+ ACPI_SIZE CurrentSp;
CurrentSp = ACPI_PTR_DIFF (&CurrentSp, NULL);
@@ -185,16 +191,54 @@
}
-/*****************************************************************************
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtTrimFunctionName
+ *
+ * PARAMETERS: FunctionName - Ascii string containing a procedure name
+ *
+ * RETURN: Updated pointer to the function name
+ *
+ * DESCRIPTION: Remove the "Acpi" prefix from the function name, if present.
+ * This allows compiler macros such as __FUNCTION__ to be used
+ * with no change to the debug output.
+ *
+ ******************************************************************************/
+
+static const char *
+AcpiUtTrimFunctionName (
+ const char *FunctionName)
+{
+
+ /* All Function names are longer than 4 chars, check is safe */
+
+ if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_MIXED)
+ {
+ /* This is the case where the original source has not been modified */
+
+ return (FunctionName + 4);
+ }
+
+ if (*(ACPI_CAST_PTR (UINT32, FunctionName)) == ACPI_PREFIX_LOWER)
+ {
+ /* This is the case where the source has been 'linuxized' */
+
+ return (FunctionName + 5);
+ }
+
+ return (FunctionName);
+}
+
+
+/*******************************************************************************
*
* FUNCTION: AcpiUtDebugPrint
*
- * PARAMETERS: DebugLevel - Requested debug print level
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name (for error output)
+ * PARAMETERS: RequestedDebugLevel - Requested debug print level
* LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- *
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Format - Printf format field
* ... - Optional printf arguments
*
@@ -203,17 +247,19 @@
* DESCRIPTION: Print error message with prefix consisting of the module name,
* line number, and component ID.
*
- ****************************************************************************/
+ ******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrint (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *Format,
...)
{
- UINT32 ThreadId;
+ ACPI_THREAD_ID ThreadId;
va_list args;
@@ -221,7 +267,7 @@
* Stay silent if the debug level or component ID is disabled
*/
if (!(RequestedDebugLevel & AcpiDbgLevel) ||
- !(DbgInfo->ComponentId & AcpiDbgLayer))
+ !(ComponentId & AcpiDbgLayer))
{
return;
}
@@ -230,12 +276,12 @@
* Thread tracking and context switch notification
*/
ThreadId = AcpiOsGetThreadId ();
-
if (ThreadId != AcpiGbl_PrevThreadId)
{
if (ACPI_LV_THREADS & AcpiDbgLevel)
{
- AcpiOsPrintf ("\n**** Context Switch from TID %X to TID %X ****\n\n",
+ AcpiOsPrintf (
+ "\n**** Context Switch from TID %X to TID %X ****\n\n",
AcpiGbl_PrevThreadId, ThreadId);
}
@@ -246,30 +292,32 @@
* Display the module name, current line number, thread ID (if requested),
* current procedure nesting level, and the current procedure name
*/
- AcpiOsPrintf ("%8s-%04ld ", DbgInfo->ModuleName, LineNumber);
+ AcpiOsPrintf ("%8s-%04ld ", ModuleName, LineNumber);
if (ACPI_LV_THREADS & AcpiDbgLevel)
{
AcpiOsPrintf ("[%04lX] ", ThreadId);
}
- AcpiOsPrintf ("[%02ld] %-22.22s: ", AcpiGbl_NestingLevel, DbgInfo->ProcName);
+ AcpiOsPrintf ("[%02ld] %-22.22s: ",
+ AcpiGbl_NestingLevel, AcpiUtTrimFunctionName (FunctionName));
va_start (args, Format);
AcpiOsVprintf (Format, args);
}
+ACPI_EXPORT_SYMBOL (AcpiUtDebugPrint)
-/*****************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiUtDebugPrintRaw
*
* PARAMETERS: RequestedDebugLevel - Requested debug print level
* LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Format - Printf format field
* ... - Optional printf arguments
*
@@ -278,13 +326,15 @@
* DESCRIPTION: Print message with no headers. Has same interface as
* DebugPrint so that the same macros can be used.
*
- ****************************************************************************/
+ ******************************************************************************/
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrintRaw (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *Format,
...)
{
@@ -292,7 +342,7 @@
if (!(RequestedDebugLevel & AcpiDbgLevel) ||
- !(DbgInfo->ComponentId & AcpiDbgLayer))
+ !(ComponentId & AcpiDbgLayer))
{
return;
}
@@ -301,47 +351,52 @@
AcpiOsVprintf (Format, args);
}
+ACPI_EXPORT_SYMBOL (AcpiUtDebugPrintRaw)
+
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtTrace
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
*
* RETURN: None
*
* DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtTrace (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo)
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s\n", AcpiGbl_FnEntryStr);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s\n", AcpiGbl_FnEntryStr);
}
+ACPI_EXPORT_SYMBOL (AcpiUtTrace)
-/*****************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiUtTracePtr
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Pointer - Pointer to display
*
* RETURN: None
@@ -349,31 +404,33 @@
* DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtTracePtr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
void *Pointer)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %p\n", AcpiGbl_FnEntryStr, Pointer);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtTraceStr
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* String - Additional string to display
*
* RETURN: None
@@ -381,32 +438,34 @@
* DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtTraceStr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *String)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %s\n", AcpiGbl_FnEntryStr, String);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %s\n", AcpiGbl_FnEntryStr, String);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtTraceU32
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Integer - Integer to display
*
* RETURN: None
@@ -414,62 +473,68 @@
* DESCRIPTION: Function entry trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtTraceU32 (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT32 Integer)
{
AcpiGbl_NestingLevel++;
AcpiUtTrackStackPtr ();
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %08X\n", AcpiGbl_FnEntryStr, Integer);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
*
* RETURN: None
*
* DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo)
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId)
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s\n", AcpiGbl_FnExitStr);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s\n", AcpiGbl_FnExitStr);
AcpiGbl_NestingLevel--;
}
+ACPI_EXPORT_SYMBOL (AcpiUtExit)
+
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtStatusExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Status - Exit status code
*
* RETURN: None
@@ -477,41 +542,46 @@
* DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel. Prints exit status also.
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtStatusExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_STATUS Status)
{
if (ACPI_SUCCESS (Status))
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %s\n", AcpiGbl_FnExitStr,
- AcpiFormatException (Status));
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %s\n", AcpiGbl_FnExitStr,
+ AcpiFormatException (Status));
}
else
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
- AcpiFormatException (Status));
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s ****Exception****: %s\n", AcpiGbl_FnExitStr,
+ AcpiFormatException (Status));
}
AcpiGbl_NestingLevel--;
}
+ACPI_EXPORT_SYMBOL (AcpiUtStatusExit)
-/*****************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiUtValueExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
* Value - Value to be printed with exit msg
*
* RETURN: None
@@ -519,50 +589,57 @@
* DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel. Prints exit value also.
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtValueExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_INTEGER Value)
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
- ACPI_FORMAT_UINT64 (Value));
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %8.8X%8.8X\n", AcpiGbl_FnExitStr,
+ ACPI_FORMAT_UINT64 (Value));
AcpiGbl_NestingLevel--;
}
+ACPI_EXPORT_SYMBOL (AcpiUtValueExit)
+
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtPtrExit
*
* PARAMETERS: LineNumber - Caller's line number
- * DbgInfo - Contains:
- * ProcName - Caller's procedure name
- * ModuleName - Caller's module name
- * ComponentId - Caller's component ID
- * Value - Value to be printed with exit msg
+ * FunctionName - Caller's procedure name
+ * ModuleName - Caller's module name
+ * ComponentId - Caller's component ID
+ * Ptr - Pointer to display
*
* RETURN: None
*
* DESCRIPTION: Function exit trace. Prints only if TRACE_FUNCTIONS bit is
* set in DebugLevel. Prints exit value also.
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiUtPtrExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT8 *Ptr)
{
- AcpiUtDebugPrint (ACPI_LV_FUNCTIONS, LineNumber, DbgInfo,
- "%s %p\n", AcpiGbl_FnExitStr, Ptr);
+ AcpiUtDebugPrint (ACPI_LV_FUNCTIONS,
+ LineNumber, FunctionName, ModuleName, ComponentId,
+ "%s %p\n", AcpiGbl_FnExitStr, Ptr);
AcpiGbl_NestingLevel--;
}
@@ -570,7 +647,7 @@
#endif
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtDumpBuffer
*
@@ -583,14 +660,13 @@
*
* DESCRIPTION: Generic dump buffer in both hex and ascii.
*
- ****************************************************************************/
+ ******************************************************************************/
void
-AcpiUtDumpBuffer (
+AcpiUtDumpBuffer2 (
UINT8 *Buffer,
UINT32 Count,
- UINT32 Display,
- UINT32 ComponentId)
+ UINT32 Display)
{
ACPI_NATIVE_UINT i = 0;
ACPI_NATIVE_UINT j;
@@ -598,29 +674,18 @@
UINT8 BufChar;
- /* Only dump the buffer if tracing is enabled */
-
- if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
- (ComponentId & AcpiDbgLayer)))
- {
- return;
- }
-
if ((Count < 4) || (Count & 0x01))
{
Display = DB_BYTE_DISPLAY;
}
- AcpiOsPrintf ("\nOffset Value\n");
+ /* Nasty little dump buffer routine! */
- /*
- * Nasty little dump buffer routine!
- */
while (i < Count)
{
/* Print current offset */
- AcpiOsPrintf ("%05X ", (UINT32) i);
+ AcpiOsPrintf ("%6.4X: ", (UINT32) i);
/* Print 16 hex chars */
@@ -628,21 +693,19 @@
{
if (i + j >= Count)
{
- AcpiOsPrintf ("\n");
- return;
- }
+ /* Dump fill spaces */
- /* Make sure that the INT8 doesn't get sign-extended! */
+ AcpiOsPrintf ("%*s", ((Display * 2) + 1), " ");
+ j += (ACPI_NATIVE_UINT) Display;
+ continue;
+ }
switch (Display)
{
- /* Default is BYTE display */
-
- default:
+ case DB_BYTE_DISPLAY:
+ default: /* Default is BYTE display */
- AcpiOsPrintf ("%02X ",
- *((UINT8 *) &Buffer[i + j]));
- j += 1;
+ AcpiOsPrintf ("%02X ", Buffer[i + j]);
break;
@@ -650,7 +713,6 @@
ACPI_MOVE_16_TO_32 (&Temp32, &Buffer[i + j]);
AcpiOsPrintf ("%04X ", Temp32);
- j += 2;
break;
@@ -658,7 +720,6 @@
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j]);
AcpiOsPrintf ("%08X ", Temp32);
- j += 4;
break;
@@ -669,15 +730,17 @@
ACPI_MOVE_32_TO_32 (&Temp32, &Buffer[i + j + 4]);
AcpiOsPrintf ("%08X ", Temp32);
- j += 8;
break;
}
+
+ j += (ACPI_NATIVE_UINT) Display;
}
/*
- * Print the ASCII equivalent characters
- * But watch out for the bad unprintable ones...
+ * Print the ASCII equivalent characters but watch out for the bad
+ * unprintable ones (printable chars are 0x20 through 0x7E)
*/
+ AcpiOsPrintf (" ");
for (j = 0; j < 16; j++)
{
if (i + j >= Count)
@@ -687,9 +750,7 @@
}
BufChar = Buffer[i + j];
- if ((BufChar > 0x1F && BufChar < 0x2E) ||
- (BufChar > 0x2F && BufChar < 0x61) ||
- (BufChar > 0x60 && BufChar < 0x7F))
+ if (ACPI_IS_PRINT (BufChar))
{
AcpiOsPrintf ("%c", BufChar);
}
@@ -708,3 +769,39 @@
return;
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtDumpBuffer
+ *
+ * PARAMETERS: Buffer - Buffer to dump
+ * Count - Amount to dump, in bytes
+ * Display - BYTE, WORD, DWORD, or QWORD display
+ * ComponentID - Caller's component ID
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Generic dump buffer in both hex and ascii.
+ *
+ ******************************************************************************/
+
+void
+AcpiUtDumpBuffer (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 ComponentId)
+{
+
+ /* Only dump the buffer if tracing is enabled */
+
+ if (!((ACPI_LV_TABLES & AcpiDbgLevel) &&
+ (ComponentId & AcpiDbgLayer)))
+ {
+ return;
+ }
+
+ AcpiUtDumpBuffer2 (Buffer, Count, Display);
+}
+
+
Index: dbxface.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbxface.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbxface.c -L sys/contrib/dev/acpica/dbxface.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbxface.c
+++ sys/contrib/dev/acpica/dbxface.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbxface - AML Debugger external interfaces
- * $Revision: 71 $
+ * $Revision: 1.78 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,11 +127,26 @@
ACPI_MODULE_NAME ("dbxface")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDbStartCommand (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+void
+AcpiDbMethodEnd (
+ ACPI_WALK_STATE *WalkState);
+#endif
+
+
/*******************************************************************************
*
* FUNCTION: AcpiDbStartCommand
*
* PARAMETERS: WalkState - Current walk
+ * Op - Current executing Op, from AML interpreter
*
* RETURN: Status
*
@@ -139,7 +154,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbStartCommand (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
@@ -147,7 +162,7 @@
ACPI_STATUS Status;
- /* TBD: [Investigate] what are the namespace locking issues here */
+ /* TBD: [Investigate] are there namespace locking issues here? */
/* AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE); */
@@ -208,38 +223,10 @@
/*******************************************************************************
*
- * FUNCTION: AcpiDbMethodEnd
- *
- * PARAMETERS: WalkState - Current walk
- *
- * RETURN: Status
- *
- * DESCRIPTION:
- *
- ******************************************************************************/
-
-void
-AcpiDbMethodEnd (
- ACPI_WALK_STATE *WalkState)
-{
-
- if (!AcpiGbl_CmSingleStep)
- {
- return;
- }
-
- AcpiOsPrintf ("<Method Terminating>\n");
-
- AcpiDbStartCommand (WalkState, NULL);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDbSingleStep
*
* PARAMETERS: WalkState - Current walk
- * Op - Current executing op
+ * Op - Current executing op (from aml interpreter)
* OpcodeClass - Class of the current AML Opcode
*
* RETURN: Status
@@ -291,7 +278,8 @@
else if (WalkState->UserBreakpoint &&
(WalkState->UserBreakpoint == Op->Common.AmlOffset))
{
- AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n", Op->Common.AmlOffset);
+ AcpiOsPrintf ("***UserBreakpoint*** at AML offset %X\n",
+ Op->Common.AmlOffset);
AcpiGbl_CmSingleStep = TRUE;
AcpiGbl_StepToNextCall = FALSE;
WalkState->MethodBreakpoint = 0;
@@ -331,9 +319,9 @@
}
/*
- * Display this op (and only this op - zero out the NEXT field temporarily,
- * and disable parser trace output for the duration of the display because
- * we don't want the extraneous debug output)
+ * Display this op (and only this op - zero out the NEXT field
+ * temporarily, and disable parser trace output for the duration of
+ * the display because we don't want the extraneous debug output)
*/
OriginalDebugLevel = AcpiDbgLevel;
AcpiDbgLevel &= ~(ACPI_LV_PARSE | ACPI_LV_FUNCTIONS);
@@ -346,7 +334,8 @@
if (ParentOp)
{
if ((WalkState->ControlState) &&
- (WalkState->ControlState->Common.State == ACPI_CONTROL_PREDICATE_EXECUTING))
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_PREDICATE_EXECUTING))
{
/*
* We are executing the predicate of an IF or WHILE statement
@@ -448,10 +437,14 @@
*/
if (Op->Common.AmlOpcode == AML_INT_METHODCALL_OP)
{
- AcpiGbl_CmSingleStep = FALSE; /* No more single step while executing called method */
+ /* Force no more single stepping while executing called method */
- /* Set the breakpoint on/before the call, it will stop execution as soon as we return */
+ AcpiGbl_CmSingleStep = FALSE;
+ /*
+ * Set the breakpoint on/before the call, it will stop execution
+ * as soon as we return
+ */
WalkState->MethodBreakpoint = 1; /* Must be non-zero! */
}
@@ -477,7 +470,8 @@
******************************************************************************/
ACPI_STATUS
-AcpiDbInitialize (void)
+AcpiDbInitialize (
+ void)
{
ACPI_STATUS Status;
@@ -538,7 +532,7 @@
/* Create the debug execution thread to execute commands */
- Status = AcpiOsQueueForExecution (0, AcpiDbExecuteThread, NULL);
+ Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbExecuteThread, NULL);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("Could not start debugger thread\n");
@@ -564,14 +558,15 @@
*
* PARAMETERS: None
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Stop debugger
*
******************************************************************************/
void
-AcpiDbTerminate (void)
+AcpiDbTerminate (
+ void)
{
if (AcpiGbl_DbTablePtr)
@@ -585,4 +580,33 @@
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbMethodEnd
+ *
+ * PARAMETERS: WalkState - Current walk
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Called at method termination
+ *
+ ******************************************************************************/
+
+void
+AcpiDbMethodEnd (
+ ACPI_WALK_STATE *WalkState)
+{
+
+ if (!AcpiGbl_CmSingleStep)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("<Method Terminating>\n");
+
+ AcpiDbStartCommand (WalkState, NULL);
+}
+#endif
+
#endif /* ACPI_DEBUGGER */
Index: nsxfobj.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsxfobj.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsxfobj.c -L sys/contrib/dev/acpica/nsxfobj.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsxfobj.c
+++ sys/contrib/dev/acpica/nsxfobj.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfobj - Public interfaces to the ACPI subsystem
* ACPI Object oriented interfaces
- * $Revision: 117 $
+ * $Revision: 1.122 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,7 +130,7 @@
* FUNCTION: AcpiGetType
*
* PARAMETERS: Handle - Handle of object whose type is desired
- * *RetType - Where the type will be placed
+ * RetType - Where the type will be placed
*
* RETURN: Status
*
@@ -186,6 +186,8 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetType)
+
/*******************************************************************************
*
@@ -256,6 +258,8 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetParent)
+
/*******************************************************************************
*
@@ -348,4 +352,5 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetNextObject)
Index: dmwalk.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmwalk.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmwalk.c -L sys/contrib/dev/acpica/dmwalk.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmwalk.c
+++ sys/contrib/dev/acpica/dmwalk.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmwalk - AML disassembly tree walk
- * $Revision: 14 $
+ * $Revision: 1.33 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,14 +128,33 @@
ACPI_MODULE_NAME ("dmwalk")
-#define DB_FULL_OP_INFO "%5.5X #%4.4hX "
+#define DB_FULL_OP_INFO "[%4.4s] @%5.5X #%4.4X: "
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDmDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static UINT32
+AcpiDmBlockType (
+ ACPI_PARSE_OBJECT *Op);
/*******************************************************************************
*
* FUNCTION: AcpiDmDisassemble
*
- * PARAMETERS: Origin - Starting object
+ * PARAMETERS: WalkState - Current state
+ * Origin - Starting object
* NumOpcodes - Max number of opcodes to be displayed
*
* RETURN: None
@@ -160,9 +179,11 @@
return;
}
+ Info.Flags = 0;
Info.Level = 0;
+ Info.Count = 0;
+ Info.WalkState = WalkState;
AcpiDmWalkParseTree (Op, AcpiDmDescendingOp, AcpiDmAscendingOp, &Info);
-
return;
}
@@ -171,7 +192,8 @@
*
* FUNCTION: AcpiDmWalkParseTree
*
- * PARAMETERS: DescendingCallback - Called during tree descent
+ * PARAMETERS: Op - Root Op object
+ * DescendingCallback - Called during tree descent
* AscendingCallback - Called during tree ascent
* Context - To be passed to the callbacks
*
@@ -202,10 +224,13 @@
{
if (NodePreviouslyVisited)
{
- Status = AscendingCallback (Op, Info->Level, Context);
- if (ACPI_FAILURE (Status))
+ if (AscendingCallback)
{
- return;
+ Status = AscendingCallback (Op, Info->Level, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
}
}
else
@@ -281,13 +306,13 @@
*
* PARAMETERS: Op - Object to be examined
*
- * RETURN: Status
+ * RETURN: BlockType - not a block, parens, braces, or even both.
*
* DESCRIPTION: Type of block for this op (parens or braces)
*
******************************************************************************/
-UINT32
+static UINT32
AcpiDmBlockType (
ACPI_PARSE_OBJECT *Op)
{
@@ -356,7 +381,7 @@
*
* PARAMETERS: Op - Object to be examined
*
- * RETURN: Status
+ * RETURN: ListType - has commas or not.
*
* DESCRIPTION: Type of block for this op (parens or braces)
*
@@ -390,7 +415,7 @@
case AML_INDEX_FIELD_OP:
case AML_BANK_FIELD_OP:
- return (0);
+ return (BLOCK_NONE);
case AML_BUFFER_OP:
case AML_PACKAGE_OP:
@@ -424,7 +449,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDmDescendingOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -450,8 +475,13 @@
{
/* In verbose mode, print the AML offset, opcode and depth count */
- VERBOSE_PRINT ((DB_FULL_OP_INFO, (UINT32) Op->Common.AmlOffset,
- Op->Common.AmlOpcode));
+ if (Info->WalkState)
+ {
+ VERBOSE_PRINT ((DB_FULL_OP_INFO,
+ (Info->WalkState->MethodNode ?
+ Info->WalkState->MethodNode->Name.Ascii : " "),
+ Op->Common.AmlOffset, (UINT32) Op->Common.AmlOpcode));
+ }
if (Op->Common.AmlOpcode == AML_SCOPE_OP)
{
@@ -463,17 +493,47 @@
if (AcpiGbl_ExternalList)
{
- AcpiOsPrintf (" /*\n * These objects were referenced but not defined in this table\n */\n");
-
- /* Walk the list of externals (unresolved references) found during parsing */
-
+ /*
+ * Walk the list of externals (unresolved references)
+ * found during parsing
+ */
while (AcpiGbl_ExternalList)
{
- AcpiOsPrintf (" External (%s, DeviceObj)\n", AcpiGbl_ExternalList->Path);
+ AcpiOsPrintf (" External (%s",
+ AcpiGbl_ExternalList->Path);
+
+ /* TBD: should be a lookup table */
+
+ switch (AcpiGbl_ExternalList->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ AcpiOsPrintf (", DeviceObj");
+ break;
+
+ case ACPI_TYPE_METHOD:
+ AcpiOsPrintf (", MethodObj");
+ break;
+
+ case ACPI_TYPE_INTEGER:
+ AcpiOsPrintf (", IntObj");
+ break;
+
+ default:
+ break;
+ }
+
+ if (AcpiGbl_ExternalList->Type == ACPI_TYPE_METHOD)
+ {
+ AcpiOsPrintf (") // %d Arguments\n", AcpiGbl_ExternalList->Value);
+ }
+ else
+ {
+ AcpiOsPrintf (")\n");
+ }
NextExternal = AcpiGbl_ExternalList->Next;
- ACPI_MEM_FREE (AcpiGbl_ExternalList->Path);
- ACPI_MEM_FREE (AcpiGbl_ExternalList);
+ ACPI_FREE (AcpiGbl_ExternalList->Path);
+ ACPI_FREE (AcpiGbl_ExternalList);
AcpiGbl_ExternalList = NextExternal;
}
AcpiOsPrintf ("\n");
@@ -486,15 +546,38 @@
(!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
(Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
{
- /* This is a first-level element of a term list, indent a new line */
-
+ /*
+ * This is a first-level element of a term list,
+ * indent a new line
+ */
AcpiDmIndent (Level);
+ Info->LastLevel = Level;
+ Info->Count = 0;
+ }
+
+ /*
+ * This is an inexpensive mechanism to try and keep lines from getting
+ * too long. When the limit is hit, start a new line at the previous
+ * indent plus one. A better but more expensive mechanism would be to
+ * keep track of the current column.
+ */
+ Info->Count++;
+ if (Info->Count /*+Info->LastLevel*/ > 10)
+ {
+ Info->Count = 0;
+ AcpiOsPrintf ("\n");
+ AcpiDmIndent (Info->LastLevel + 1);
}
/* Print the opcode name */
AcpiDmDisassembleOneOp (NULL, Info, Op);
+ if (Op->Common.DisasmOpcode == ACPI_DASM_LNOT_PREFIX)
+ {
+ return (AE_OK);
+ }
+
if ((Op->Common.AmlOpcode == AML_NAME_OP) ||
(Op->Common.AmlOpcode == AML_RETURN_OP))
{
@@ -542,10 +625,8 @@
AcpiDmDumpName ((char *) &Name);
}
-
if (Op->Common.AmlOpcode != AML_INT_NAMEDFIELD_OP)
{
- AcpiDmValidateName ((char *) &Name, Op);
if (AcpiGbl_DbOpt_verbose)
{
(void) AcpiPsDisplayObjectPathname (NULL, Op);
@@ -567,7 +648,7 @@
/* Check for _HID and related EISAID() */
- AcpiIsEisaId (Op);
+ AcpiDmIsEisaId (Op);
AcpiOsPrintf (", ");
break;
@@ -608,6 +689,7 @@
case AML_MUTEX_OP:
+ case AML_DATA_REGION_OP:
AcpiOsPrintf (", ");
return (AE_OK);
@@ -629,7 +711,7 @@
default:
- AcpiOsPrintf ("*** Unhandled named opcode\n");
+ AcpiOsPrintf ("*** Unhandled named opcode %X\n", Op->Common.AmlOpcode);
break;
}
}
@@ -653,23 +735,34 @@
{
case AML_BANK_FIELD_OP:
- /* Namestring */
+ /* Namestring - Bank Name */
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
AcpiDmNamestring (NextOp->Common.Value.Name);
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
AcpiOsPrintf (", ");
-
+ /*
+ * Bank Value. This is a TermArg in the middle of the parameter
+ * list, must handle it here.
+ *
+ * Disassemble the TermArg parse tree. ACPI_PARSEOP_PARAMLIST
+ * eliminates newline in the output.
+ */
NextOp = NextOp->Common.Next;
- AcpiDmDisassembleOneOp (NULL, Info, NextOp);
+
+ Info->Flags = ACPI_PARSEOP_PARAMLIST;
+ AcpiDmWalkParseTree (NextOp, AcpiDmDescendingOp, AcpiDmAscendingOp, Info);
+ Info->Flags = 0;
+ Info->Level = Level;
+
NextOp->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
AcpiOsPrintf (", ");
break;
case AML_INDEX_FIELD_OP:
- /* Namestring */
+ /* Namestring - Data Name */
NextOp = AcpiPsGetDepthNext (NULL, NextOp);
AcpiDmNamestring (NextOp->Common.Value.Name);
@@ -780,7 +873,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDmAscendingOp (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -820,9 +913,14 @@
(!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
(Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
{
- /* This is a first-level element of a term list, start a new line */
-
- AcpiOsPrintf ("\n");
+ /*
+ * This is a first-level element of a term list
+ * start a new line
+ */
+ if (!(Info->Flags & ACPI_PARSEOP_PARAMLIST))
+ {
+ AcpiOsPrintf ("\n");
+ }
}
}
break;
@@ -879,8 +977,10 @@
(!(Op->Common.DisasmFlags & ACPI_PARSEOP_PARAMLIST)) &&
(Op->Common.AmlOpcode != AML_INT_BYTELIST_OP))
{
- /* This is a first-level element of a term list, start a new line */
-
+ /*
+ * This is a first-level element of a term list
+ * start a new line
+ */
AcpiOsPrintf ("\n");
}
}
@@ -925,7 +1025,8 @@
}
else
{
- Op->Common.Parent->Common.DisasmFlags |= ACPI_PARSEOP_EMPTY_TERMLIST;
+ Op->Common.Parent->Common.DisasmFlags |=
+ ACPI_PARSEOP_EMPTY_TERMLIST;
AcpiOsPrintf (") {");
}
}
Index: psutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/psutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/psutils.c -L sys/contrib/dev/acpica/psutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/psutils.c
+++ sys/contrib/dev/acpica/psutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psutils - Parser miscellaneous utilities (Parser only)
- * $Revision: 58 $
+ * $Revision: 1.70 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,7 +118,6 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/amlcode.h>
-#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psutils")
@@ -130,7 +129,7 @@
*
* PARAMETERS: None
*
- * RETURN: ScopeOp
+ * RETURN: A new Scope object, null on failure
*
* DESCRIPTION: Create a Scope and associated namepath op with the root name
*
@@ -149,7 +148,6 @@
return (NULL);
}
-
ScopeOp->Named.Name = ACPI_ROOT_NAME;
return (ScopeOp);
}
@@ -162,10 +160,9 @@
* PARAMETERS: Op - A newly allocated Op object
* Opcode - Opcode to store in the Op
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
- * opcode
+ * DESCRIPTION: Initialize a parse (Op) object
*
******************************************************************************/
@@ -177,11 +174,12 @@
ACPI_FUNCTION_ENTRY ();
- Op->Common.DataType = ACPI_DESC_TYPE_PARSER;
+ Op->Common.DescriptorType = ACPI_DESC_TYPE_PARSER;
Op->Common.AmlOpcode = Opcode;
ACPI_DISASM_ONLY_MEMBERS (ACPI_STRNCPY (Op->Common.AmlOpName,
- (AcpiPsGetOpcodeInfo (Opcode))->Name, sizeof (Op->Common.AmlOpName)));
+ (AcpiPsGetOpcodeInfo (Opcode))->Name,
+ sizeof (Op->Common.AmlOpName)));
}
@@ -191,7 +189,7 @@
*
* PARAMETERS: Opcode - Opcode that will be stored in the new Op
*
- * RETURN: Pointer to the new Op.
+ * RETURN: Pointer to the new Op, null on failure
*
* DESCRIPTION: Allocate an acpi_op, choose op type (and thus size) based on
* opcode. A cache of opcodes is available for the pure
@@ -234,13 +232,13 @@
{
/* The generic op (default) is by far the most common (16 to 1) */
- Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE);
+ Op = AcpiOsAcquireObject (AcpiGbl_PsNodeCache);
}
else
{
/* Extended parseop */
- Op = AcpiUtAcquireFromCache (ACPI_MEM_LIST_PSNODE_EXT);
+ Op = AcpiOsAcquireObject (AcpiGbl_PsNodeExtCache);
}
/* Initialize the Op */
@@ -272,7 +270,7 @@
AcpiPsFreeOp (
ACPI_PARSE_OBJECT *Op)
{
- ACPI_FUNCTION_NAME ("PsFreeOp");
+ ACPI_FUNCTION_NAME (PsFreeOp);
if (Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
@@ -282,42 +280,17 @@
if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
{
- AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE, Op);
+ (void) AcpiOsReleaseObject (AcpiGbl_PsNodeCache, Op);
}
else
{
- AcpiUtReleaseToCache (ACPI_MEM_LIST_PSNODE_EXT, Op);
+ (void) AcpiOsReleaseObject (AcpiGbl_PsNodeExtCache, Op);
}
}
/*******************************************************************************
*
- * FUNCTION: AcpiPsDeleteParseCache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Free all objects that are on the parse cache list.
- *
- ******************************************************************************/
-
-void
-AcpiPsDeleteParseCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("PsDeleteParseCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_PSNODE);
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_PSNODE_EXT);
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: Utility functions
*
* DESCRIPTION: Low level character and object functions
@@ -355,7 +328,6 @@
ACPI_PARSE_OBJECT *Op)
{
-
/* The "generic" object has no name associated with it */
if (Op->Common.Flags & ACPI_PARSEOP_GENERIC)
Index: nsalloc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsalloc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsalloc.c -L sys/contrib/dev/acpica/nsalloc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsalloc.c
+++ sys/contrib/dev/acpica/nsalloc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsalloc - Namespace allocation and deletion utilities
- * $Revision: 88 $
+ * $Revision: 1.108 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,9 +129,9 @@
*
* FUNCTION: AcpiNsCreateNode
*
- * PARAMETERS: AcpiName - Name of the new node
+ * PARAMETERS: Name - Name of the new node (4 char ACPI name)
*
- * RETURN: None
+ * RETURN: New namespace node (Null on failure)
*
* DESCRIPTION: Create a namespace node
*
@@ -142,23 +142,32 @@
UINT32 Name)
{
ACPI_NAMESPACE_NODE *Node;
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 Temp;
+#endif
- ACPI_FUNCTION_TRACE ("NsCreateNode");
+ ACPI_FUNCTION_TRACE (NsCreateNode);
- Node = ACPI_MEM_CALLOCATE (sizeof (ACPI_NAMESPACE_NODE));
+ Node = AcpiOsAcquireObject (AcpiGbl_NamespaceCache);
if (!Node)
{
return_PTR (NULL);
}
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalAllocated++);
+ ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalAllocated++);
- Node->Name.Integer = Name;
- Node->ReferenceCount = 1;
- ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ Temp = AcpiGbl_NsNodeList->TotalAllocated - AcpiGbl_NsNodeList->TotalFreed;
+ if (Temp > AcpiGbl_NsNodeList->MaxOccupied)
+ {
+ AcpiGbl_NsNodeList->MaxOccupied = Temp;
+ }
+#endif
+ Node->Name.Integer = Name;
+ ACPI_SET_DESCRIPTOR_TYPE (Node, ACPI_DESC_TYPE_NAMED);
return_PTR (Node);
}
@@ -184,7 +193,7 @@
ACPI_NAMESPACE_NODE *NextNode;
- ACPI_FUNCTION_TRACE_PTR ("NsDeleteNode", Node);
+ ACPI_FUNCTION_TRACE_PTR (NsDeleteNode, Node);
ParentNode = AcpiNsGetParentNode (Node);
@@ -227,72 +236,17 @@
}
}
-
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
+ ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
/*
- * Detach an object if there is one then delete the node
+ * Detach an object if there is one, then delete the node
*/
AcpiNsDetachObject (Node);
- ACPI_MEM_FREE (Node);
+ (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, Node);
return_VOID;
}
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsCompareNames
- *
- * PARAMETERS: Name1 - First name to compare
- * Name2 - Second name to compare
- *
- * RETURN: value from strncmp
- *
- * DESCRIPTION: Compare two ACPI names. Names that are prefixed with an
- * underscore are forced to be alphabetically first.
- *
- ******************************************************************************/
-
-int
-AcpiNsCompareNames (
- char *Name1,
- char *Name2)
-{
- char ReversedName1[ACPI_NAME_SIZE];
- char ReversedName2[ACPI_NAME_SIZE];
- UINT32 i;
- UINT32 j;
-
-
- /*
- * Replace all instances of "underscore" with a value that is smaller so
- * that all names that are prefixed with underscore(s) are alphabetically
- * first.
- *
- * Reverse the name bytewise so we can just do a 32-bit compare instead
- * of a strncmp.
- */
- for (i = 0, j= (ACPI_NAME_SIZE - 1); i < ACPI_NAME_SIZE; i++, j--)
- {
- ReversedName1[j] = Name1[i];
- if (Name1[i] == '_')
- {
- ReversedName1[j] = '*';
- }
-
- ReversedName2[j] = Name2[i];
- if (Name2[i] == '_')
- {
- ReversedName2[j] = '*';
- }
- }
-
- return (*(int *) ReversedName1 - *(int *) ReversedName2);
-}
-#endif
-
-
/*******************************************************************************
*
* FUNCTION: AcpiNsInstallNode
@@ -307,10 +261,9 @@
* DESCRIPTION: Initialize a new namespace node and install it amongst
* its peers.
*
- * Note: Current namespace lookup is linear search. However, the
- * nodes are linked in alphabetical order to 1) put all reserved
- * names (start with underscore) first, and to 2) make a readable
- * namespace dump.
+ * Note: Current namespace lookup is linear search. This appears
+ * to be sufficient as namespace searches consume only a small
+ * fraction of the execution time of the ACPI subsystem.
*
******************************************************************************/
@@ -321,15 +274,11 @@
ACPI_NAMESPACE_NODE *Node, /* New Child*/
ACPI_OBJECT_TYPE Type)
{
- UINT16 OwnerId = 0;
+ ACPI_OWNER_ID OwnerId = 0;
ACPI_NAMESPACE_NODE *ChildNode;
-#ifdef ACPI_ALPHABETIC_NAMESPACE
-
- ACPI_NAMESPACE_NODE *PreviousChildNode;
-#endif
- ACPI_FUNCTION_TRACE ("NsInstallNode");
+ ACPI_FUNCTION_TRACE (NsInstallNode);
/*
@@ -353,61 +302,6 @@
}
else
{
-#ifdef ACPI_ALPHABETIC_NAMESPACE
- /*
- * Walk the list whilst searching for the correct
- * alphabetic placement.
- */
- PreviousChildNode = NULL;
- while (AcpiNsCompareNames (AcpiUtGetNodeName (ChildNode), AcpiUtGetNodeName (Node)) < 0)
- {
- if (ChildNode->Flags & ANOBJ_END_OF_PEER_LIST)
- {
- /* Last peer; Clear end-of-list flag */
-
- ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST;
-
- /* This node is the new peer to the child node */
-
- ChildNode->Peer = Node;
-
- /* This node is the new end-of-list */
-
- Node->Flags |= ANOBJ_END_OF_PEER_LIST;
- Node->Peer = ParentNode;
- break;
- }
-
- /* Get next peer */
-
- PreviousChildNode = ChildNode;
- ChildNode = ChildNode->Peer;
- }
-
- /* Did the node get inserted at the end-of-list? */
-
- if (!(Node->Flags & ANOBJ_END_OF_PEER_LIST))
- {
- /*
- * Loop above terminated without reaching the end-of-list.
- * Insert the new node at the current location
- */
- if (PreviousChildNode)
- {
- /* Insert node alphabetically */
-
- Node->Peer = ChildNode;
- PreviousChildNode->Peer = Node;
- }
- else
- {
- /* Insert node alphabetically at start of list */
-
- Node->Peer = ChildNode;
- ParentNode->Child = Node;
- }
- }
-#else
while (!(ChildNode->Flags & ANOBJ_END_OF_PEER_LIST))
{
ChildNode = ChildNode->Peer;
@@ -418,9 +312,8 @@
/* Clear end-of-list flag */
ChildNode->Flags &= ~ANOBJ_END_OF_PEER_LIST;
- Node->Flags |= ANOBJ_END_OF_PEER_LIST;
+ Node->Flags |= ANOBJ_END_OF_PEER_LIST;
Node->Peer = ParentNode;
-#endif
}
/* Init the new entry */
@@ -434,15 +327,6 @@
AcpiUtGetNodeName (ParentNode), AcpiUtGetTypeName (ParentNode->Type),
ParentNode));
- /*
- * Increment the reference count(s) of all parents up to
- * the root!
- */
- while ((Node = AcpiNsGetParentNode (Node)) != NULL)
- {
- Node->ReferenceCount++;
- }
-
return_VOID;
}
@@ -466,11 +350,10 @@
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *NextNode;
- ACPI_NAMESPACE_NODE *Node;
UINT8 Flags;
- ACPI_FUNCTION_TRACE_PTR ("NsDeleteChildren", ParentNode);
+ ACPI_FUNCTION_TRACE_PTR (NsDeleteChildren, ParentNode);
if (!ParentNode)
@@ -493,20 +376,20 @@
{
/* Get the things we need */
- NextNode = ChildNode->Peer;
- Flags = ChildNode->Flags;
+ NextNode = ChildNode->Peer;
+ Flags = ChildNode->Flags;
/* Grandchildren should have all been deleted already */
if (ChildNode->Child)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Found a grandchild! P=%p C=%p\n",
+ ACPI_ERROR ((AE_INFO, "Found a grandchild! P=%p C=%p",
ParentNode, ChildNode));
}
/* Now we can free this child object */
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].TotalFreed++);
+ ACPI_MEM_TRACKING (AcpiGbl_NsNodeList->TotalFreed++);
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p, Remaining %X\n",
ChildNode, AcpiGbl_CurrentNodeCount));
@@ -516,27 +399,9 @@
*/
AcpiNsDetachObject (ChildNode);
- /*
- * Decrement the reference count(s) of all parents up to
- * the root! (counts were incremented when the node was created)
- */
- Node = ChildNode;
- while ((Node = AcpiNsGetParentNode (Node)) != NULL)
- {
- Node->ReferenceCount--;
- }
-
- /* There should be only one reference remaining on this node */
-
- if (ChildNode->ReferenceCount != 1)
- {
- ACPI_REPORT_WARNING (("Existing references (%d) on node being deleted (%p)\n",
- ChildNode->ReferenceCount, ChildNode));
- }
-
/* Now we can delete the node */
- ACPI_MEM_FREE (ChildNode);
+ (void) AcpiOsReleaseObject (AcpiGbl_NamespaceCache, ChildNode);
/* And move on to the next child in the list */
@@ -574,7 +439,7 @@
UINT32 Level = 1;
- ACPI_FUNCTION_TRACE ("NsDeleteNamespaceSubtree");
+ ACPI_FUNCTION_TRACE (NsDeleteNamespaceSubtree);
if (!ParentNode)
@@ -590,8 +455,7 @@
{
/* Get the next node in this scope (NULL if none) */
- ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode,
- ChildNode);
+ ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
if (ChildNode)
{
/* Found a child node - detach any attached object */
@@ -641,62 +505,6 @@
/*******************************************************************************
*
- * FUNCTION: AcpiNsRemoveReference
- *
- * PARAMETERS: Node - Named node whose reference count is to be
- * decremented
- *
- * RETURN: None.
- *
- * DESCRIPTION: Remove a Node reference. Decrements the reference count
- * of all parent Nodes up to the root. Any node along
- * the way that reaches zero references is freed.
- *
- ******************************************************************************/
-
-void
-AcpiNsRemoveReference (
- ACPI_NAMESPACE_NODE *Node)
-{
- ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_NAMESPACE_NODE *ThisNode;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /*
- * Decrement the reference count(s) of this node and all
- * nodes up to the root, Delete anything with zero remaining references.
- */
- ThisNode = Node;
- while (ThisNode)
- {
- /* Prepare to move up to parent */
-
- ParentNode = AcpiNsGetParentNode (ThisNode);
-
- /* Decrement the reference count on this node */
-
- ThisNode->ReferenceCount--;
-
- /* Delete the node if no more references */
-
- if (!ThisNode->ReferenceCount)
- {
- /* Delete all children and delete the node */
-
- AcpiNsDeleteChildren (ThisNode);
- AcpiNsDeleteNode (ThisNode);
- }
-
- ThisNode = ParentNode;
- }
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiNsDeleteNamespaceByOwner
*
* PARAMETERS: OwnerId - All nodes with this owner will be deleted
@@ -707,25 +515,41 @@
* specific ID. Used to delete entire ACPI tables. All
* reference counts are updated.
*
+ * MUTEX: Locks namespace during deletion walk.
+ *
******************************************************************************/
void
AcpiNsDeleteNamespaceByOwner (
- UINT16 OwnerId)
+ ACPI_OWNER_ID OwnerId)
{
ACPI_NAMESPACE_NODE *ChildNode;
ACPI_NAMESPACE_NODE *DeletionNode;
- UINT32 Level;
ACPI_NAMESPACE_NODE *ParentNode;
+ UINT32 Level;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_U32 ("NsDeleteNamespaceByOwner", OwnerId);
+ ACPI_FUNCTION_TRACE_U32 (NsDeleteNamespaceByOwner, OwnerId);
- ParentNode = AcpiGbl_RootNode;
- ChildNode = NULL;
- DeletionNode = NULL;
- Level = 1;
+ if (OwnerId == 0)
+ {
+ return_VOID;
+ }
+
+ /* Lock namespace for possible update */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+
+ DeletionNode = NULL;
+ ParentNode = AcpiGbl_RootNode;
+ ChildNode = NULL;
+ Level = 1;
/*
* Traverse the tree of nodes until we bubble back up
@@ -741,7 +565,8 @@
if (DeletionNode)
{
- AcpiNsRemoveReference (DeletionNode);
+ AcpiNsDeleteChildren (DeletionNode);
+ AcpiNsDeleteNode (DeletionNode);
DeletionNode = NULL;
}
@@ -796,6 +621,7 @@
}
}
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_VOID;
}
Index: nseval.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nseval.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nseval.c -L sys/contrib/dev/acpica/nseval.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nseval.c
+++ sys/contrib/dev/acpica/nseval.c
@@ -1,8 +1,7 @@
/*******************************************************************************
*
- * Module Name: nseval - Object evaluation interfaces -- includes control
- * method lookup and execution.
- * $Revision: 129 $
+ * Module Name: nseval - Object evaluation, includes control method execution
+ * $Revision: 1.144 $
*
******************************************************************************/
@@ -10,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,236 +129,40 @@
/*******************************************************************************
*
- * FUNCTION: AcpiNsEvaluateRelative
+ * FUNCTION: AcpiNsEvaluate
*
- * PARAMETERS: Pathname - Name of method to execute, If NULL, the
- * handle is the object to execute
- * Info - Method info block
- *
- * RETURN: Status
- *
- * DESCRIPTION: Find and execute the requested method using the handle as a
- * scope
- *
- * MUTEX: Locks Namespace
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsEvaluateRelative (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node = NULL;
- ACPI_GENERIC_STATE *ScopeInfo;
- char *InternalPath = NULL;
-
-
- ACPI_FUNCTION_TRACE ("NsEvaluateRelative");
-
-
- /*
- * Must have a valid object handle
- */
- if (!Info || !Info->Node)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Build an internal name string for the method */
-
- Status = AcpiNsInternalizeName (Pathname, &InternalPath);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- ScopeInfo = AcpiUtCreateGenericState ();
- if (!ScopeInfo)
- {
- goto Cleanup1;
- }
-
- /* Get the prefix handle and Node */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- Info->Node = AcpiNsMapHandleToNode (Info->Node);
- if (!Info->Node)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- Status = AE_BAD_PARAMETER;
- goto Cleanup;
- }
-
- /* Lookup the name in the namespace */
-
- ScopeInfo->Scope.Node = Info->Node;
- Status = AcpiNsLookup (ScopeInfo, InternalPath, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
- &Node);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Object [%s] not found [%s]\n",
- Pathname, AcpiFormatException (Status)));
- goto Cleanup;
- }
-
- /*
- * Now that we have a handle to the object, we can attempt to evaluate it.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
- Pathname, Node, AcpiNsGetAttachedObject (Node)));
-
- Info->Node = Node;
- Status = AcpiNsEvaluateByHandle (Info);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
- Pathname));
-
-Cleanup:
- AcpiUtDeleteGenericState (ScopeInfo);
-
-Cleanup1:
- ACPI_MEM_FREE (InternalPath);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsEvaluateByName
- *
- * PARAMETERS: Pathname - Fully qualified pathname to the object
- * Info - Contains:
- * ReturnObject - Where to put method's return value (if
- * any). If NULL, no value is returned.
- * Params - List of parameters to pass to the method,
- * terminated by NULL. Params itself may be
- * NULL if no parameters are being passed.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Find and execute the requested method passing the given
- * parameters
- *
- * MUTEX: Locks Namespace
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsEvaluateByName (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status;
- char *InternalPath = NULL;
-
-
- ACPI_FUNCTION_TRACE ("NsEvaluateByName");
-
-
- /* Build an internal name string for the method */
-
- Status = AcpiNsInternalizeName (Pathname, &InternalPath);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- /* Lookup the name in the namespace */
-
- Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, NULL,
- &Info->Node);
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Object at [%s] was not found, status=%.4X\n",
- Pathname, Status));
- goto Cleanup;
- }
-
- /*
- * Now that we have a handle to the object, we can attempt to evaluate it.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n",
- Pathname, Info->Node, AcpiNsGetAttachedObject (Info->Node)));
-
- Status = AcpiNsEvaluateByHandle (Info);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "*** Completed eval of object %s ***\n",
- Pathname));
-
-
-Cleanup:
-
- /* Cleanup */
-
- if (InternalPath)
- {
- ACPI_MEM_FREE (InternalPath);
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsEvaluateByHandle
- *
- * PARAMETERS: Handle - Method Node to execute
- * Params - List of parameters to pass to the method,
- * terminated by NULL. Params itself may be
+ * PARAMETERS: Info - Evaluation info block, contains:
+ * PrefixNode - Prefix or Method/Object Node to execute
+ * Pathname - Name of method to execute, If NULL, the
+ * Node is the object to execute
+ * Parameters - List of parameters to pass to the method,
+ * terminated by NULL. Params itself may be
* NULL if no parameters are being passed.
- * ParamType - Type of Parameter list
- * ReturnObject - Where to put method's return value (if
- * any). If NULL, no value is returned.
+ * ReturnObject - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * ParameterType - Type of Parameter list
+ * ReturnObject - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * Flags - ACPI_IGNORE_RETURN_VALUE to delete return
*
* RETURN: Status
*
- * DESCRIPTION: Execute the requested method passing the given parameters
+ * DESCRIPTION: Execute a control method or return the current value of an
+ * ACPI namespace object.
*
- * MUTEX: Locks Namespace
+ * MUTEX: Locks interpreter
*
******************************************************************************/
ACPI_STATUS
-AcpiNsEvaluateByHandle (
- ACPI_PARAMETER_INFO *Info)
+AcpiNsEvaluate (
+ ACPI_EVALUATE_INFO *Info)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsEvaluateByHandle");
-
-
- /* Check if namespace has been initialized */
-
- if (!AcpiGbl_RootNode)
- {
- return_ACPI_STATUS (AE_NO_NAMESPACE);
- }
+ ACPI_FUNCTION_TRACE (NsEvaluate);
- /* Parameter Validation */
if (!Info)
{
@@ -370,217 +173,144 @@
Info->ReturnObject = NULL;
- /* Get the prefix handle and Node */
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ /*
+ * Get the actual namespace node for the target object. Handles these cases:
+ *
+ * 1) Null node, Pathname (absolute path)
+ * 2) Node, Pathname (path relative to Node)
+ * 3) Node, Null Pathname
+ */
+ Status = AcpiNsGetNode (Info->PrefixNode, Info->Pathname,
+ ACPI_NS_NO_UPSEARCH, &Info->ResolvedNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Info->Node = AcpiNsMapHandleToNode (Info->Node);
- if (!Info->Node)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
/*
* For a method alias, we must grab the actual method node so that proper
* scoping context will be established before execution.
*/
- if (AcpiNsGetType (Info->Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
+ if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
{
- Info->Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->Node->Object);
+ Info->ResolvedNode =
+ ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Info->ResolvedNode->Object);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "%s [%p] Value %p\n", Info->Pathname,
+ Info->ResolvedNode, AcpiNsGetAttachedObject (Info->ResolvedNode)));
+
/*
* Two major cases here:
- * 1) The object is an actual control method -- execute it.
- * 2) The object is not a method -- just return it's current value
*
- * In both cases, the namespace is unlocked by the AcpiNs* procedure
+ * 1) The object is a control method -- execute it
+ * 2) The object is not a method -- just return it's current value
*/
- if (AcpiNsGetType (Info->Node) == ACPI_TYPE_METHOD)
- {
- /*
- * Case 1) We have an actual control method to execute
- */
- Status = AcpiNsExecuteControlMethod (Info);
- }
- else
+ if (AcpiNsGetType (Info->ResolvedNode) == ACPI_TYPE_METHOD)
{
/*
- * Case 2) Object is NOT a method, just return its current value
+ * 1) Object is a control method - execute it
*/
- Status = AcpiNsGetObjectValue (Info);
- }
- /*
- * Check if there is a return value on the stack that must be dealt with
- */
- if (Status == AE_CTRL_RETURN_VALUE)
- {
- /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
+ /* Verify that there is a method object associated with this node */
- Status = AE_OK;
- }
-
- /*
- * Namespace was unlocked by the handling AcpiNs* function, so we
- * just return
- */
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsExecuteControlMethod
- *
- * PARAMETERS: Info - Method info block (w/params)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Execute the requested method passing the given parameters
- *
- * MUTEX: Assumes namespace is locked
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsExecuteControlMethod (
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
-
-
- ACPI_FUNCTION_TRACE ("NsExecuteControlMethod");
-
-
- /* Verify that there is a method associated with this object */
-
- ObjDesc = AcpiNsGetAttachedObject (Info->Node);
- if (!ObjDesc)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No attached method object\n"));
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
+ Info->ObjDesc = AcpiNsGetAttachedObject (Info->ResolvedNode);
+ if (!Info->ObjDesc)
+ {
+ ACPI_ERROR ((AE_INFO, "Control method has no attached sub-object"));
+ return_ACPI_STATUS (AE_NULL_OBJECT);
+ }
- ACPI_DUMP_PATHNAME (Info->Node, "Execute Method:",
- ACPI_LV_INFO, _COMPONENT);
+ ACPI_DUMP_PATHNAME (Info->ResolvedNode, "Execute Method:",
+ ACPI_LV_INFO, _COMPONENT);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Method at AML address %p Length %X\n",
- ObjDesc->Method.AmlStart + 1, ObjDesc->Method.AmlLength - 1));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Method at AML address %p Length %X\n",
+ Info->ObjDesc->Method.AmlStart + 1,
+ Info->ObjDesc->Method.AmlLength - 1));
- /*
- * Unlock the namespace before execution. This allows namespace access
- * via the external Acpi* interfaces while a method is being executed.
- * However, any namespace deletion must acquire both the namespace and
- * interpreter locks to ensure that no thread is using the portion of the
- * namespace that is being deleted.
- */
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
+ /*
+ * Any namespace deletion must acquire both the namespace and
+ * interpreter locks to ensure that no thread is using the portion of
+ * the namespace that is being deleted.
+ *
+ * Execute the method via the interpreter. The interpreter is locked
+ * here before calling into the AML parser
+ */
+ AcpiExEnterInterpreter ();
+ Status = AcpiPsExecuteMethod (Info);
+ AcpiExExitInterpreter ();
}
-
- /*
- * Execute the method via the interpreter. The interpreter is locked
- * here before calling into the AML parser
- */
- Status = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status))
+ else
{
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiPsxExecute (Info);
- AcpiExExitInterpreter ();
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsGetObjectValue
- *
- * PARAMETERS: Info - Method info block (w/params)
- *
- * RETURN: Status
- *
- * DESCRIPTION: Return the current value of the object
- *
- * MUTEX: Assumes namespace is locked, leaves namespace unlocked
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsGetObjectValue (
- ACPI_PARAMETER_INFO *Info)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_NAMESPACE_NODE *ResolvedNode = Info->Node;
-
-
- ACPI_FUNCTION_TRACE ("NsGetObjectValue");
+ /*
+ * 2) Object is not a method, return its current value
+ */
+ /*
+ * Objects require additional resolution steps (e.g., the Node may be
+ * a field that must be read, etc.) -- we can't just grab the object
+ * out of the node.
+ *
+ * Use ResolveNodeToValue() to get the associated value.
+ *
+ * NOTE: we can get away with passing in NULL for a walk state because
+ * ResolvedNode is guaranteed to not be a reference to either a method
+ * local or a method argument (because this interface is never called
+ * from a running method.)
+ *
+ * Even though we do not directly invoke the interpreter for object
+ * resolution, we must lock it because we could access an opregion.
+ * The opregion access code assumes that the interpreter is locked.
+ */
+ AcpiExEnterInterpreter ();
- /*
- * Objects require additional resolution steps (e.g., the Node may be a
- * field that must be read, etc.) -- we can't just grab the object out of
- * the node.
- */
+ /* Function has a strange interface */
- /*
- * Use ResolveNodeToValue() to get the associated value. This call always
- * deletes ObjDesc (allocated above).
- *
- * NOTE: we can get away with passing in NULL for a walk state because
- * ObjDesc is guaranteed to not be a reference to either a method local or
- * a method argument (because this interface can only be called from the
- * AcpiEvaluate external interface, never called from a running method.)
- *
- * Even though we do not directly invoke the interpreter for this, we must
- * enter it because we could access an opregion. The opregion access code
- * assumes that the interpreter is locked.
- *
- * We must release the namespace lock before entering the intepreter.
- */
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ Status = AcpiExResolveNodeToValue (&Info->ResolvedNode, NULL);
+ AcpiExExitInterpreter ();
- Status = AcpiExEnterInterpreter ();
- if (ACPI_SUCCESS (Status))
- {
- Status = AcpiExResolveNodeToValue (&ResolvedNode, NULL);
/*
* If AcpiExResolveNodeToValue() succeeded, the return value was placed
* in ResolvedNode.
*/
- AcpiExExitInterpreter ();
-
if (ACPI_SUCCESS (Status))
{
Status = AE_CTRL_RETURN_VALUE;
- Info->ReturnObject = ACPI_CAST_PTR
- (ACPI_OPERAND_OBJECT, ResolvedNode);
+ Info->ReturnObject =
+ ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Info->ResolvedNode);
+
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "Returning object %p [%s]\n",
Info->ReturnObject,
AcpiUtGetObjectTypeName (Info->ReturnObject)));
}
}
- /* Namespace is unlocked */
+ /*
+ * Check if there is a return value that must be dealt with
+ */
+ if (Status == AE_CTRL_RETURN_VALUE)
+ {
+ /* If caller does not want the return value, delete it */
+
+ if (Info->Flags & ACPI_IGNORE_RETURN_VALUE)
+ {
+ AcpiUtRemoveReference (Info->ReturnObject);
+ Info->ReturnObject = NULL;
+ }
+
+ /* Map AE_CTRL_RETURN_VALUE to AE_OK, we are done with it */
+
+ Status = AE_OK;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
+ "*** Completed evaluation of object %s ***\n", Info->Pathname));
+ /*
+ * Namespace was unlocked by the handling AcpiNs* function, so we
+ * just return
+ */
return_ACPI_STATUS (Status);
}
Index: exstore.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exstore.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exstore.c -L sys/contrib/dev/acpica/exstore.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exstore.c
+++ sys/contrib/dev/acpica/exstore.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstore - AML Interpreter object store support
- * $Revision: 186 $
+ * $Revision: 1.203 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,11 +122,187 @@
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/amlcode.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acparser.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exstore")
+/* Local prototypes */
+
+static void
+AcpiExDoDebugObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ UINT32 Level,
+ UINT32 Index);
+
+static ACPI_STATUS
+AcpiExStoreObjectToIndex (
+ ACPI_OPERAND_OBJECT *ValDesc,
+ ACPI_OPERAND_OBJECT *DestDesc,
+ ACPI_WALK_STATE *WalkState);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDoDebugObject
+ *
+ * PARAMETERS: SourceDesc - Value to be stored
+ * Level - Indentation level (used for packages)
+ * Index - Current package element, zero if not pkg
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Handles stores to the Debug Object.
+ *
+ ******************************************************************************/
+
+static void
+AcpiExDoDebugObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ UINT32 Level,
+ UINT32 Index)
+{
+ UINT32 i;
+
+
+ ACPI_FUNCTION_TRACE_PTR (ExDoDebugObject, SourceDesc);
+
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %*s",
+ Level, " "));
+
+ /* Display index for package output only */
+
+ if (Index > 0)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
+ "(%.2u) ", Index -1));
+ }
+
+ if (!SourceDesc)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "<Null Object>\n"));
+ return_VOID;
+ }
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_OPERAND)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: ",
+ AcpiUtGetObjectTypeName (SourceDesc)));
+
+ if (!AcpiUtValidInternalObject (SourceDesc))
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
+ "%p, Invalid Internal Object!\n", SourceDesc));
+ return_VOID;
+ }
+ }
+ else if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc) == ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%s: %p\n",
+ AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) SourceDesc)->Type),
+ SourceDesc));
+ return_VOID;
+ }
+ else
+ {
+ return_VOID;
+ }
+
+ switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+
+ /* Output correct integer width */
+
+ if (AcpiGbl_IntegerByteWidth == 4)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
+ (UINT32) SourceDesc->Integer.Value));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value)));
+ }
+ break;
+
+ case ACPI_TYPE_BUFFER:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]\n",
+ (UINT32) SourceDesc->Buffer.Length));
+ ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
+ (SourceDesc->Buffer.Length < 256) ? SourceDesc->Buffer.Length : 256);
+ break;
+
+ case ACPI_TYPE_STRING:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
+ SourceDesc->String.Length, SourceDesc->String.Pointer));
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X Elements]\n",
+ SourceDesc->Package.Count));
+
+ /* Output the entire contents of the package */
+
+ for (i = 0; i < SourceDesc->Package.Count; i++)
+ {
+ AcpiExDoDebugObject (SourceDesc->Package.Elements[i],
+ Level+4, i+1);
+ }
+ break;
+
+ case ACPI_TYPE_LOCAL_REFERENCE:
+
+ if (SourceDesc->Reference.Opcode == AML_INDEX_OP)
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s, 0x%X]\n",
+ AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode),
+ SourceDesc->Reference.Offset));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[%s]\n",
+ AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode)));
+ }
+
+
+ if (SourceDesc->Reference.Object)
+ {
+ if (ACPI_GET_DESCRIPTOR_TYPE (SourceDesc->Reference.Object) ==
+ ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiExDoDebugObject (((ACPI_NAMESPACE_NODE *)
+ SourceDesc->Reference.Object)->Object,
+ Level+4, 0);
+ }
+ else
+ {
+ AcpiExDoDebugObject (SourceDesc->Reference.Object, Level+4, 0);
+ }
+ }
+ else if (SourceDesc->Reference.Node)
+ {
+ AcpiExDoDebugObject ((SourceDesc->Reference.Node)->Object,
+ Level+4, 0);
+ }
+ break;
+
+ default:
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p %s\n",
+ SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
+ break;
+ }
+
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
+ return_VOID;
+}
+
/*******************************************************************************
*
@@ -158,14 +334,14 @@
ACPI_OPERAND_OBJECT *RefDesc = DestDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExStore", DestDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStore, DestDesc);
/* Validate parameters */
if (!SourceDesc || !DestDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null parameter\n"));
+ ACPI_ERROR ((AE_INFO, "Null parameter"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
@@ -206,8 +382,8 @@
/* Destination is not a Reference object */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Target is not a Reference or Constant object - %s [%p]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Target is not a Reference or Constant object - %s [%p]",
AcpiUtGetObjectTypeName (DestDesc), DestDesc));
ACPI_DUMP_STACK_ENTRY (SourceDesc);
@@ -228,13 +404,13 @@
*/
switch (RefDesc->Reference.Opcode)
{
- case AML_NAME_OP:
case AML_REF_OF_OP:
/* Storing an object into a Name "container" */
- Status = AcpiExStoreObjectToNode (SourceDesc, RefDesc->Reference.Object,
- WalkState, ACPI_IMPLICIT_CONVERSION);
+ Status = AcpiExStoreObjectToNode (SourceDesc,
+ RefDesc->Reference.Object,
+ WalkState, ACPI_IMPLICIT_CONVERSION);
break;
@@ -252,7 +428,7 @@
/* Store to a method local/arg */
Status = AcpiDsStoreObjectToLocal (RefDesc->Reference.Opcode,
- RefDesc->Reference.Offset, SourceDesc, WalkState);
+ RefDesc->Reference.Offset, SourceDesc, WalkState);
break;
@@ -266,70 +442,13 @@
"**** Write to Debug Object: Object %p %s ****:\n\n",
SourceDesc, AcpiUtGetObjectTypeName (SourceDesc)));
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[ACPI Debug] %s: ",
- AcpiUtGetObjectTypeName (SourceDesc)));
-
- if (!AcpiUtValidInternalObject (SourceDesc))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT,
- "%p, Invalid Internal Object!\n", SourceDesc));
- break;
- }
-
- switch (ACPI_GET_OBJECT_TYPE (SourceDesc))
- {
- case ACPI_TYPE_INTEGER:
-
- if (AcpiGbl_IntegerByteWidth == 4)
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X\n",
- (UINT32) SourceDesc->Integer.Value));
- }
- else
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "0x%8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (SourceDesc->Integer.Value)));
- }
- break;
-
-
- case ACPI_TYPE_BUFFER:
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X]",
- (UINT32) SourceDesc->Buffer.Length));
- ACPI_DUMP_BUFFER (SourceDesc->Buffer.Pointer,
- (SourceDesc->Buffer.Length < 32) ? SourceDesc->Buffer.Length : 32);
- break;
-
-
- case ACPI_TYPE_STRING:
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] \"%s\"\n",
- SourceDesc->String.Length, SourceDesc->String.Pointer));
- break;
-
-
- case ACPI_TYPE_PACKAGE:
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "[0x%.2X] Elements Ptr - %p\n",
- SourceDesc->Package.Count, SourceDesc->Package.Elements));
- break;
-
-
- default:
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_DEBUG_OBJECT, "%p\n",
- SourceDesc));
- break;
- }
-
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_EXEC, "\n"));
+ AcpiExDoDebugObject (SourceDesc, 0, 0);
break;
default:
- ACPI_REPORT_ERROR (("ExStore: Unknown Reference opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
RefDesc->Reference.Opcode));
ACPI_DUMP_ENTRY (RefDesc, ACPI_LV_ERROR);
@@ -355,7 +474,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExStoreObjectToIndex (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *IndexDesc,
@@ -368,7 +487,7 @@
UINT32 i;
- ACPI_FUNCTION_TRACE ("ExStoreObjectToIndex");
+ ACPI_FUNCTION_TRACE (ExStoreObjectToIndex);
/*
@@ -399,21 +518,27 @@
{
/* Decrement reference count by the ref count of the parent package */
- for (i = 0; i < ((ACPI_OPERAND_OBJECT *) IndexDesc->Reference.Object)->Common.ReferenceCount; i++)
+ for (i = 0;
+ i < ((ACPI_OPERAND_OBJECT *)
+ IndexDesc->Reference.Object)->Common.ReferenceCount;
+ i++)
{
AcpiUtRemoveReference (ObjDesc);
}
}
-
+
*(IndexDesc->Reference.Where) = NewDesc;
- /* Increment reference count by the ref count of the parent package -1 */
+ /* Increment ref count by the ref count of the parent package-1 */
- for (i = 1; i < ((ACPI_OPERAND_OBJECT *) IndexDesc->Reference.Object)->Common.ReferenceCount; i++)
+ for (i = 1;
+ i < ((ACPI_OPERAND_OBJECT *)
+ IndexDesc->Reference.Object)->Common.ReferenceCount;
+ i++)
{
AcpiUtAddReference (NewDesc);
}
-
+
break;
@@ -465,8 +590,8 @@
/* All other types are invalid */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Source must be Integer/Buffer/String type, not %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Source must be Integer/Buffer/String type, not %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -478,8 +603,8 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Target is not a Package or BufferField\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Target is not a Package or BufferField"));
Status = AE_AML_OPERAND_TYPE;
break;
}
@@ -527,12 +652,11 @@
ACPI_OBJECT_TYPE TargetType;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToNode", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToNode, SourceDesc);
- /*
- * Get current type of the node, and object attached to Node
- */
+ /* Get current type of the node, and object attached to Node */
+
TargetType = AcpiNsGetType (Node);
TargetDesc = AcpiNsGetAttachedObject (Node);
@@ -552,16 +676,15 @@
/* If no implicit conversion, drop into the default case below */
- if (!ImplicitConversion)
+ if ((!ImplicitConversion) || (WalkState->Opcode == AML_COPY_OP))
{
/* Force execution of default (no implicit conversion) */
TargetType = ACPI_TYPE_ANY;
}
- /*
- * Do the actual store operation
- */
+ /* Do the actual store operation */
+
switch (TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
@@ -569,10 +692,10 @@
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- /*
- * For fields, copy the source data to the target field.
- */
- Status = AcpiExWriteDataToField (SourceDesc, TargetDesc, &WalkState->ResultObj);
+ /* For fields, copy the source data to the target field. */
+
+ Status = AcpiExWriteDataToField (SourceDesc, TargetDesc,
+ &WalkState->ResultObj);
break;
@@ -586,7 +709,8 @@
*
* Copy and/or convert the source object to a new target object
*/
- Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc, &NewDesc, WalkState);
+ Status = AcpiExStoreObjectToObject (SourceDesc, TargetDesc,
+ &NewDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -616,12 +740,13 @@
default:
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Storing %s (%p) directly into node (%p), no implicit conversion\n",
+ "Storing %s (%p) directly into node (%p) with no implicit conversion\n",
AcpiUtGetObjectTypeName (SourceDesc), SourceDesc, Node));
/* No conversions for all other types. Just attach the source object */
- Status = AcpiNsAttachObject (Node, SourceDesc, ACPI_GET_OBJECT_TYPE (SourceDesc));
+ Status = AcpiNsAttachObject (Node, SourceDesc,
+ ACPI_GET_OBJECT_TYPE (SourceDesc));
break;
}
Index: acfreebsd.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acfreebsd.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acfreebsd.h -L sys/contrib/dev/acpica/acfreebsd.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acfreebsd.h
+++ sys/contrib/dev/acpica/acfreebsd.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acfreebsd.h - OS specific defines, etc.
- * $Revision: 17 $
+ * $Revision: 1.25 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,11 @@
#include <sys/types.h>
#include <machine/acpica_machdep.h>
+#define ACPI_THREAD_ID pid_t
+#define ACPI_UINTPTR_T uintptr_t
+#define ACPI_USE_LOCAL_CACHE
+#define __cdecl
+
#ifdef _KERNEL
#include "opt_acpi.h"
#endif
@@ -143,7 +148,9 @@
#ifdef DEBUGGER_THREADING
#undef DEBUGGER_THREADING
#endif /* DEBUGGER_THREADING */
+
#define DEBUGGER_THREADING 0 /* integrated with DDB */
+
#ifdef ACPI_DEBUG_OUTPUT
#include "opt_ddb.h"
#ifdef DDB
@@ -169,37 +176,25 @@
/* Always use FreeBSD code over our local versions */
#define ACPI_USE_SYSTEM_CLIBRARY
-/* FreeBSD doesn't have strupr, should be fixed. (move to libkern) */
-static __inline char *
-strupr(char *str)
-{
- char *c = str;
- while(*c) {
- *c = toupper(*c);
- c++;
- }
- return(str);
-}
-
-#ifdef _KERNEL
+#if defined(_KERNEL) && (__FreeBSD_version < 700020)
/* Or strstr (used in debugging mode, also move to libkern) */
static __inline char *
-strstr(char *s, char *find)
+strstr (char *s, char *find)
{
char c, sc;
size_t len;
if ((c = *find++) != 0) {
- len = strlen(find);
- do {
+ len = strlen (find);
do {
- if ((sc = *s++) == 0)
- return (NULL);
- } while (sc != c);
- } while (strncmp(s, find, len) != 0);
- s--;
+ do {
+ if ((sc = *s++) == 0)
+ return (NULL);
+ } while (sc != c);
+ } while (strncmp (s, find, len) != 0);
+ s--;
}
- return ((char *)s);
+ return ((char *) s);
}
#endif /* _KERNEL */
Index: rsdump.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsdump.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsdump.c -L sys/contrib/dev/acpica/rsdump.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsdump.c
+++ sys/contrib/dev/acpica/rsdump.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsdump - Functions to display the resource structures.
- * $Revision: 38 $
+ * $Revision: 1.62 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,1123 +126,744 @@
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsDumpIrq
- *
- * PARAMETERS: Data - pointer to the resource structure to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Prints out the various members of the Data structure type.
- *
- ******************************************************************************/
+/* Local prototypes */
-void
-AcpiRsDumpIrq (
- ACPI_RESOURCE_DATA *Data)
-{
- ACPI_RESOURCE_IRQ *IrqData = (ACPI_RESOURCE_IRQ *) Data;
- UINT8 Index = 0;
+static void
+AcpiRsOutString (
+ char *Title,
+ char *Value);
+static void
+AcpiRsOutInteger8 (
+ char *Title,
+ UINT8 Value);
- ACPI_FUNCTION_ENTRY ();
+static void
+AcpiRsOutInteger16 (
+ char *Title,
+ UINT16 Value);
+static void
+AcpiRsOutInteger32 (
+ char *Title,
+ UINT32 Value);
- AcpiOsPrintf ("IRQ Resource\n");
+static void
+AcpiRsOutInteger64 (
+ char *Title,
+ UINT64 Value);
- AcpiOsPrintf (" %s Triggered\n",
- ACPI_LEVEL_SENSITIVE == IrqData->EdgeLevel ? "Level" : "Edge");
+static void
+AcpiRsOutTitle (
+ char *Title);
- AcpiOsPrintf (" Active %s\n",
- ACPI_ACTIVE_LOW == IrqData->ActiveHighLow ? "Low" : "High");
+static void
+AcpiRsDumpByteList (
+ UINT16 Length,
+ UINT8 *Data);
- AcpiOsPrintf (" %s\n",
- ACPI_SHARED == IrqData->SharedExclusive ? "Shared" : "Exclusive");
-
- AcpiOsPrintf (" %X Interrupts ( ", IrqData->NumberOfInterrupts);
-
- for (Index = 0; Index < IrqData->NumberOfInterrupts; Index++)
- {
- AcpiOsPrintf ("%X ", IrqData->Interrupts[Index]);
- }
-
- AcpiOsPrintf (")\n");
- return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsDumpDma
- *
- * PARAMETERS: Data - pointer to the resource structure to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Prints out the various members of the Data structure type.
- *
- ******************************************************************************/
-
-void
-AcpiRsDumpDma (
- ACPI_RESOURCE_DATA *Data)
-{
- ACPI_RESOURCE_DMA *DmaData = (ACPI_RESOURCE_DMA *) Data;
- UINT8 Index = 0;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- AcpiOsPrintf ("DMA Resource\n");
-
- switch (DmaData->Type)
- {
- case ACPI_COMPATIBILITY:
- AcpiOsPrintf (" Compatibility mode\n");
- break;
-
- case ACPI_TYPE_A:
- AcpiOsPrintf (" Type A\n");
- break;
-
- case ACPI_TYPE_B:
- AcpiOsPrintf (" Type B\n");
- break;
-
- case ACPI_TYPE_F:
- AcpiOsPrintf (" Type F\n");
- break;
-
- default:
- AcpiOsPrintf (" Invalid DMA type\n");
- break;
- }
-
- AcpiOsPrintf (" %sBus Master\n",
- ACPI_BUS_MASTER == DmaData->BusMaster ? "" : "Not a ");
-
-
- switch (DmaData->Transfer)
- {
- case ACPI_TRANSFER_8:
- AcpiOsPrintf (" 8-bit only transfer\n");
- break;
+static void
+AcpiRsDumpDwordList (
+ UINT8 Length,
+ UINT32 *Data);
- case ACPI_TRANSFER_8_16:
- AcpiOsPrintf (" 8 and 16-bit transfer\n");
- break;
+static void
+AcpiRsDumpShortByteList (
+ UINT8 Length,
+ UINT8 *Data);
- case ACPI_TRANSFER_16:
- AcpiOsPrintf (" 16 bit only transfer\n");
- break;
+static void
+AcpiRsDumpResourceSource (
+ ACPI_RESOURCE_SOURCE *ResourceSource);
- default:
- AcpiOsPrintf (" Invalid transfer preference\n");
- break;
- }
+static void
+AcpiRsDumpAddressCommon (
+ ACPI_RESOURCE_DATA *Resource);
- AcpiOsPrintf (" Number of Channels: %X ( ", DmaData->NumberOfChannels);
+static void
+AcpiRsDumpDescriptor (
+ void *Resource,
+ ACPI_RSDUMP_INFO *Table);
- for (Index = 0; Index < DmaData->NumberOfChannels; Index++)
- {
- AcpiOsPrintf ("%X ", DmaData->Channels[Index]);
- }
- AcpiOsPrintf (")\n");
- return;
-}
+#define ACPI_RSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE_DATA,f)
+#define ACPI_PRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_PCI_ROUTING_TABLE,f)
+#define ACPI_RSD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_RSDUMP_INFO))
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpStartDependFns
- *
- * PARAMETERS: Data - pointer to the resource structure to dump.
- *
- * RETURN: None
+ * Resource Descriptor info tables
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * Note: The first table entry must be a Title or Literal and must contain
+ * the table length (number of table entries)
*
******************************************************************************/
-void
-AcpiRsDumpStartDependFns (
- ACPI_RESOURCE_DATA *Data)
+ACPI_RSDUMP_INFO AcpiRsDumpIrq[6] =
{
- ACPI_RESOURCE_START_DPF *SdfData = (ACPI_RESOURCE_START_DPF *) Data;
-
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIrq), "IRQ", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Triggering), "Triggering", AcpiGbl_HeDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Polarity), "Polarity", AcpiGbl_LlDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Irq.Sharable), "Sharing", AcpiGbl_ShrDecode},
+ {ACPI_RSD_UINT8 , ACPI_RSD_OFFSET (Irq.InterruptCount), "Interrupt Count", NULL},
+ {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Irq.Interrupts[0]), "Interrupt List", NULL}
+};
- ACPI_FUNCTION_ENTRY ();
-
-
- AcpiOsPrintf ("Start Dependent Functions Resource\n");
-
- switch (SdfData->CompatibilityPriority)
- {
- case ACPI_GOOD_CONFIGURATION:
- AcpiOsPrintf (" Good configuration\n");
- break;
-
- case ACPI_ACCEPTABLE_CONFIGURATION:
- AcpiOsPrintf (" Acceptable configuration\n");
- break;
-
- case ACPI_SUB_OPTIMAL_CONFIGURATION:
- AcpiOsPrintf (" Sub-optimal configuration\n");
- break;
-
- default:
- AcpiOsPrintf (" Invalid compatibility priority\n");
- break;
- }
-
- switch(SdfData->PerformanceRobustness)
- {
- case ACPI_GOOD_CONFIGURATION:
- AcpiOsPrintf (" Good configuration\n");
- break;
-
- case ACPI_ACCEPTABLE_CONFIGURATION:
- AcpiOsPrintf (" Acceptable configuration\n");
- break;
-
- case ACPI_SUB_OPTIMAL_CONFIGURATION:
- AcpiOsPrintf (" Sub-optimal configuration\n");
- break;
-
- default:
- AcpiOsPrintf (" Invalid performance "
- "robustness preference\n");
- break;
- }
-
- return;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsDumpIo
- *
- * PARAMETERS: Data - pointer to the resource structure to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Prints out the various members of the Data structure type.
- *
- ******************************************************************************/
-
-void
-AcpiRsDumpIo (
- ACPI_RESOURCE_DATA *Data)
+ACPI_RSDUMP_INFO AcpiRsDumpDma[6] =
{
- ACPI_RESOURCE_IO *IoData = (ACPI_RESOURCE_IO *) Data;
-
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpDma), "DMA", NULL},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Type), "Speed", AcpiGbl_TypDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Dma.BusMaster), "Mastering", AcpiGbl_BmDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Dma.Transfer), "Transfer Type", AcpiGbl_SizDecode},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Dma.ChannelCount), "Channel Count", NULL},
+ {ACPI_RSD_SHORTLIST,ACPI_RSD_OFFSET (Dma.Channels[0]), "Channel List", NULL}
+};
- ACPI_FUNCTION_ENTRY ();
-
-
- AcpiOsPrintf ("Io Resource\n");
-
- AcpiOsPrintf (" %d bit decode\n",
- ACPI_DECODE_16 == IoData->IoDecode ? 16 : 10);
-
- AcpiOsPrintf (" Range minimum base: %08X\n",
- IoData->MinBaseAddress);
-
- AcpiOsPrintf (" Range maximum base: %08X\n",
- IoData->MaxBaseAddress);
-
- AcpiOsPrintf (" Alignment: %08X\n",
- IoData->Alignment);
-
- AcpiOsPrintf (" Range Length: %08X\n",
- IoData->RangeLength);
+ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[3] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpStartDpf), "Start-Dependent-Functions",NULL},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.CompatibilityPriority), "Compatibility Priority", AcpiGbl_ConfigDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (StartDpf.PerformanceRobustness), "Performance/Robustness", AcpiGbl_ConfigDecode}
+};
- return;
-}
+ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[1] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndDpf), "End-Dependent-Functions", NULL}
+};
+ACPI_RSDUMP_INFO AcpiRsDumpIo[6] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIo), "I/O", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Io.IoDecode), "Address Decoding", AcpiGbl_IoDecode},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Io.Maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.Alignment), "Alignment", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (Io.AddressLength), "Address Length", NULL}
+};
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsDumpFixedIo
- *
- * PARAMETERS: Data - pointer to the resource structure to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Prints out the various members of the Data structure type.
- *
- ******************************************************************************/
+ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[3] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedIo), "Fixed I/O", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (FixedIo.Address), "Address", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (FixedIo.AddressLength), "Address Length", NULL}
+};
-void
-AcpiRsDumpFixedIo (
- ACPI_RESOURCE_DATA *Data)
+ACPI_RSDUMP_INFO AcpiRsDumpVendor[3] =
{
- ACPI_RESOURCE_FIXED_IO *FixedIoData = (ACPI_RESOURCE_FIXED_IO *) Data;
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpVendor), "Vendor Specific", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Vendor.ByteLength), "Length", NULL},
+ {ACPI_RSD_LONGLIST, ACPI_RSD_OFFSET (Vendor.ByteData[0]), "Vendor Data", NULL}
+};
+ACPI_RSDUMP_INFO AcpiRsDumpEndTag[1] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpEndTag), "EndTag", NULL}
+};
- ACPI_FUNCTION_ENTRY ();
+ACPI_RSDUMP_INFO AcpiRsDumpMemory24[6] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory24), "24-Bit Memory Range", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory24.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.Alignment), "Alignment", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Memory24.AddressLength), "Address Length", NULL}
+};
+ACPI_RSDUMP_INFO AcpiRsDumpMemory32[6] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemory32), "32-Bit Memory Range", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Memory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.Alignment), "Alignment", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Memory32.AddressLength), "Address Length", NULL}
+};
- AcpiOsPrintf ("Fixed Io Resource\n");
- AcpiOsPrintf (" Range base address: %08X",
- FixedIoData->BaseAddress);
+ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[4] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpFixedMemory32), "32-Bit Fixed Memory Range",NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (FixedMemory32.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.Address), "Address", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (FixedMemory32.AddressLength), "Address Length", NULL}
+};
- AcpiOsPrintf (" Range length: %08X",
- FixedIoData->RangeLength);
+ACPI_RSDUMP_INFO AcpiRsDumpAddress16[8] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress16), "16-Bit WORD Address Space",NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Granularity), "Granularity", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.Maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.TranslationOffset), "Translation Offset", NULL},
+ {ACPI_RSD_UINT16, ACPI_RSD_OFFSET (Address16.AddressLength), "Address Length", NULL},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address16.ResourceSource), NULL, NULL}
+};
- return;
-}
+ACPI_RSDUMP_INFO AcpiRsDumpAddress32[8] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress32), "32-Bit DWORD Address Space", NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Granularity), "Granularity", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.Maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.TranslationOffset), "Translation Offset", NULL},
+ {ACPI_RSD_UINT32, ACPI_RSD_OFFSET (Address32.AddressLength), "Address Length", NULL},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address32.ResourceSource), NULL, NULL}
+};
+ACPI_RSDUMP_INFO AcpiRsDumpAddress64[8] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpAddress64), "64-Bit QWORD Address Space", NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Granularity), "Granularity", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.Maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.TranslationOffset), "Translation Offset", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (Address64.AddressLength), "Address Length", NULL},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (Address64.ResourceSource), NULL, NULL}
+};
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsDumpVendorSpecific
- *
- * PARAMETERS: Data - pointer to the resource structure to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Prints out the various members of the Data structure type.
- *
- ******************************************************************************/
+ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[8] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtAddress64), "64-Bit Extended Address Space", NULL},
+ {ACPI_RSD_ADDRESS, 0, NULL, NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Granularity), "Granularity", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Minimum), "Address Minimum", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.Maximum), "Address Maximum", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TranslationOffset), "Translation Offset", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.AddressLength), "Address Length", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (ExtAddress64.TypeSpecific), "Type-Specific Attribute", NULL}
+};
-void
-AcpiRsDumpVendorSpecific (
- ACPI_RESOURCE_DATA *Data)
+ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[8] =
{
- ACPI_RESOURCE_VENDOR *VendorData = (ACPI_RESOURCE_VENDOR *) Data;
- UINT16 Index = 0;
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpExtIrq), "Extended IRQ", NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.ProducerConsumer), "Type", AcpiGbl_ConsumeDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Triggering), "Triggering", AcpiGbl_HeDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Polarity), "Polarity", AcpiGbl_LlDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (ExtendedIrq.Sharable), "Sharing", AcpiGbl_ShrDecode},
+ {ACPI_RSD_SOURCE, ACPI_RSD_OFFSET (ExtendedIrq.ResourceSource), NULL, NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (ExtendedIrq.InterruptCount), "Interrupt Count", NULL},
+ {ACPI_RSD_DWORDLIST,ACPI_RSD_OFFSET (ExtendedIrq.Interrupts[0]), "Interrupt List", NULL}
+};
+ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[6] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGenericReg), "Generic Register", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.SpaceId), "Space ID", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitWidth), "Bit Width", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.BitOffset), "Bit Offset", NULL},
+ {ACPI_RSD_UINT8, ACPI_RSD_OFFSET (GenericReg.AccessSize), "Access Size", NULL},
+ {ACPI_RSD_UINT64, ACPI_RSD_OFFSET (GenericReg.Address), "Address", NULL}
+};
- ACPI_FUNCTION_ENTRY ();
+/*
+ * Tables used for common address descriptor flag fields
+ */
+static ACPI_RSDUMP_INFO AcpiRsDumpGeneralFlags[5] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpGeneralFlags), NULL, NULL},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.ProducerConsumer), "Consumer/Producer", AcpiGbl_ConsumeDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Decode), "Address Decode", AcpiGbl_DecDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MinAddressFixed), "Min Relocatability", AcpiGbl_MinDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.MaxAddressFixed), "Max Relocatability", AcpiGbl_MaxDecode}
+};
- AcpiOsPrintf ("Vendor Specific Resource\n");
+static ACPI_RSDUMP_INFO AcpiRsDumpMemoryFlags[5] =
+{
+ {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpMemoryFlags), "Resource Type", (void *) "Memory Range"},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.WriteProtect), "Write Protect", AcpiGbl_RwDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Caching), "Caching", AcpiGbl_MemDecode},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.RangeType), "Range Type", AcpiGbl_MtpDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Mem.Translation), "Translation", AcpiGbl_TtpDecode}
+};
- AcpiOsPrintf (" Length: %08X\n", VendorData->Length);
+static ACPI_RSDUMP_INFO AcpiRsDumpIoFlags[4] =
+{
+ {ACPI_RSD_LITERAL, ACPI_RSD_TABLE_SIZE (AcpiRsDumpIoFlags), "Resource Type", (void *) "I/O Range"},
+ {ACPI_RSD_2BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.RangeType), "Range Type", AcpiGbl_RngDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.Translation), "Translation", AcpiGbl_TtpDecode},
+ {ACPI_RSD_1BITFLAG, ACPI_RSD_OFFSET (Address.Info.Io.TranslationType), "Translation Type", AcpiGbl_TrsDecode}
+};
- for (Index = 0; Index < VendorData->Length; Index++)
- {
- AcpiOsPrintf (" Byte %X: %08X\n",
- Index, VendorData->Reserved[Index]);
- }
- return;
-}
+/*
+ * Table used to dump _PRT contents
+ */
+static ACPI_RSDUMP_INFO AcpiRsDumpPrt[5] =
+{
+ {ACPI_RSD_TITLE, ACPI_RSD_TABLE_SIZE (AcpiRsDumpPrt), NULL, NULL},
+ {ACPI_RSD_UINT64, ACPI_PRT_OFFSET (Address), "Address", NULL},
+ {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (Pin), "Pin", NULL},
+ {ACPI_RSD_STRING, ACPI_PRT_OFFSET (Source[0]), "Source", NULL},
+ {ACPI_RSD_UINT32, ACPI_PRT_OFFSET (SourceIndex), "Source Index", NULL}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpMemory24
+ * FUNCTION: AcpiRsDumpDescriptor
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION:
*
******************************************************************************/
-void
-AcpiRsDumpMemory24 (
- ACPI_RESOURCE_DATA *Data)
+static void
+AcpiRsDumpDescriptor (
+ void *Resource,
+ ACPI_RSDUMP_INFO *Table)
{
- ACPI_RESOURCE_MEM24 *Memory24Data = (ACPI_RESOURCE_MEM24 *) Data;
+ UINT8 *Target = NULL;
+ UINT8 *PreviousTarget;
+ char *Name;
+ UINT8 Count;
- ACPI_FUNCTION_ENTRY ();
+ /* First table entry must contain the table length (# of table entries) */
+ Count = Table->Offset;
- AcpiOsPrintf ("24-Bit Memory Range Resource\n");
+ while (Count)
+ {
+ PreviousTarget = Target;
+ Target = ACPI_ADD_PTR (UINT8, Resource, Table->Offset);
+ Name = Table->Name;
- AcpiOsPrintf (" Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- Memory24Data->ReadWriteAttribute ?
- "/Write" : " only");
+ switch (Table->Opcode)
+ {
+ case ACPI_RSD_TITLE:
+ /*
+ * Optional resource title
+ */
+ if (Table->Name)
+ {
+ AcpiOsPrintf ("%s Resource\n", Name);
+ }
+ break;
- AcpiOsPrintf (" Range minimum base: %08X\n",
- Memory24Data->MinBaseAddress);
+ /* Strings */
- AcpiOsPrintf (" Range maximum base: %08X\n",
- Memory24Data->MaxBaseAddress);
+ case ACPI_RSD_LITERAL:
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char, Table->Pointer));
+ break;
- AcpiOsPrintf (" Alignment: %08X\n",
- Memory24Data->Alignment);
+ case ACPI_RSD_STRING:
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char, Target));
+ break;
- AcpiOsPrintf (" Range length: %08X\n",
- Memory24Data->RangeLength);
+ /* Data items, 8/16/32/64 bit */
- return;
-}
+ case ACPI_RSD_UINT8:
+ AcpiRsOutInteger8 (Name, ACPI_GET8 (Target));
+ break;
+ case ACPI_RSD_UINT16:
+ AcpiRsOutInteger16 (Name, ACPI_GET16 (Target));
+ break;
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsDumpMemory32
- *
- * PARAMETERS: Data - pointer to the resource structure to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Prints out the various members of the Data structure type.
- *
- ******************************************************************************/
+ case ACPI_RSD_UINT32:
+ AcpiRsOutInteger32 (Name, ACPI_GET32 (Target));
+ break;
-void
-AcpiRsDumpMemory32 (
- ACPI_RESOURCE_DATA *Data)
-{
- ACPI_RESOURCE_MEM32 *Memory32Data = (ACPI_RESOURCE_MEM32 *) Data;
+ case ACPI_RSD_UINT64:
+ AcpiRsOutInteger64 (Name, ACPI_GET64 (Target));
+ break;
+ /* Flags: 1-bit and 2-bit flags supported */
- ACPI_FUNCTION_ENTRY ();
+ case ACPI_RSD_1BITFLAG:
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char,
+ Table->Pointer [*Target & 0x01]));
+ break;
+ case ACPI_RSD_2BITFLAG:
+ AcpiRsOutString (Name, ACPI_CAST_PTR (char,
+ Table->Pointer [*Target & 0x03]));
+ break;
- AcpiOsPrintf ("32-Bit Memory Range Resource\n");
+ case ACPI_RSD_SHORTLIST:
+ /*
+ * Short byte list (single line output) for DMA and IRQ resources
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (PreviousTarget)
+ {
+ AcpiRsOutTitle (Name);
+ AcpiRsDumpShortByteList (*PreviousTarget, Target);
+ }
+ break;
- AcpiOsPrintf (" Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- Memory32Data->ReadWriteAttribute ?
- "/Write" : " only");
+ case ACPI_RSD_LONGLIST:
+ /*
+ * Long byte list for Vendor resource data
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (PreviousTarget)
+ {
+ AcpiRsDumpByteList (ACPI_GET16 (PreviousTarget), Target);
+ }
+ break;
- AcpiOsPrintf (" Range minimum base: %08X\n",
- Memory32Data->MinBaseAddress);
+ case ACPI_RSD_DWORDLIST:
+ /*
+ * Dword list for Extended Interrupt resources
+ * Note: The list length is obtained from the previous table entry
+ */
+ if (PreviousTarget)
+ {
+ AcpiRsDumpDwordList (*PreviousTarget,
+ ACPI_CAST_PTR (UINT32, Target));
+ }
+ break;
- AcpiOsPrintf (" Range maximum base: %08X\n",
- Memory32Data->MaxBaseAddress);
+ case ACPI_RSD_ADDRESS:
+ /*
+ * Common flags for all Address resources
+ */
+ AcpiRsDumpAddressCommon (ACPI_CAST_PTR (ACPI_RESOURCE_DATA, Target));
+ break;
- AcpiOsPrintf (" Alignment: %08X\n",
- Memory32Data->Alignment);
+ case ACPI_RSD_SOURCE:
+ /*
+ * Optional ResourceSource for Address resources
+ */
+ AcpiRsDumpResourceSource (ACPI_CAST_PTR (ACPI_RESOURCE_SOURCE, Target));
+ break;
- AcpiOsPrintf (" Range length: %08X\n",
- Memory32Data->RangeLength);
+ default:
+ AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n",
+ Table->Opcode);
+ return;
+ }
- return;
+ Table++;
+ Count--;
+ }
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpFixedMemory32
+ * FUNCTION: AcpiRsDumpResourceSource
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: ResourceSource - Pointer to a Resource Source struct
*
- * RETURN:
+ * RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Common routine for dumping the optional ResourceSource and the
+ * corresponding ResourceSourceIndex.
*
******************************************************************************/
-void
-AcpiRsDumpFixedMemory32 (
- ACPI_RESOURCE_DATA *Data)
+static void
+AcpiRsDumpResourceSource (
+ ACPI_RESOURCE_SOURCE *ResourceSource)
{
- ACPI_RESOURCE_FIXED_MEM32 *FixedMemory32Data = (ACPI_RESOURCE_FIXED_MEM32 *) Data;
-
-
ACPI_FUNCTION_ENTRY ();
- AcpiOsPrintf ("32-Bit Fixed Location Memory Range Resource\n");
-
- AcpiOsPrintf (" Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- FixedMemory32Data->ReadWriteAttribute ?
- "/Write" : " Only");
-
- AcpiOsPrintf (" Range base address: %08X\n",
- FixedMemory32Data->RangeBaseAddress);
+ if (ResourceSource->Index == 0xFF)
+ {
+ return;
+ }
- AcpiOsPrintf (" Range length: %08X\n",
- FixedMemory32Data->RangeLength);
+ AcpiRsOutInteger8 ("Resource Source Index",
+ ResourceSource->Index);
- return;
+ AcpiRsOutString ("Resource Source",
+ ResourceSource->StringPtr ?
+ ResourceSource->StringPtr : "[Not Specified]");
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpAddress16
+ * FUNCTION: AcpiRsDumpAddressCommon
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Resource - Pointer to an internal resource descriptor
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dump the fields that are common to all Address resource
+ * descriptors
*
******************************************************************************/
-void
-AcpiRsDumpAddress16 (
- ACPI_RESOURCE_DATA *Data)
+static void
+AcpiRsDumpAddressCommon (
+ ACPI_RESOURCE_DATA *Resource)
{
- ACPI_RESOURCE_ADDRESS16 *Address16Data = (ACPI_RESOURCE_ADDRESS16 *) Data;
-
-
ACPI_FUNCTION_ENTRY ();
- AcpiOsPrintf ("16-Bit Address Space Resource\n");
- AcpiOsPrintf (" Resource Type: ");
+ /* Decode the type-specific flags */
- switch (Address16Data->ResourceType)
+ switch (Resource->Address.ResourceType)
{
case ACPI_MEMORY_RANGE:
- AcpiOsPrintf ("Memory Range\n");
-
- switch (Address16Data->Attribute.Memory.CacheAttribute)
- {
- case ACPI_NON_CACHEABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Noncacheable memory\n");
- break;
-
- case ACPI_CACHABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Cacheable memory\n");
- break;
-
- case ACPI_WRITE_COMBINING_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Write-combining memory\n");
- break;
-
- case ACPI_PREFETCHABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Prefetchable memory\n");
- break;
-
- default:
- AcpiOsPrintf (" Type Specific: "
- "Invalid cache attribute\n");
- break;
- }
-
- AcpiOsPrintf (" Type Specific: Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- Address16Data->Attribute.Memory.ReadWriteAttribute ?
- "/Write" : " Only");
+ AcpiRsDumpDescriptor (Resource, AcpiRsDumpMemoryFlags);
break;
case ACPI_IO_RANGE:
- AcpiOsPrintf ("I/O Range\n");
-
- switch (Address16Data->Attribute.Io.RangeAttribute)
- {
- case ACPI_NON_ISA_ONLY_RANGES:
- AcpiOsPrintf (" Type Specific: "
- "Non-ISA Io Addresses\n");
- break;
-
- case ACPI_ISA_ONLY_RANGES:
- AcpiOsPrintf (" Type Specific: "
- "ISA Io Addresses\n");
- break;
-
- case ACPI_ENTIRE_RANGE:
- AcpiOsPrintf (" Type Specific: "
- "ISA and non-ISA Io Addresses\n");
- break;
-
- default:
- AcpiOsPrintf (" Type Specific: "
- "Invalid range attribute\n");
- break;
- }
-
- AcpiOsPrintf (" Type Specific: %s Translation\n",
- ACPI_SPARSE_TRANSLATION ==
- Address16Data->Attribute.Io.TranslationAttribute ?
- "Sparse" : "Dense");
+ AcpiRsDumpDescriptor (Resource, AcpiRsDumpIoFlags);
break;
case ACPI_BUS_NUMBER_RANGE:
- AcpiOsPrintf ("Bus Number Range\n");
+ AcpiRsOutString ("Resource Type", "Bus Number Range");
break;
default:
- AcpiOsPrintf ("Invalid resource type. Exiting.\n");
- return;
+ AcpiRsOutInteger8 ("Resource Type",
+ (UINT8) Resource->Address.ResourceType);
+ break;
}
- AcpiOsPrintf (" Resource %s\n",
- ACPI_CONSUMER == Address16Data->ProducerConsumer ?
- "Consumer" : "Producer");
-
- AcpiOsPrintf (" %s decode\n",
- ACPI_SUB_DECODE == Address16Data->Decode ?
- "Subtractive" : "Positive");
-
- AcpiOsPrintf (" Min address is %s fixed\n",
- ACPI_ADDRESS_FIXED == Address16Data->MinAddressFixed ?
- "" : "not");
+ /* Decode the general flags */
- AcpiOsPrintf (" Max address is %s fixed\n",
- ACPI_ADDRESS_FIXED == Address16Data->MaxAddressFixed ?
- "" : "not");
-
- AcpiOsPrintf (" Granularity: %08X\n",
- Address16Data->Granularity);
-
- AcpiOsPrintf (" Address range min: %08X\n",
- Address16Data->MinAddressRange);
-
- AcpiOsPrintf (" Address range max: %08X\n",
- Address16Data->MaxAddressRange);
-
- AcpiOsPrintf (" Address translation offset: %08X\n",
- Address16Data->AddressTranslationOffset);
-
- AcpiOsPrintf (" Address Length: %08X\n",
- Address16Data->AddressLength);
-
- if (0xFF != Address16Data->ResourceSource.Index)
- {
- AcpiOsPrintf (" Resource Source Index: %X\n",
- Address16Data->ResourceSource.Index);
- AcpiOsPrintf (" Resource Source: %s\n",
- Address16Data->ResourceSource.StringPtr);
- }
-
- return;
+ AcpiRsDumpDescriptor (Resource, AcpiRsDumpGeneralFlags);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpAddress32
+ * FUNCTION: AcpiRsDumpResourceList
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: ResourceList - Pointer to a resource descriptor list
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Dispatches the structure to the correct dump routine.
*
******************************************************************************/
void
-AcpiRsDumpAddress32 (
- ACPI_RESOURCE_DATA *Data)
+AcpiRsDumpResourceList (
+ ACPI_RESOURCE *ResourceList)
{
- ACPI_RESOURCE_ADDRESS32 *Address32Data = (ACPI_RESOURCE_ADDRESS32 *) Data;
+ UINT32 Count = 0;
+ UINT32 Type;
ACPI_FUNCTION_ENTRY ();
- AcpiOsPrintf ("32-Bit Address Space Resource\n");
-
- switch (Address32Data->ResourceType)
+ if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
{
- case ACPI_MEMORY_RANGE:
-
- AcpiOsPrintf (" Resource Type: Memory Range\n");
-
- switch (Address32Data->Attribute.Memory.CacheAttribute)
- {
- case ACPI_NON_CACHEABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Noncacheable memory\n");
- break;
-
- case ACPI_CACHABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Cacheable memory\n");
- break;
-
- case ACPI_WRITE_COMBINING_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Write-combining memory\n");
- break;
-
- case ACPI_PREFETCHABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Prefetchable memory\n");
- break;
-
- default:
- AcpiOsPrintf (" Type Specific: "
- "Invalid cache attribute\n");
- break;
- }
-
- AcpiOsPrintf (" Type Specific: Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- Address32Data->Attribute.Memory.ReadWriteAttribute ?
- "/Write" : " Only");
- break;
-
- case ACPI_IO_RANGE:
-
- AcpiOsPrintf (" Resource Type: Io Range\n");
-
- switch (Address32Data->Attribute.Io.RangeAttribute)
- {
- case ACPI_NON_ISA_ONLY_RANGES:
- AcpiOsPrintf (" Type Specific: "
- "Non-ISA Io Addresses\n");
- break;
-
- case ACPI_ISA_ONLY_RANGES:
- AcpiOsPrintf (" Type Specific: "
- "ISA Io Addresses\n");
- break;
-
- case ACPI_ENTIRE_RANGE:
- AcpiOsPrintf (" Type Specific: "
- "ISA and non-ISA Io Addresses\n");
- break;
-
- default:
- AcpiOsPrintf (" Type Specific: "
- "Invalid Range attribute");
- break;
- }
-
- AcpiOsPrintf (" Type Specific: %s Translation\n",
- ACPI_SPARSE_TRANSLATION ==
- Address32Data->Attribute.Io.TranslationAttribute ?
- "Sparse" : "Dense");
- break;
-
- case ACPI_BUS_NUMBER_RANGE:
-
- AcpiOsPrintf (" Resource Type: Bus Number Range\n");
- break;
-
- default:
-
- AcpiOsPrintf (" Invalid Resource Type..exiting.\n");
return;
}
- AcpiOsPrintf (" Resource %s\n",
- ACPI_CONSUMER == Address32Data->ProducerConsumer ?
- "Consumer" : "Producer");
+ /* Walk list and dump all resource descriptors (END_TAG terminates) */
- AcpiOsPrintf (" %s decode\n",
- ACPI_SUB_DECODE == Address32Data->Decode ?
- "Subtractive" : "Positive");
+ do
+ {
+ AcpiOsPrintf ("\n[%02X] ", Count);
+ Count++;
- AcpiOsPrintf (" Min address is %s fixed\n",
- ACPI_ADDRESS_FIXED == Address32Data->MinAddressFixed ?
- "" : "not ");
+ /* Validate Type before dispatch */
- AcpiOsPrintf (" Max address is %s fixed\n",
- ACPI_ADDRESS_FIXED == Address32Data->MaxAddressFixed ?
- "" : "not ");
+ Type = ResourceList->Type;
+ if (Type > ACPI_RESOURCE_TYPE_MAX)
+ {
+ AcpiOsPrintf (
+ "Invalid descriptor type (%X) in resource list\n",
+ ResourceList->Type);
+ return;
+ }
- AcpiOsPrintf (" Granularity: %08X\n",
- Address32Data->Granularity);
+ /* Dump the resource descriptor */
- AcpiOsPrintf (" Address range min: %08X\n",
- Address32Data->MinAddressRange);
+ AcpiRsDumpDescriptor (&ResourceList->Data,
+ AcpiGbl_DumpResourceDispatch[Type]);
- AcpiOsPrintf (" Address range max: %08X\n",
- Address32Data->MaxAddressRange);
+ /* Point to the next resource structure */
- AcpiOsPrintf (" Address translation offset: %08X\n",
- Address32Data->AddressTranslationOffset);
+ ResourceList = ACPI_ADD_PTR (ACPI_RESOURCE, ResourceList,
+ ResourceList->Length);
- AcpiOsPrintf (" Address Length: %08X\n",
- Address32Data->AddressLength);
+ /* Exit when END_TAG descriptor is reached */
- if(0xFF != Address32Data->ResourceSource.Index)
- {
- AcpiOsPrintf (" Resource Source Index: %X\n",
- Address32Data->ResourceSource.Index);
- AcpiOsPrintf (" Resource Source: %s\n",
- Address32Data->ResourceSource.StringPtr);
- }
-
- return;
+ } while (Type != ACPI_RESOURCE_TYPE_END_TAG);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpAddress64
+ * FUNCTION: AcpiRsDumpIrqList
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: RouteTable - Pointer to the routing table to dump.
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Print IRQ routing table
*
******************************************************************************/
void
-AcpiRsDumpAddress64 (
- ACPI_RESOURCE_DATA *Data)
+AcpiRsDumpIrqList (
+ UINT8 *RouteTable)
{
- ACPI_RESOURCE_ADDRESS64 *Address64Data = (ACPI_RESOURCE_ADDRESS64 *) Data;
+ ACPI_PCI_ROUTING_TABLE *PrtElement;
+ UINT8 Count;
ACPI_FUNCTION_ENTRY ();
- AcpiOsPrintf ("64-Bit Address Space Resource\n");
-
- switch (Address64Data->ResourceType)
+ if (!(AcpiDbgLevel & ACPI_LV_RESOURCES) || !( _COMPONENT & AcpiDbgLayer))
{
- case ACPI_MEMORY_RANGE:
-
- AcpiOsPrintf (" Resource Type: Memory Range\n");
-
- switch (Address64Data->Attribute.Memory.CacheAttribute)
- {
- case ACPI_NON_CACHEABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Noncacheable memory\n");
- break;
-
- case ACPI_CACHABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Cacheable memory\n");
- break;
-
- case ACPI_WRITE_COMBINING_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Write-combining memory\n");
- break;
-
- case ACPI_PREFETCHABLE_MEMORY:
- AcpiOsPrintf (" Type Specific: "
- "Prefetchable memory\n");
- break;
-
- default:
- AcpiOsPrintf (" Type Specific: "
- "Invalid cache attribute\n");
- break;
- }
-
- AcpiOsPrintf (" Type Specific: Read%s\n",
- ACPI_READ_WRITE_MEMORY ==
- Address64Data->Attribute.Memory.ReadWriteAttribute ?
- "/Write" : " Only");
- break;
-
- case ACPI_IO_RANGE:
-
- AcpiOsPrintf (" Resource Type: Io Range\n");
-
- switch (Address64Data->Attribute.Io.RangeAttribute)
- {
- case ACPI_NON_ISA_ONLY_RANGES:
- AcpiOsPrintf (" Type Specific: "
- "Non-ISA Io Addresses\n");
- break;
-
- case ACPI_ISA_ONLY_RANGES:
- AcpiOsPrintf (" Type Specific: "
- "ISA Io Addresses\n");
- break;
-
- case ACPI_ENTIRE_RANGE:
- AcpiOsPrintf (" Type Specific: "
- "ISA and non-ISA Io Addresses\n");
- break;
-
- default:
- AcpiOsPrintf (" Type Specific: "
- "Invalid Range attribute");
- break;
- }
-
- AcpiOsPrintf (" Type Specific: %s Translation\n",
- ACPI_SPARSE_TRANSLATION ==
- Address64Data->Attribute.Io.TranslationAttribute ?
- "Sparse" : "Dense");
- break;
-
- case ACPI_BUS_NUMBER_RANGE:
-
- AcpiOsPrintf (" Resource Type: Bus Number Range\n");
- break;
-
- default:
-
- AcpiOsPrintf (" Invalid Resource Type..exiting.\n");
return;
}
- AcpiOsPrintf (" Resource %s\n",
- ACPI_CONSUMER == Address64Data->ProducerConsumer ?
- "Consumer" : "Producer");
-
- AcpiOsPrintf (" %s decode\n",
- ACPI_SUB_DECODE == Address64Data->Decode ?
- "Subtractive" : "Positive");
-
- AcpiOsPrintf (" Min address is %s fixed\n",
- ACPI_ADDRESS_FIXED == Address64Data->MinAddressFixed ?
- "" : "not ");
+ PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, RouteTable);
- AcpiOsPrintf (" Max address is %s fixed\n",
- ACPI_ADDRESS_FIXED == Address64Data->MaxAddressFixed ?
- "" : "not ");
+ /* Dump all table elements, Exit on zero length element */
- AcpiOsPrintf (" Granularity: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (Address64Data->Granularity));
-
- AcpiOsPrintf (" Address range min: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (Address64Data->MinAddressRange));
-
- AcpiOsPrintf (" Address range max: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (Address64Data->MaxAddressRange));
-
- AcpiOsPrintf (" Address translation offset: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (Address64Data->AddressTranslationOffset));
-
- AcpiOsPrintf (" Address Length: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (Address64Data->AddressLength));
-
- if(0xFF != Address64Data->ResourceSource.Index)
+ for (Count = 0; PrtElement->Length; Count++)
{
- AcpiOsPrintf (" Resource Source Index: %X\n",
- Address64Data->ResourceSource.Index);
- AcpiOsPrintf (" Resource Source: %s\n",
- Address64Data->ResourceSource.StringPtr);
- }
+ AcpiOsPrintf ("\n[%02X] PCI IRQ Routing Table Package\n", Count);
+ AcpiRsDumpDescriptor (PrtElement, AcpiRsDumpPrt);
- return;
+ PrtElement = ACPI_ADD_PTR (ACPI_PCI_ROUTING_TABLE,
+ PrtElement, PrtElement->Length);
+ }
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpExtendedIrq
+ * FUNCTION: AcpiRsOut*
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Title - Name of the resource field
+ * Value - Value of the resource field
*
* RETURN: None
*
- * DESCRIPTION: Prints out the various members of the Data structure type.
+ * DESCRIPTION: Miscellaneous helper functions to consistently format the
+ * output of the resource dump routines
*
******************************************************************************/
-void
-AcpiRsDumpExtendedIrq (
- ACPI_RESOURCE_DATA *Data)
+static void
+AcpiRsOutString (
+ char *Title,
+ char *Value)
{
- ACPI_RESOURCE_EXT_IRQ *ExtIrqData = (ACPI_RESOURCE_EXT_IRQ *) Data;
- UINT8 Index = 0;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- AcpiOsPrintf ("Extended IRQ Resource\n");
-
- AcpiOsPrintf (" Resource %s\n",
- ACPI_CONSUMER == ExtIrqData->ProducerConsumer ?
- "Consumer" : "Producer");
-
- AcpiOsPrintf (" %s\n",
- ACPI_LEVEL_SENSITIVE == ExtIrqData->EdgeLevel ?
- "Level" : "Edge");
-
- AcpiOsPrintf (" Active %s\n",
- ACPI_ACTIVE_LOW == ExtIrqData->ActiveHighLow ?
- "low" : "high");
-
- AcpiOsPrintf (" %s\n",
- ACPI_SHARED == ExtIrqData->SharedExclusive ?
- "Shared" : "Exclusive");
-
- AcpiOsPrintf (" Interrupts : %X ( ",
- ExtIrqData->NumberOfInterrupts);
-
- for (Index = 0; Index < ExtIrqData->NumberOfInterrupts; Index++)
+ AcpiOsPrintf ("%27s : %s", Title, Value);
+ if (!*Value)
{
- AcpiOsPrintf ("%X ", ExtIrqData->Interrupts[Index]);
+ AcpiOsPrintf ("[NULL NAMESTRING]");
}
+ AcpiOsPrintf ("\n");
+}
- AcpiOsPrintf (")\n");
+static void
+AcpiRsOutInteger8 (
+ char *Title,
+ UINT8 Value)
+{
+ AcpiOsPrintf ("%27s : %2.2X\n", Title, Value);
+}
- if(0xFF != ExtIrqData->ResourceSource.Index)
- {
- AcpiOsPrintf (" Resource Source Index: %X",
- ExtIrqData->ResourceSource.Index);
- AcpiOsPrintf (" Resource Source: %s",
- ExtIrqData->ResourceSource.StringPtr);
- }
+static void
+AcpiRsOutInteger16 (
+ char *Title,
+ UINT16 Value)
+{
+ AcpiOsPrintf ("%27s : %4.4X\n", Title, Value);
+}
- return;
+static void
+AcpiRsOutInteger32 (
+ char *Title,
+ UINT32 Value)
+{
+ AcpiOsPrintf ("%27s : %8.8X\n", Title, Value);
+}
+
+static void
+AcpiRsOutInteger64 (
+ char *Title,
+ UINT64 Value)
+{
+ AcpiOsPrintf ("%27s : %8.8X%8.8X\n", Title,
+ ACPI_FORMAT_UINT64 (Value));
+}
+
+static void
+AcpiRsOutTitle (
+ char *Title)
+{
+ AcpiOsPrintf ("%27s : ", Title);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsDumpResourceList
+ * FUNCTION: AcpiRsDump*List
*
- * PARAMETERS: Data - pointer to the resource structure to dump.
+ * PARAMETERS: Length - Number of elements in the list
+ * Data - Start of the list
*
* RETURN: None
*
- * DESCRIPTION: Dispatches the structure to the correct dump routine.
+ * DESCRIPTION: Miscellaneous functions to dump lists of raw data
*
******************************************************************************/
-void
-AcpiRsDumpResourceList (
- ACPI_RESOURCE *Resource)
+static void
+AcpiRsDumpByteList (
+ UINT16 Length,
+ UINT8 *Data)
{
- UINT8 Count = 0;
- BOOLEAN Done = FALSE;
-
-
- ACPI_FUNCTION_ENTRY ();
+ UINT8 i;
- if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer)
+ for (i = 0; i < Length; i++)
{
- while (!Done)
- {
- AcpiOsPrintf ("Resource structure %X.\n", Count++);
-
- switch (Resource->Id)
- {
- case ACPI_RSTYPE_IRQ:
- AcpiRsDumpIrq (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_DMA:
- AcpiRsDumpDma (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_START_DPF:
- AcpiRsDumpStartDependFns (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_END_DPF:
- AcpiOsPrintf ("EndDependentFunctions Resource\n");
- /* AcpiRsDumpEndDependentFunctions (Resource->Data);*/
- break;
-
- case ACPI_RSTYPE_IO:
- AcpiRsDumpIo (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_FIXED_IO:
- AcpiRsDumpFixedIo (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_VENDOR:
- AcpiRsDumpVendorSpecific (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_END_TAG:
- /*RsDumpEndTag (Resource->Data);*/
- AcpiOsPrintf ("EndTag Resource\n");
- Done = TRUE;
- break;
-
- case ACPI_RSTYPE_MEM24:
- AcpiRsDumpMemory24 (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_MEM32:
- AcpiRsDumpMemory32 (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_FIXED_MEM32:
- AcpiRsDumpFixedMemory32 (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_ADDRESS16:
- AcpiRsDumpAddress16 (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_ADDRESS32:
- AcpiRsDumpAddress32 (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_ADDRESS64:
- AcpiRsDumpAddress64 (&Resource->Data);
- break;
-
- case ACPI_RSTYPE_EXT_IRQ:
- AcpiRsDumpExtendedIrq (&Resource->Data);
- break;
-
- default:
- AcpiOsPrintf ("Invalid resource type\n");
- break;
-
- }
-
- Resource = ACPI_PTR_ADD (ACPI_RESOURCE, Resource, Resource->Length);
- }
+ AcpiOsPrintf ("%25s%2.2X : %2.2X\n",
+ "Byte", i, Data[i]);
}
-
- return;
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsDumpIrqList
- *
- * PARAMETERS: Data - pointer to the routing table to dump.
- *
- * RETURN: None
- *
- * DESCRIPTION: Dispatches the structures to the correct dump routine.
- *
- ******************************************************************************/
-
-void
-AcpiRsDumpIrqList (
- UINT8 *RouteTable)
+static void
+AcpiRsDumpShortByteList (
+ UINT8 Length,
+ UINT8 *Data)
{
- UINT8 *Buffer = RouteTable;
- UINT8 Count = 0;
- BOOLEAN Done = FALSE;
- ACPI_PCI_ROUTING_TABLE *PrtElement;
-
-
- ACPI_FUNCTION_ENTRY ();
+ UINT8 i;
- if (AcpiDbgLevel & ACPI_LV_RESOURCES && _COMPONENT & AcpiDbgLayer)
+ for (i = 0; i < Length; i++)
{
- PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
-
- while (!Done)
- {
- AcpiOsPrintf ("PCI IRQ Routing Table structure %X.\n", Count++);
-
- AcpiOsPrintf (" Address: %8.8X%8.8X\n",
- ACPI_FORMAT_UINT64 (PrtElement->Address));
-
- AcpiOsPrintf (" Pin: %X\n", PrtElement->Pin);
-
- AcpiOsPrintf (" Source: %s\n", PrtElement->Source);
-
- AcpiOsPrintf (" SourceIndex: %X\n",
- PrtElement->SourceIndex);
+ AcpiOsPrintf ("%X ", Data[i]);
+ }
+ AcpiOsPrintf ("\n");
+}
- Buffer += PrtElement->Length;
+static void
+AcpiRsDumpDwordList (
+ UINT8 Length,
+ UINT32 *Data)
+{
+ UINT8 i;
- PrtElement = ACPI_CAST_PTR (ACPI_PCI_ROUTING_TABLE, Buffer);
- if(0 == PrtElement->Length)
- {
- Done = TRUE;
- }
- }
+ for (i = 0; i < Length; i++)
+ {
+ AcpiOsPrintf ("%25s%2.2X : %8.8X\n",
+ "Dword", i, Data[i]);
}
-
- return;
}
#endif
Index: evxface.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evxface.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evxface.c -L sys/contrib/dev/acpica/evxface.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evxface.c
+++ sys/contrib/dev/acpica/evxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxface - External interfaces for ACPI events
- * $Revision: 147 $
+ * $Revision: 1.165 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -41,7 +41,7 @@
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial prton of the Covered
+ * Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
@@ -146,7 +146,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallExceptionHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallExceptionHandler);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -172,6 +172,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallExceptionHandler)
+
/*******************************************************************************
*
@@ -198,7 +200,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallFixedEventHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallFixedEventHandler);
/* Parameter validation */
@@ -230,7 +232,7 @@
Status = AcpiEnableEvent (Event, 0);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Could not enable fixed event.\n"));
+ ACPI_WARNING ((AE_INFO, "Could not enable fixed event %X", Event));
/* Remove the handler */
@@ -249,6 +251,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallFixedEventHandler)
+
/*******************************************************************************
*
@@ -271,7 +275,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiRemoveFixedEventHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveFixedEventHandler);
/* Parameter validation */
@@ -298,18 +302,20 @@
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
- "Could not write to fixed event enable register.\n"));
+ ACPI_WARNING ((AE_INFO,
+ "Could not write to fixed event enable register %X", Event));
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X.\n", Event));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Disabled fixed event %X\n", Event));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveFixedEventHandler)
+
/*******************************************************************************
*
@@ -342,7 +348,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallNotifyHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallNotifyHandler);
/* Parameter validation */
@@ -497,6 +503,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallNotifyHandler)
+
/*******************************************************************************
*
@@ -527,7 +535,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiRemoveNotifyHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveNotifyHandler);
/* Parameter validation */
@@ -558,7 +566,8 @@
if (Device == ACPI_ROOT_OBJECT)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Removing notify handler for ROOT object.\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Removing notify handler for namespace root object\n"));
if (((HandlerType & ACPI_SYSTEM_NOTIFY) &&
!AcpiGbl_SystemNotify.Handler) ||
@@ -610,8 +619,13 @@
if (HandlerType & ACPI_SYSTEM_NOTIFY)
{
NotifyObj = ObjDesc->CommonNotify.SystemNotify;
- if ((!NotifyObj) ||
- (NotifyObj->Notify.Handler != Handler))
+ if (!NotifyObj)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ if (NotifyObj->Notify.Handler != Handler)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -626,8 +640,13 @@
if (HandlerType & ACPI_DEVICE_NOTIFY)
{
NotifyObj = ObjDesc->CommonNotify.DeviceNotify;
- if ((!NotifyObj) ||
- (NotifyObj->Notify.Handler != Handler))
+ if (!NotifyObj)
+ {
+ Status = AE_NOT_EXIST;
+ goto UnlockAndExit;
+ }
+
+ if (NotifyObj->Notify.Handler != Handler)
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -646,13 +665,16 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveNotifyHandler)
+
/*******************************************************************************
*
* FUNCTION: AcpiInstallGpeHandler
*
- * PARAMETERS: GpeNumber - The GPE number within the GPE block
- * GpeBlock - GPE block (NULL == FADT GPEs)
+ * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT
+ * defined GPEs)
+ * GpeNumber - The GPE number within the GPE block
* Type - Whether this GPE should be treated as an
* edge- or level-triggered interrupt.
* Address - Address of the handler
@@ -675,9 +697,10 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("AcpiInstallGpeHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallGpeHandler);
/* Parameter validation */
@@ -712,7 +735,7 @@
/* Allocate and init handler object */
- Handler = ACPI_MEM_CALLOCATE (sizeof (ACPI_HANDLER_INFO));
+ Handler = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_HANDLER_INFO));
if (!Handler)
{
Status = AE_NO_MEMORY;
@@ -733,7 +756,7 @@
/* Install the handler */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
GpeEventInfo->Dispatch.Handler = Handler;
/* Setup up dispatch flags to indicate handler (vs. method) */
@@ -741,7 +764,7 @@
GpeEventInfo->Flags &= ~(ACPI_GPE_XRUPT_TYPE_MASK | ACPI_GPE_DISPATCH_MASK); /* Clear bits */
GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_HANDLER);
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
UnlockAndExit:
@@ -749,13 +772,16 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallGpeHandler)
+
/*******************************************************************************
*
* FUNCTION: AcpiRemoveGpeHandler
*
- * PARAMETERS: GpeNumber - The event to remove a handler
- * GpeBlock - GPE block (NULL == FADT GPEs)
+ * PARAMETERS: GpeDevice - Namespace node for the GPE (NULL for FADT
+ * defined GPEs)
+ * GpeNumber - The event to remove a handler
* Address - Address of the handler
*
* RETURN: Status
@@ -773,9 +799,10 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_HANDLER_INFO *Handler;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("AcpiRemoveGpeHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveGpeHandler);
/* Parameter validation */
@@ -826,7 +853,7 @@
/* Remove the handler */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
Handler = GpeEventInfo->Dispatch.Handler;
/* Restore Method node (if any), set dispatch flags */
@@ -837,11 +864,11 @@
{
GpeEventInfo->Flags |= ACPI_GPE_DISPATCH_METHOD;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Now we can free the handler object */
- ACPI_MEM_FREE (Handler);
+ ACPI_FREE (Handler);
UnlockAndExit:
@@ -849,18 +876,27 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveGpeHandler)
+
/*******************************************************************************
*
* FUNCTION: AcpiAcquireGlobalLock
*
* PARAMETERS: Timeout - How long the caller is willing to wait
- * OutHandle - A handle to the lock if acquired
+ * Handle - Where the handle to the lock is returned
+ * (if acquired)
*
* RETURN: Status
*
* DESCRIPTION: Acquire the ACPI Global Lock
*
+ * Note: Allows callers with the same thread ID to acquire the global lock
+ * multiple times. In other words, externally, the behavior of the global lock
+ * is identical to an AML mutex. On the first acquire, a new handle is
+ * returned. On any subsequent calls to acquire by the same thread, the same
+ * handle is returned.
+ *
******************************************************************************/
ACPI_STATUS
@@ -876,24 +912,26 @@
return (AE_BAD_PARAMETER);
}
- Status = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ /* Must lock interpreter to prevent race conditions */
- Status = AcpiEvAcquireGlobalLock (Timeout);
- AcpiExExitInterpreter ();
+ AcpiExEnterInterpreter ();
+
+ Status = AcpiExAcquireMutexObject (Timeout,
+ AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ());
if (ACPI_SUCCESS (Status))
{
- AcpiGbl_GlobalLockHandle++;
+ /* Return the global lock handle (updated in AcpiEvAcquireGlobalLock) */
+
*Handle = AcpiGbl_GlobalLockHandle;
}
+ AcpiExExitInterpreter ();
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiAcquireGlobalLock)
+
/*******************************************************************************
*
@@ -903,7 +941,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Release the ACPI Global Lock
+ * DESCRIPTION: Release the ACPI Global Lock. The handle must be valid.
*
******************************************************************************/
@@ -914,13 +952,14 @@
ACPI_STATUS Status;
- if (Handle != AcpiGbl_GlobalLockHandle)
+ if (!Handle || (Handle != AcpiGbl_GlobalLockHandle))
{
return (AE_NOT_ACQUIRED);
}
- Status = AcpiEvReleaseGlobalLock ();
+ Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex);
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiReleaseGlobalLock)
Index: hwtimer.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/hwtimer.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/hwtimer.c -L sys/contrib/dev/acpica/hwtimer.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/hwtimer.c
+++ sys/contrib/dev/acpica/hwtimer.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwtimer.c - ACPI Power Management Timer Interface
- * $Revision: 28 $
+ * $Revision: 1.37 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,7 +137,7 @@
AcpiGetTimerResolution (
UINT32 *Resolution)
{
- ACPI_FUNCTION_TRACE ("AcpiGetTimerResolution");
+ ACPI_FUNCTION_TRACE (AcpiGetTimerResolution);
if (!Resolution)
@@ -145,7 +145,7 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (0 == AcpiGbl_FADT->TmrValExt)
+ if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0)
{
*Resolution = 24;
}
@@ -157,6 +157,8 @@
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTimerResolution)
+
/******************************************************************************
*
@@ -164,7 +166,7 @@
*
* PARAMETERS: Ticks - Where the timer value is returned
*
- * RETURN: Status and current ticks
+ * RETURN: Status and current timer value (ticks)
*
* DESCRIPTION: Obtains current value of ACPI PM Timer (in ticks).
*
@@ -177,7 +179,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiGetTimer");
+ ACPI_FUNCTION_TRACE (AcpiGetTimer);
if (!Ticks)
@@ -185,11 +187,13 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT->XPmTmrBlk);
+ Status = AcpiHwLowLevelRead (32, Ticks, &AcpiGbl_FADT.XPmTimerBlock);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTimer)
+
/******************************************************************************
*
@@ -231,7 +235,7 @@
ACPI_INTEGER Quotient;
- ACPI_FUNCTION_TRACE ("AcpiGetTimerDuration");
+ ACPI_FUNCTION_TRACE (AcpiGetTimerDuration);
if (!TimeElapsed)
@@ -249,7 +253,7 @@
}
else if (StartTicks > EndTicks)
{
- if (0 == AcpiGbl_FADT->TmrValExt)
+ if ((AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER) == 0)
{
/* 24-bit Timer */
@@ -280,4 +284,5 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTimerDuration)
Index: evrgnini.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evrgnini.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evrgnini.c -L sys/contrib/dev/acpica/evrgnini.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evrgnini.c
+++ sys/contrib/dev/acpica/evrgnini.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evrgnini- ACPI AddressSpace (OpRegion) init
- * $Revision: 74 $
+ * $Revision: 1.88 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,16 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evrgnini")
+/* Local prototypes */
+
+static BOOLEAN
+AcpiEvMatchPciRootBridge (
+ char *Id);
+
+static BOOLEAN
+AcpiEvIsPciRootBridge (
+ ACPI_NAMESPACE_NODE *Node);
+
/*******************************************************************************
*
@@ -136,7 +146,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Do any prep work for region handling, a nop for now
+ * DESCRIPTION: Setup a SystemMemory operation region
*
******************************************************************************/
@@ -151,14 +161,23 @@
ACPI_MEM_SPACE_CONTEXT *LocalRegionContext;
- ACPI_FUNCTION_TRACE ("EvSystemMemoryRegionSetup");
+ ACPI_FUNCTION_TRACE (EvSystemMemoryRegionSetup);
if (Function == ACPI_REGION_DEACTIVATE)
{
if (*RegionContext)
{
- ACPI_MEM_FREE (*RegionContext);
+ LocalRegionContext = (ACPI_MEM_SPACE_CONTEXT *) *RegionContext;
+
+ /* Delete a cached mapping if present */
+
+ if (LocalRegionContext->MappedLength)
+ {
+ AcpiOsUnmapMemory (LocalRegionContext->MappedLogicalAddress,
+ LocalRegionContext->MappedLength);
+ }
+ ACPI_FREE (LocalRegionContext);
*RegionContext = NULL;
}
return_ACPI_STATUS (AE_OK);
@@ -166,7 +185,7 @@
/* Create a new context */
- LocalRegionContext = ACPI_MEM_CALLOCATE (sizeof (ACPI_MEM_SPACE_CONTEXT));
+ LocalRegionContext = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_MEM_SPACE_CONTEXT));
if (!(LocalRegionContext))
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -193,7 +212,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Do any prep work for region handling
+ * DESCRIPTION: Setup a IO operation region
*
******************************************************************************/
@@ -204,7 +223,7 @@
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvIoSpaceRegionSetup");
+ ACPI_FUNCTION_TRACE (EvIoSpaceRegionSetup);
if (Function == ACPI_REGION_DEACTIVATE)
@@ -224,14 +243,14 @@
*
* FUNCTION: AcpiEvPciConfigRegionSetup
*
- * PARAMETERS: Handle - Region we are interested in
+ * PARAMETERS: Handle - Region we are interested in
* Function - Start or stop
* HandlerContext - Address space handler context
* RegionContext - Region specific context
*
* RETURN: Status
*
- * DESCRIPTION: Do any prep work for region handling
+ * DESCRIPTION: Setup a PCI_Config operation region
*
* MUTEX: Assumes namespace is not locked
*
@@ -250,11 +269,11 @@
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_NAMESPACE_NODE *ParentNode;
ACPI_NAMESPACE_NODE *PciRootNode;
+ ACPI_NAMESPACE_NODE *PciDeviceNode;
ACPI_OPERAND_OBJECT *RegionObj = (ACPI_OPERAND_OBJECT *) Handle;
- ACPI_DEVICE_ID ObjectHID;
- ACPI_FUNCTION_TRACE ("EvPciConfigRegionSetup");
+ ACPI_FUNCTION_TRACE (EvPciConfigRegionSetup);
HandlerObj = RegionObj->Region.Handler;
@@ -274,7 +293,7 @@
{
if (PciId)
{
- ACPI_MEM_FREE (PciId);
+ ACPI_FREE (PciId);
}
return_ACPI_STATUS (Status);
}
@@ -301,39 +320,35 @@
PciRootNode = ParentNode;
while (PciRootNode != AcpiGbl_RootNode)
{
- Status = AcpiUtExecute_HID (PciRootNode, &ObjectHID);
- if (ACPI_SUCCESS (Status))
+ /* Get the _HID/_CID in order to detect a RootBridge */
+
+ if (AcpiEvIsPciRootBridge (PciRootNode))
{
- /* Got a valid _HID, check if this is a PCI root */
+ /* Install a handler for this PCI root bridge */
- if (!(ACPI_STRNCMP (ObjectHID.Value, PCI_ROOT_HID_STRING,
- sizeof (PCI_ROOT_HID_STRING))))
+ Status = AcpiInstallAddressSpaceHandler (
+ (ACPI_HANDLE) PciRootNode,
+ ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
+ if (ACPI_FAILURE (Status))
{
- /* Install a handler for this PCI root bridge */
-
- Status = AcpiInstallAddressSpaceHandler ((ACPI_HANDLE) PciRootNode,
- ACPI_ADR_SPACE_PCI_CONFIG,
- ACPI_DEFAULT_HANDLER, NULL, NULL);
- if (ACPI_FAILURE (Status))
+ if (Status == AE_SAME_HANDLER)
{
- if (Status == AE_SAME_HANDLER)
- {
- /*
- * It is OK if the handler is already installed on the root
- * bridge. Still need to return a context object for the
- * new PCI_Config operation region, however.
- */
- Status = AE_OK;
- }
- else
- {
- ACPI_REPORT_ERROR ((
- "Could not install PciConfig handler for Root Bridge %4.4s, %s\n",
- AcpiUtGetNodeName (PciRootNode), AcpiFormatException (Status)));
- }
+ /*
+ * It is OK if the handler is already installed on the root
+ * bridge. Still need to return a context object for the
+ * new PCI_Config operation region, however.
+ */
+ Status = AE_OK;
+ }
+ else
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not install PciConfig handler for Root Bridge %4.4s",
+ AcpiUtGetNodeName (PciRootNode)));
}
- break;
}
+ break;
}
PciRootNode = AcpiNsGetParentNode (PciRootNode);
@@ -357,7 +372,7 @@
/* Region is still not initialized. Create a new context */
- PciId = ACPI_MEM_CALLOCATE (sizeof (ACPI_PCI_ID));
+ PciId = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_PCI_ID));
if (!PciId)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -366,13 +381,26 @@
/*
* For PCI_Config space access, we need the segment, bus,
* device and function numbers. Acquire them here.
+ *
+ * Find the parent device object. (This allows the operation region to be
+ * within a subscope under the device, such as a control method.)
*/
+ PciDeviceNode = RegionObj->Region.Node;
+ while (PciDeviceNode && (PciDeviceNode->Type != ACPI_TYPE_DEVICE))
+ {
+ PciDeviceNode = AcpiNsGetParentNode (PciDeviceNode);
+ }
+
+ if (!PciDeviceNode)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
/*
* Get the PCI device and function numbers from the _ADR object
* contained in the parent's scope.
*/
- Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, ParentNode, &PciValue);
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, PciDeviceNode, &PciValue);
/*
* The default is zero, and since the allocation above zeroed
@@ -411,6 +439,105 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiEvMatchPciRootBridge
+ *
+ * PARAMETERS: Id - The HID/CID in string format
+ *
+ * RETURN: TRUE if the Id is a match for a PCI/PCI-Express Root Bridge
+ *
+ * DESCRIPTION: Determine if the input ID is a PCI Root Bridge ID.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiEvMatchPciRootBridge (
+ char *Id)
+{
+
+ /*
+ * Check if this is a PCI root.
+ * ACPI 3.0+: check for a PCI Express root also.
+ */
+ if (!(ACPI_STRNCMP (Id,
+ PCI_ROOT_HID_STRING,
+ sizeof (PCI_ROOT_HID_STRING))) ||
+
+ !(ACPI_STRNCMP (Id,
+ PCI_EXPRESS_ROOT_HID_STRING,
+ sizeof (PCI_EXPRESS_ROOT_HID_STRING))))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvIsPciRootBridge
+ *
+ * PARAMETERS: Node - Device node being examined
+ *
+ * RETURN: TRUE if device is a PCI/PCI-Express Root Bridge
+ *
+ * DESCRIPTION: Determine if the input device represents a PCI Root Bridge by
+ * examining the _HID and _CID for the device.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AcpiEvIsPciRootBridge (
+ ACPI_NAMESPACE_NODE *Node)
+{
+ ACPI_STATUS Status;
+ ACPI_DEVICE_ID Hid;
+ ACPI_COMPATIBLE_ID_LIST *Cid;
+ ACPI_NATIVE_UINT i;
+
+
+ /*
+ * Get the _HID and check for a PCI Root Bridge
+ */
+ Status = AcpiUtExecute_HID (Node, &Hid);
+ if (ACPI_FAILURE (Status))
+ {
+ return (FALSE);
+ }
+
+ if (AcpiEvMatchPciRootBridge (Hid.Value))
+ {
+ return (TRUE);
+ }
+
+ /*
+ * The _HID did not match.
+ * Get the _CID and check for a PCI Root Bridge
+ */
+ Status = AcpiUtExecute_CID (Node, &Cid);
+ if (ACPI_FAILURE (Status))
+ {
+ return (FALSE);
+ }
+
+ /* Check all _CIDs in the returned list */
+
+ for (i = 0; i < Cid->Count; i++)
+ {
+ if (AcpiEvMatchPciRootBridge (Cid->Id[i].Value))
+ {
+ ACPI_FREE (Cid);
+ return (TRUE);
+ }
+ }
+
+ ACPI_FREE (Cid);
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvPciBarRegionSetup
*
* PARAMETERS: Handle - Region we are interested in
@@ -420,7 +547,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Do any prep work for region handling
+ * DESCRIPTION: Setup a PciBAR operation region
*
* MUTEX: Assumes namespace is not locked
*
@@ -433,7 +560,7 @@
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvPciBarRegionSetup");
+ ACPI_FUNCTION_TRACE (EvPciBarRegionSetup);
return_ACPI_STATUS (AE_OK);
@@ -451,7 +578,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Do any prep work for region handling
+ * DESCRIPTION: Setup a CMOS operation region
*
* MUTEX: Assumes namespace is not locked
*
@@ -464,7 +591,7 @@
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvCmosRegionSetup");
+ ACPI_FUNCTION_TRACE (EvCmosRegionSetup);
return_ACPI_STATUS (AE_OK);
@@ -482,7 +609,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Do any prep work for region handling
+ * DESCRIPTION: Default region initialization
*
******************************************************************************/
@@ -493,7 +620,7 @@
void *HandlerContext,
void **RegionContext)
{
- ACPI_FUNCTION_TRACE ("EvDefaultRegionSetup");
+ ACPI_FUNCTION_TRACE (EvDefaultRegionSetup);
if (Function == ACPI_REGION_DEACTIVATE)
@@ -529,6 +656,9 @@
* a PCI address in the scope of the definition. This address is
* required to perform an access to PCI config space.
*
+ * MUTEX: Interpreter should be unlocked, because we may run the _REG
+ * method for this region.
+ *
******************************************************************************/
ACPI_STATUS
@@ -546,7 +676,7 @@
ACPI_OPERAND_OBJECT *RegionObj2;
- ACPI_FUNCTION_TRACE_U32 ("EvInitializeRegion", AcpiNsLocked);
+ ACPI_FUNCTION_TRACE_U32 (EvInitializeRegion, AcpiNsLocked);
if (!RegionObj)
@@ -577,8 +707,8 @@
/* Find any "_REG" method associated with this region definition */
- Status = AcpiNsSearchNode (*RegNamePtr, Node,
- ACPI_TYPE_METHOD, &MethodNode);
+ Status = AcpiNsSearchOneScope (
+ *RegNamePtr, Node, ACPI_TYPE_METHOD, &MethodNode);
if (ACPI_SUCCESS (Status))
{
/*
Index: utobject.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utobject.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utobject.c -L sys/contrib/dev/acpica/utobject.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utobject.c
+++ sys/contrib/dev/acpica/utobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utobject - ACPI object create/delete/size/cache routines
- * $Revision: 90 $
+ * $Revision: 1.104 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,25 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utobject")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiUtGetSimpleObjectSize (
+ ACPI_OPERAND_OBJECT *Obj,
+ ACPI_SIZE *ObjLength);
+
+static ACPI_STATUS
+AcpiUtGetPackageObjectSize (
+ ACPI_OPERAND_OBJECT *Obj,
+ ACPI_SIZE *ObjLength);
+
+static ACPI_STATUS
+AcpiUtGetElementLength (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context);
+
/*******************************************************************************
*
@@ -134,7 +153,7 @@
* ComponentId - Component type of caller
* Type - ACPI Type of the new object
*
- * RETURN: Object - The new object. Null on failure
+ * RETURN: A new internal object, null on failure
*
* DESCRIPTION: Create and initialize a new internal object.
*
@@ -157,7 +176,8 @@
ACPI_OPERAND_OBJECT *SecondObject;
- ACPI_FUNCTION_TRACE_STR ("UtCreateInternalObjectDbg", AcpiUtGetTypeName (Type));
+ ACPI_FUNCTION_TRACE_STR (UtCreateInternalObjectDbg,
+ AcpiUtGetTypeName (Type));
/* Allocate the raw object descriptor */
@@ -175,7 +195,8 @@
/* These types require a secondary object */
- SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName, LineNumber, ComponentId);
+ SecondObject = AcpiUtAllocateObjectDescDbg (ModuleName,
+ LineNumber, ComponentId);
if (!SecondObject)
{
AcpiUtDeleteObjectDesc (Object);
@@ -215,7 +236,7 @@
*
* PARAMETERS: BufferSize - Size of buffer to be created
*
- * RETURN: Pointer to a new Buffer object
+ * RETURN: Pointer to a new Buffer object, null on failure
*
* DESCRIPTION: Create a fully initialized buffer object
*
@@ -229,7 +250,7 @@
UINT8 *Buffer = NULL;
- ACPI_FUNCTION_TRACE_U32 ("UtCreateBufferObject", BufferSize);
+ ACPI_FUNCTION_TRACE_U32 (UtCreateBufferObject, BufferSize);
/* Create a new Buffer object */
@@ -246,10 +267,10 @@
{
/* Allocate the actual buffer */
- Buffer = ACPI_MEM_CALLOCATE (BufferSize);
+ Buffer = ACPI_ALLOCATE_ZEROED (BufferSize);
if (!Buffer)
{
- ACPI_REPORT_ERROR (("CreateBuffer: could not allocate size %X\n",
+ ACPI_ERROR ((AE_INFO, "Could not allocate size %X",
(UINT32) BufferSize));
AcpiUtRemoveReference (BufferDesc);
return_PTR (NULL);
@@ -272,9 +293,9 @@
*
* FUNCTION: AcpiUtCreateStringObject
*
- * PARAMETERS: StringSize - Size of string to be created. Does not
- * include NULL terminator, this is added
- * automatically.
+ * PARAMETERS: StringSize - Size of string to be created. Does not
+ * include NULL terminator, this is added
+ * automatically.
*
* RETURN: Pointer to a new String object
*
@@ -290,7 +311,7 @@
char *String;
- ACPI_FUNCTION_TRACE_U32 ("UtCreateStringObject", StringSize);
+ ACPI_FUNCTION_TRACE_U32 (UtCreateStringObject, StringSize);
/* Create a new String object */
@@ -305,10 +326,10 @@
* Allocate the actual string buffer -- (Size + 1) for NULL terminator.
* NOTE: Zero-length strings are NULL terminated
*/
- String = ACPI_MEM_CALLOCATE (StringSize + 1);
+ String = ACPI_ALLOCATE_ZEROED (StringSize + 1);
if (!String)
{
- ACPI_REPORT_ERROR (("CreateString: could not allocate size %X\n",
+ ACPI_ERROR ((AE_INFO, "Could not allocate size %X",
(UINT32) StringSize));
AcpiUtRemoveReference (StringDesc);
return_PTR (NULL);
@@ -331,7 +352,9 @@
*
* PARAMETERS: Object - Object to be validated
*
- * RETURN: Validate a pointer to be an ACPI_OPERAND_OBJECT
+ * RETURN: TRUE if object is valid, FALSE otherwise
+ *
+ * DESCRIPTION: Validate a pointer to be an ACPI_OPERAND_OBJECT
*
******************************************************************************/
@@ -340,7 +363,7 @@
void *Object)
{
- ACPI_FUNCTION_NAME ("UtValidInternalObject");
+ ACPI_FUNCTION_NAME (UtValidInternalObject);
/* Check for a null pointer */
@@ -396,14 +419,14 @@
ACPI_OPERAND_OBJECT *Object;
- ACPI_FUNCTION_TRACE ("UtAllocateObjectDescDbg");
+ ACPI_FUNCTION_TRACE (UtAllocateObjectDescDbg);
- Object = AcpiUtAcquireFromCache (ACPI_MEM_LIST_OPERAND);
+ Object = AcpiOsAcquireObject (AcpiGbl_OperandCache);
if (!Object)
{
- _ACPI_REPORT_ERROR (ModuleName, LineNumber, ComponentId,
- ("Could not allocate an object descriptor\n"));
+ ACPI_ERROR ((ModuleName, LineNumber,
+ "Could not allocate an object descriptor"));
return_PTR (NULL);
}
@@ -435,46 +458,20 @@
AcpiUtDeleteObjectDesc (
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR ("UtDeleteObjectDesc", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtDeleteObjectDesc, Object);
/* Object must be an ACPI_OPERAND_OBJECT */
if (ACPI_GET_DESCRIPTOR_TYPE (Object) != ACPI_DESC_TYPE_OPERAND)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%p is not an ACPI Operand object [%s]\n", Object,
- AcpiUtGetDescriptorName (Object)));
+ ACPI_ERROR ((AE_INFO,
+ "%p is not an ACPI Operand object [%s]", Object,
+ AcpiUtGetDescriptorName (Object)));
return_VOID;
}
- AcpiUtReleaseToCache (ACPI_MEM_LIST_OPERAND, Object);
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteObjectCache
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-AcpiUtDeleteObjectCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("UtDeleteObjectCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_OPERAND);
+ (void) AcpiOsReleaseObject (AcpiGbl_OperandCache, Object);
return_VOID;
}
@@ -483,8 +480,8 @@
*
* FUNCTION: AcpiUtGetSimpleObjectSize
*
- * PARAMETERS: *InternalObject - Pointer to the object we are examining
- * *ObjLength - Where the length is returned
+ * PARAMETERS: InternalObject - An ACPI operand object
+ * ObjLength - Where the length is returned
*
* RETURN: Status
*
@@ -496,7 +493,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtGetSimpleObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_SIZE *ObjLength)
@@ -505,11 +502,13 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("UtGetSimpleObjectSize", InternalObject);
-
+ ACPI_FUNCTION_TRACE_PTR (UtGetSimpleObjectSize, InternalObject);
- /* Handle a null object (Could be a uninitialized package element -- which is legal) */
+ /*
+ * Handle a null object (Could be a uninitialized package
+ * element -- which is legal)
+ */
if (!InternalObject)
{
*ObjLength = 0;
@@ -568,7 +567,8 @@
* Get the actual length of the full pathname to this object.
* The reference will be converted to the pathname to the object
*/
- Length += ACPI_ROUND_UP_TO_NATIVE_WORD (AcpiNsGetPathnameLength (InternalObject->Reference.Node));
+ Length += ACPI_ROUND_UP_TO_NATIVE_WORD (
+ AcpiNsGetPathnameLength (InternalObject->Reference.Node));
break;
default:
@@ -578,8 +578,8 @@
* Notably, Locals and Args are not supported, but this may be
* required eventually.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported Reference opcode=%X in object %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unsupported Reference opcode=%X in object %p",
InternalObject->Reference.Opcode, InternalObject));
Status = AE_TYPE;
break;
@@ -589,7 +589,7 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported type=%X in object %p\n",
+ ACPI_ERROR ((AE_INFO, "Unsupported type=%X in object %p",
ACPI_GET_OBJECT_TYPE (InternalObject), InternalObject));
Status = AE_TYPE;
break;
@@ -618,7 +618,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtGetElementLength (
UINT8 ObjectType,
ACPI_OPERAND_OBJECT *SourceObject,
@@ -672,8 +672,8 @@
*
* FUNCTION: AcpiUtGetPackageObjectSize
*
- * PARAMETERS: *InternalObject - Pointer to the object we are examining
- * *ObjLength - Where the length is returned
+ * PARAMETERS: InternalObject - An ACPI internal object
+ * ObjLength - Where the length is returned
*
* RETURN: Status
*
@@ -685,7 +685,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtGetPackageObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_SIZE *ObjLength)
@@ -694,7 +694,7 @@
ACPI_PKG_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("UtGetPackageObjectSize", InternalObject);
+ ACPI_FUNCTION_TRACE_PTR (UtGetPackageObjectSize, InternalObject);
Info.Length = 0;
@@ -727,8 +727,8 @@
*
* FUNCTION: AcpiUtGetObjectSize
*
- * PARAMETERS: *InternalObject - Pointer to the object we are examining
- * *ObjLength - Where the length will be returned
+ * PARAMETERS: InternalObject - An ACPI internal object
+ * ObjLength - Where the length will be returned
*
* RETURN: Status
*
@@ -738,7 +738,7 @@
******************************************************************************/
ACPI_STATUS
-AcpiUtGetObjectSize(
+AcpiUtGetObjectSize (
ACPI_OPERAND_OBJECT *InternalObject,
ACPI_SIZE *ObjLength)
{
Index: exoparg2.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exoparg2.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exoparg2.c -L sys/contrib/dev/acpica/exoparg2.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exoparg2.c
+++ sys/contrib/dev/acpica/exoparg2.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exoparg2 - AML execution - opcodes with 2 arguments
- * $Revision: 129 $
+ * $Revision: 1.143 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -176,7 +176,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_0R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_0R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -194,13 +194,13 @@
Value = (UINT32) Operand[1]->Integer.Value;
- /* Notifies allowed on this object? */
+ /* Are notifies allowed on this object? */
if (!AcpiEvIsNotifyObject (Node))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unexpected notify object type [%s]\n",
- AcpiUtGetTypeName (Node->Type)));
+ ACPI_ERROR ((AE_INFO,
+ "Unexpected notify object type [%s]",
+ AcpiUtGetTypeName (Node->Type)));
Status = AE_AML_OPERAND_TYPE;
break;
@@ -246,8 +246,8 @@
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_0R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
}
@@ -278,16 +278,17 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_2T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_2T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
- /*
- * Execute the opcode
- */
+ /* Execute the opcode */
+
switch (WalkState->Opcode)
{
- case AML_DIVIDE_OP: /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
+ case AML_DIVIDE_OP:
+
+ /* Divide (Dividend, Divisor, RemainderResult QuotientResult) */
ReturnDesc1 = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc1)
@@ -318,13 +319,12 @@
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_2T_1R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
-
/* Store the results to the target reference operands */
Status = AcpiExStore (ReturnDesc2, Operand[2], WalkState);
@@ -339,11 +339,6 @@
goto Cleanup;
}
- /* Return the remainder */
-
- WalkState->ResultObj = ReturnDesc1;
-
-
Cleanup:
/*
* Since the remainder is not returned indirectly, remove a reference to
@@ -358,6 +353,13 @@
AcpiUtRemoveReference (ReturnDesc1);
}
+ /* Save return object (the remainder) on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc1;
+ }
+
return_ACPI_STATUS (Status);
}
@@ -381,18 +383,17 @@
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
- UINT32 Index;
+ ACPI_INTEGER Index;
ACPI_STATUS Status = AE_OK;
ACPI_SIZE Length;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_1T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_1T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
- /*
- * Execute the opcode
- */
+ /* Execute the opcode */
+
if (WalkState->OpInfo->Flags & AML_MATH)
{
/* All simple math opcodes (add, etc.) */
@@ -410,10 +411,9 @@
goto StoreResultToTarget;
}
-
switch (WalkState->Opcode)
{
- case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
+ case AML_MOD_OP: /* Mod (Dividend, Divisor, RemainderResult (ACPI 2.0) */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
@@ -431,18 +431,19 @@
break;
- case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
+ case AML_CONCAT_OP: /* Concatenate (Data1, Data2, Result) */
Status = AcpiExDoConcatenate (Operand[0], Operand[1],
&ReturnDesc, WalkState);
break;
- case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
+ case AML_TO_STRING_OP: /* ToString (Buffer, Length, Result) (ACPI 2.0) */
/*
* Input object is guaranteed to be a buffer at this point (it may have
- * been converted.) Copy the raw buffer data to a new object of type String.
+ * been converted.) Copy the raw buffer data to a new object of
+ * type String.
*/
/*
@@ -460,11 +461,6 @@
(Operand[0]->Buffer.Pointer[Length]))
{
Length++;
- if (Length > ACPI_MAX_STRING_CONVERSION)
- {
- Status = AE_AML_STRING_LIMIT;
- goto Cleanup;
- }
}
/* Allocate a new string object */
@@ -476,14 +472,18 @@
goto Cleanup;
}
- /* Copy the raw buffer data with no transform. NULL terminated already. */
-
+ /*
+ * Copy the raw buffer data with no transform.
+ * (NULL terminated already)
+ */
ACPI_MEMCPY (ReturnDesc->String.Pointer,
Operand[0]->Buffer.Pointer, Length);
break;
- case AML_CONCAT_RES_OP: /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
+ case AML_CONCAT_RES_OP:
+
+ /* ConcatenateResTemplate (Buffer, Buffer, Result) (ACPI 2.0) */
Status = AcpiExConcatTemplate (Operand[0], Operand[1],
&ReturnDesc, WalkState);
@@ -501,49 +501,71 @@
goto Cleanup;
}
- Index = (UINT32) Operand[1]->Integer.Value;
+ /* Initialize the Index reference object */
+
+ Index = Operand[1]->Integer.Value;
+ ReturnDesc->Reference.Offset = (UINT32) Index;
+ ReturnDesc->Reference.Opcode = AML_INDEX_OP;
/*
- * At this point, the Source operand is a Package, Buffer, or String
+ * At this point, the Source operand is a String, Buffer, or Package.
+ * Verify that the index is within range.
*/
- if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_PACKAGE)
+ switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
{
- /* Object to be indexed is a Package */
+ case ACPI_TYPE_STRING:
- if (Index >= Operand[0]->Package.Count)
+ if (Index >= Operand[0]->String.Length)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index value (%X) beyond package end (%X)\n",
- Index, Operand[0]->Package.Count));
- Status = AE_AML_PACKAGE_LIMIT;
- goto Cleanup;
+ Status = AE_AML_STRING_LIMIT;
}
- ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
- ReturnDesc->Reference.Object = Operand[0];
- ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
- }
- else
- {
- /* Object to be indexed is a Buffer/String */
+ ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
+ break;
+
+ case ACPI_TYPE_BUFFER:
if (Index >= Operand[0]->Buffer.Length)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index value (%X) beyond end of buffer (%X)\n",
- Index, Operand[0]->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT;
- goto Cleanup;
}
ReturnDesc->Reference.TargetType = ACPI_TYPE_BUFFER_FIELD;
- ReturnDesc->Reference.Object = Operand[0];
+ break;
+
+ case ACPI_TYPE_PACKAGE:
+
+ if (Index >= Operand[0]->Package.Count)
+ {
+ Status = AE_AML_PACKAGE_LIMIT;
+ }
+
+ ReturnDesc->Reference.TargetType = ACPI_TYPE_PACKAGE;
+ ReturnDesc->Reference.Where = &Operand[0]->Package.Elements [Index];
+ break;
+
+ default:
+
+ Status = AE_AML_INTERNAL;
+ goto Cleanup;
}
- /* Complete the Index reference object */
+ /* Failure means that the Index was beyond the end of the object */
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Index (%X%8.8X) is beyond end of object",
+ ACPI_FORMAT_UINT64 (Index)));
+ goto Cleanup;
+ }
- ReturnDesc->Reference.Opcode = AML_INDEX_OP;
- ReturnDesc->Reference.Offset = Index;
+ /*
+ * Save the target object and add a reference to it for the life
+ * of the index
+ */
+ ReturnDesc->Reference.Object = Operand[0];
+ AcpiUtAddReference (Operand[0]);
/* Store the reference to the Target */
@@ -557,8 +579,8 @@
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_1T_1R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
}
@@ -592,6 +614,7 @@
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ReturnDesc);
+ WalkState->ResultObj = NULL;
}
return_ACPI_STATUS (Status);
@@ -620,7 +643,7 @@
BOOLEAN LogicalResult = FALSE;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_2A_0T_1R",
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_2A_0T_1R,
AcpiPsGetOpcodeName (WalkState->Opcode));
@@ -633,24 +656,26 @@
goto Cleanup;
}
- /*
- * Execute the Opcode
- */
- if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC) /* LogicalOp (Operand0, Operand1) */
+ /* Execute the Opcode */
+
+ if (WalkState->OpInfo->Flags & AML_LOGICAL_NUMERIC)
{
+ /* LogicalOp (Operand0, Operand1) */
+
Status = AcpiExDoLogicalNumericOp (WalkState->Opcode,
Operand[0]->Integer.Value, Operand[1]->Integer.Value,
&LogicalResult);
goto StoreLogicalResult;
}
- else if (WalkState->OpInfo->Flags & AML_LOGICAL) /* LogicalOp (Operand0, Operand1) */
+ else if (WalkState->OpInfo->Flags & AML_LOGICAL)
{
+ /* LogicalOp (Operand0, Operand1) */
+
Status = AcpiExDoLogicalOp (WalkState->Opcode, Operand[0],
Operand[1], &LogicalResult);
goto StoreLogicalResult;
}
-
switch (WalkState->Opcode)
{
case AML_ACQUIRE_OP: /* Acquire (MutexObject, Timeout) */
@@ -677,7 +702,7 @@
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_2A_0T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -694,9 +719,6 @@
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
}
- WalkState->ResultObj = ReturnDesc;
-
-
Cleanup:
/* Delete return object on error */
@@ -706,6 +728,13 @@
AcpiUtRemoveReference (ReturnDesc);
}
+ /* Save return object on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
Index: exmisc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exmisc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exmisc.c -L sys/contrib/dev/acpica/exmisc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exmisc.c
+++ sys/contrib/dev/acpica/exmisc.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmisc - ACPI AML (p-code) execution - specific opcodes
- * $Revision: 126 $
+ * $Revision: 1.144 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/amlresrc.h>
#define _COMPONENT ACPI_EXECUTER
@@ -152,7 +153,7 @@
ACPI_OPERAND_OBJECT *ReferencedObj;
- ACPI_FUNCTION_TRACE_PTR ("ExGetObjectReference", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExGetObjectReference, ObjDesc);
*ReturnDesc = NULL;
@@ -173,6 +174,7 @@
{
case AML_LOCAL_OP:
case AML_ARG_OP:
+ case AML_DEBUG_OP:
/* The referenced object is the pseudo-node for the local/arg */
@@ -181,7 +183,7 @@
default:
- ACPI_REPORT_ERROR (("Unknown Reference subtype in get ref %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown Reference opcode %X",
ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -199,8 +201,8 @@
default:
- ACPI_REPORT_ERROR (("Invalid descriptor type in get ref: %X\n",
- ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
+ ACPI_ERROR ((AE_INFO, "Invalid descriptor type %X",
+ ACPI_GET_DESCRIPTOR_TYPE (ObjDesc)));
return_ACPI_STATUS (AE_TYPE);
}
@@ -217,8 +219,9 @@
ReferenceObj->Reference.Object = ReferencedObj;
*ReturnDesc = ReferenceObj;
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p Type [%s], returning Reference %p\n",
- ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Object %p Type [%s], returning Reference %p\n",
+ ObjDesc, AcpiUtGetObjectTypeName (ObjDesc), *ReturnDesc));
return_ACPI_STATUS (AE_OK);
}
@@ -246,53 +249,70 @@
ACPI_OPERAND_OBJECT **ActualReturnDesc,
ACPI_WALK_STATE *WalkState)
{
+ ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ReturnDesc;
UINT8 *NewBuf;
- UINT8 *EndTag1;
- UINT8 *EndTag2;
+ UINT8 *EndTag;
+ ACPI_SIZE Length0;
ACPI_SIZE Length1;
- ACPI_SIZE Length2;
+ ACPI_SIZE NewLength;
+
+
+ ACPI_FUNCTION_TRACE (ExConcatTemplate);
+
+
+ /*
+ * Find the EndTag descriptor in each resource template.
+ * Note1: returned pointers point TO the EndTag, not past it.
+ * Note2: zero-length buffers are allowed; treated like one EndTag
+ */
+ /* Get the length of the first resource template */
- ACPI_FUNCTION_TRACE ("ExConcatTemplate");
+ Status = AcpiUtGetResourceEndTag (Operand0, &EndTag);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ Length0 = ACPI_PTR_DIFF (EndTag, Operand0->Buffer.Pointer);
- /* Find the EndTags in each resource template */
+ /* Get the length of the second resource template */
- EndTag1 = AcpiUtGetResourceEndTag (Operand0);
- EndTag2 = AcpiUtGetResourceEndTag (Operand1);
- if (!EndTag1 || !EndTag2)
+ Status = AcpiUtGetResourceEndTag (Operand1, &EndTag);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ return_ACPI_STATUS (Status);
}
- /* Compute the length of each part */
+ Length1 = ACPI_PTR_DIFF (EndTag, Operand1->Buffer.Pointer);
- Length1 = ACPI_PTR_DIFF (EndTag1, Operand0->Buffer.Pointer);
- Length2 = ACPI_PTR_DIFF (EndTag2, Operand1->Buffer.Pointer) +
- 2; /* Size of END_TAG */
+ /* Combine both lengths, minimum size will be 2 for EndTag */
- /* Create a new buffer object for the result */
+ NewLength = Length0 + Length1 + sizeof (AML_RESOURCE_END_TAG);
- ReturnDesc = AcpiUtCreateBufferObject (Length1 + Length2);
+ /* Create a new buffer object for the result (with one EndTag) */
+
+ ReturnDesc = AcpiUtCreateBufferObject (NewLength);
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Copy the templates to the new descriptor */
-
+ /*
+ * Copy the templates to the new buffer, 0 first, then 1 follows. One
+ * EndTag descriptor is copied from Operand1.
+ */
NewBuf = ReturnDesc->Buffer.Pointer;
- ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length1);
- ACPI_MEMCPY (NewBuf + Length1, Operand1->Buffer.Pointer, Length2);
+ ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer, Length0);
+ ACPI_MEMCPY (NewBuf + Length0, Operand1->Buffer.Pointer, Length1);
- /* Compute the new checksum */
+ /* Insert EndTag and set the checksum to zero, means "ignore checksum" */
- NewBuf[ReturnDesc->Buffer.Length - 1] =
- AcpiUtGenerateChecksum (ReturnDesc->Buffer.Pointer,
- (ReturnDesc->Buffer.Length - 1));
+ NewBuf[NewLength - 1] = 0;
+ NewBuf[NewLength - 2] = ACPI_RESOURCE_NAME_END_TAG | 1;
- /* Return the completed template descriptor */
+ /* Return the completed resource template */
*ActualReturnDesc = ReturnDesc;
return_ACPI_STATUS (AE_OK);
@@ -325,10 +345,9 @@
ACPI_OPERAND_OBJECT *ReturnDesc;
char *NewBuf;
ACPI_STATUS Status;
- ACPI_SIZE NewLength;
- ACPI_FUNCTION_TRACE ("ExDoConcatenate");
+ ACPI_FUNCTION_TRACE (ExDoConcatenate);
/*
@@ -354,8 +373,8 @@
break;
default:
- ACPI_REPORT_ERROR (("Concat - invalid obj type: %X\n",
- ACPI_GET_OBJECT_TYPE (Operand0)));
+ ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
+ ACPI_GET_OBJECT_TYPE (Operand0)));
Status = AE_AML_INTERNAL;
}
@@ -384,7 +403,7 @@
/* Result of two Integers is a Buffer */
/* Need enough buffer space for two integers */
- ReturnDesc = AcpiUtCreateBufferObject (
+ ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE)
ACPI_MUL_2 (AcpiGbl_IntegerByteWidth));
if (!ReturnDesc)
{
@@ -396,8 +415,7 @@
/* Copy the first integer, LSB first */
- ACPI_MEMCPY (NewBuf,
- &Operand0->Integer.Value,
+ ACPI_MEMCPY (NewBuf, &Operand0->Integer.Value,
AcpiGbl_IntegerByteWidth);
/* Copy the second integer (LSB first) after the first */
@@ -411,15 +429,9 @@
/* Result of two Strings is a String */
- NewLength = (ACPI_SIZE) Operand0->String.Length +
- (ACPI_SIZE) LocalOperand1->String.Length;
- if (NewLength > ACPI_MAX_STRING_CONVERSION)
- {
- Status = AE_AML_STRING_LIMIT;
- goto Cleanup;
- }
-
- ReturnDesc = AcpiUtCreateStringObject (NewLength);
+ ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE)
+ (Operand0->String.Length +
+ LocalOperand1->String.Length));
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@@ -430,8 +442,7 @@
/* Concatenate the strings */
- ACPI_STRCPY (NewBuf,
- Operand0->String.Pointer);
+ ACPI_STRCPY (NewBuf, Operand0->String.Pointer);
ACPI_STRCPY (NewBuf + Operand0->String.Length,
LocalOperand1->String.Pointer);
break;
@@ -440,9 +451,9 @@
/* Result of two Buffers is a Buffer */
- ReturnDesc = AcpiUtCreateBufferObject (
- (ACPI_SIZE) Operand0->Buffer.Length +
- (ACPI_SIZE) LocalOperand1->Buffer.Length);
+ ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE)
+ (Operand0->Buffer.Length +
+ LocalOperand1->Buffer.Length));
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@@ -453,8 +464,7 @@
/* Concatenate the buffers */
- ACPI_MEMCPY (NewBuf,
- Operand0->Buffer.Pointer,
+ ACPI_MEMCPY (NewBuf, Operand0->Buffer.Pointer,
Operand0->Buffer.Length);
ACPI_MEMCPY (NewBuf + Operand0->Buffer.Length,
LocalOperand1->Buffer.Pointer,
@@ -465,8 +475,8 @@
/* Invalid object type, should not happen here */
- ACPI_REPORT_ERROR (("Concatenate - Invalid object type: %X\n",
- ACPI_GET_OBJECT_TYPE (Operand0)));
+ ACPI_ERROR ((AE_INFO, "Invalid object type: %X",
+ ACPI_GET_OBJECT_TYPE (Operand0)));
Status =AE_AML_INTERNAL;
goto Cleanup;
}
@@ -478,7 +488,7 @@
{
AcpiUtRemoveReference (LocalOperand1);
}
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
@@ -545,13 +555,29 @@
return (Integer0 * Integer1);
- case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result) */
+ case AML_SHIFT_LEFT_OP: /* ShiftLeft (Operand, ShiftCount, Result)*/
+ /*
+ * We need to check if the shiftcount is larger than the integer bit
+ * width since the behavior of this is not well-defined in the C language.
+ */
+ if (Integer1 >= AcpiGbl_IntegerBitWidth)
+ {
+ return (0);
+ }
return (Integer0 << Integer1);
case AML_SHIFT_RIGHT_OP: /* ShiftRight (Operand, ShiftCount, Result) */
+ /*
+ * We need to check if the shiftcount is larger than the integer bit
+ * width since the behavior of this is not well-defined in the C language.
+ */
+ if (Integer1 >= AcpiGbl_IntegerBitWidth)
+ {
+ return (0);
+ }
return (Integer0 >> Integer1);
@@ -597,7 +623,7 @@
BOOLEAN LocalResult = FALSE;
- ACPI_FUNCTION_TRACE ("ExDoLogicalNumericOp");
+ ACPI_FUNCTION_TRACE (ExDoLogicalNumericOp);
switch (Opcode)
@@ -673,7 +699,7 @@
int Compare;
- ACPI_FUNCTION_TRACE ("ExDoLogicalOp");
+ ACPI_FUNCTION_TRACE (ExDoLogicalOp);
/*
@@ -764,8 +790,8 @@
/* Lexicographic compare: compare the data bytes */
- Compare = ACPI_MEMCMP ((const char * ) Operand0->Buffer.Pointer,
- (const char * ) LocalOperand1->Buffer.Pointer,
+ Compare = ACPI_MEMCMP (Operand0->Buffer.Pointer,
+ LocalOperand1->Buffer.Pointer,
(Length0 > Length1) ? Length1 : Length0);
switch (Opcode)
Index: dbfileio.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbfileio.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbfileio.c -L sys/contrib/dev/acpica/dbfileio.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbfileio.c
+++ sys/contrib/dev/acpica/dbfileio.c
@@ -2,7 +2,7 @@
*
* Module Name: dbfileio - Debugger file I/O commands. These can't usually
* be used when running the debugger in Ring 0 (Kernel mode)
- * $Revision: 76 $
+ * $Revision: 1.94 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,13 +120,13 @@
#include <contrib/dev/acpica/acdebug.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/actables.h>
+#include <contrib/dev/acpica/acdisasm.h>
#if (defined ACPI_DEBUGGER || defined ACPI_DISASSEMBLER)
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbfileio")
-
/*
* NOTE: this is here for lack of a better place. It is used in all
* flavors of the debugger, need LCD file
@@ -138,13 +138,29 @@
#ifdef ACPI_DEBUGGER
+
+/* Local prototypes */
+
+#ifdef ACPI_APPLICATION
+
+static ACPI_STATUS
+AcpiDbCheckTextModeCorruption (
+ UINT8 *Table,
+ UINT32 TableLength,
+ UINT32 FileLength);
+
+static ACPI_STATUS
+AeLocalLoadTable (
+ ACPI_TABLE_HEADER *TablePtr);
+#endif
+
/*******************************************************************************
*
* FUNCTION: AcpiDbCloseDebugFile
*
* PARAMETERS: None
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: If open, close the current debug output file
*
@@ -174,7 +190,7 @@
*
* PARAMETERS: Name - Filename to open
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Open a file where debug output will be directed.
*
@@ -206,7 +222,6 @@
#ifdef ACPI_APPLICATION
-
/*******************************************************************************
*
* FUNCTION: AcpiDbCheckTextModeCorruption
@@ -235,8 +250,9 @@
if (TableLength != FileLength)
{
- ACPI_REPORT_WARNING (("File length (0x%X) is not the same as the table length (0x%X)\n",
- FileLength, TableLength));
+ ACPI_WARNING ((AE_INFO,
+ "File length (0x%X) is not the same as the table length (0x%X)",
+ FileLength, TableLength));
}
/* Scan entire table to determine if each LF has been prefixed with a CR */
@@ -247,7 +263,7 @@
{
if (Table[i - 1] != 0x0D)
{
- /* the LF does not have a preceeding CR, table is not corrupted */
+ /* The LF does not have a preceeding CR, table not corrupted */
return (AE_OK);
}
@@ -261,6 +277,11 @@
}
}
+ if (!Pairs)
+ {
+ return (AE_OK);
+ }
+
/*
* Entire table scanned, each CR is part of a CR/LF pair --
* meaning that the table was treated as a text file somewhere.
@@ -300,49 +321,95 @@
UINT32 Actual;
ACPI_STATUS Status;
UINT32 FileSize;
+ BOOLEAN StandardHeader = TRUE;
+ /* Get the file size */
+
fseek (fp, 0, SEEK_END);
- FileSize = ftell (fp);
+ FileSize = (UINT32) ftell (fp);
fseek (fp, 0, SEEK_SET);
- /* Read the table header */
-
- if (fread (&TableHeader, 1, sizeof (TableHeader), fp) != sizeof (ACPI_TABLE_HEADER))
+ if (FileSize < 4)
{
- AcpiOsPrintf ("Couldn't read the table header\n");
- return (AE_BAD_SIGNATURE);
+ return (AE_BAD_HEADER);
}
- /* Validate the table header/length */
+ /* Read the signature */
- Status = AcpiTbValidateTableHeader (&TableHeader);
- if ((ACPI_FAILURE (Status)) ||
- (TableHeader.Length > 0x800000)) /* 8 Mbyte should be enough */
+ if (fread (&TableHeader, 1, 4, fp) != 4)
{
- AcpiOsPrintf ("Table header is invalid!\n");
- return (AE_ERROR);
+ AcpiOsPrintf ("Could not read the table signature\n");
+ return (AE_BAD_HEADER);
}
- /* We only support a limited number of table types */
+ fseek (fp, 0, SEEK_SET);
+
+ /* The RSDT and FACS tables do not have standard ACPI headers */
- if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
- ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
- ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
+ if (ACPI_COMPARE_NAME (TableHeader.Signature, "RSD ") ||
+ ACPI_COMPARE_NAME (TableHeader.Signature, "FACS"))
{
- AcpiOsPrintf ("Table signature is invalid\n");
- ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_ERROR);
+ *TableLength = FileSize;
+ StandardHeader = FALSE;
+ }
+ else
+ {
+ /* Read the table header */
+
+ if (fread (&TableHeader, 1, sizeof (TableHeader), fp) !=
+ sizeof (ACPI_TABLE_HEADER))
+ {
+ AcpiOsPrintf ("Could not read the table header\n");
+ return (AE_BAD_HEADER);
+ }
+
+#if 0
+ /* Validate the table header/length */
+
+ Status = AcpiTbValidateTableHeader (&TableHeader);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Table header is invalid!\n");
+ return (Status);
+ }
+#endif
+
+ /* File size must be at least as long as the Header-specified length */
+
+ if (TableHeader.Length > FileSize)
+ {
+ AcpiOsPrintf (
+ "TableHeader length [0x%X] greater than the input file size [0x%X]\n",
+ TableHeader.Length, FileSize);
+ return (AE_BAD_HEADER);
+ }
+
+#ifdef ACPI_OBSOLETE_CODE
+ /* We only support a limited number of table types */
+
+ if (ACPI_STRNCMP ((char *) TableHeader.Signature, DSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, PSDT_SIG, 4) &&
+ ACPI_STRNCMP ((char *) TableHeader.Signature, SSDT_SIG, 4))
+ {
+ AcpiOsPrintf ("Table signature [%4.4s] is invalid or not supported\n",
+ (char *) TableHeader.Signature);
+ ACPI_DUMP_BUFFER (&TableHeader, sizeof (ACPI_TABLE_HEADER));
+ return (AE_ERROR);
+ }
+#endif
+
+ *TableLength = TableHeader.Length;
}
/* Allocate a buffer for the table */
- *TableLength = TableHeader.Length;
- *Table = AcpiOsAllocate ((size_t) (FileSize));
+ *Table = AcpiOsAllocate ((size_t) FileSize);
if (!*Table)
{
- AcpiOsPrintf ("Could not allocate memory for ACPI table %4.4s (size=%X)\n",
- TableHeader.Signature, TableHeader.Length);
+ AcpiOsPrintf (
+ "Could not allocate memory for ACPI table %4.4s (size=0x%X)\n",
+ TableHeader.Signature, *TableLength);
return (AE_NO_MEMORY);
}
@@ -352,15 +419,19 @@
Actual = fread (*Table, 1, (size_t) FileSize, fp);
if (Actual == FileSize)
{
- /* Now validate the checksum */
+ if (StandardHeader)
+ {
+ /* Now validate the checksum */
- Status = AcpiTbVerifyTableChecksum (*Table);
+ Status = AcpiTbChecksum ((void *) *Table,
+ ACPI_CAST_PTR (ACPI_TABLE_HEADER, *Table)->Length);
- if (Status == AE_BAD_CHECKSUM)
- {
- Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
- FileSize, (*Table)->Length);
- return (Status);
+ if (Status == AE_BAD_CHECKSUM)
+ {
+ Status = AcpiDbCheckTextModeCorruption ((UINT8 *) *Table,
+ FileSize, (*Table)->Length);
+ return (Status);
+ }
}
return (AE_OK);
}
@@ -379,7 +450,6 @@
return (AE_ERROR);
}
-#endif
/*******************************************************************************
@@ -398,15 +468,16 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AeLocalLoadTable (
ACPI_TABLE_HEADER *Table)
{
- ACPI_STATUS Status;
- ACPI_TABLE_DESC TableInfo;
+ ACPI_STATUS Status = AE_OK;
+/* ACPI_TABLE_DESC TableInfo; */
- ACPI_FUNCTION_TRACE ("AeLocalLoadTable");
+ ACPI_FUNCTION_TRACE (AeLocalLoadTable);
+#if 0
if (!Table)
@@ -426,6 +497,13 @@
Status = AcpiTbInstallTable (&TableInfo);
if (ACPI_FAILURE (Status))
{
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ /* Table already exists, no error */
+
+ Status = AE_OK;
+ }
+
/* Free table allocated by AcpiTbGetTable */
AcpiTbDeleteSingleTable (&TableInfo);
@@ -439,16 +517,16 @@
{
/* Uninstall table and free the buffer */
- AcpiTbDeleteTablesByType (ACPI_TABLE_DSDT);
+ AcpiTbDeleteTablesByType (ACPI_TABLE_ID_DSDT);
return_ACPI_STATUS (Status);
}
#endif
+#endif
return_ACPI_STATUS (Status);
}
-#ifdef ACPI_APPLICATION
/*******************************************************************************
*
* FUNCTION: AcpiDbReadTableFromFile
@@ -489,7 +567,7 @@
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Couldn't get table from the file\n");
+ AcpiOsPrintf ("Could not get table from the file\n");
return (Status);
}
@@ -502,8 +580,8 @@
*
* FUNCTION: AcpiDbGetTableFromFile
*
- * PARAMETERS: Filename - File where table is located
- * Table - Where a pointer to the table is returned
+ * PARAMETERS: Filename - File where table is located
+ * ReturnTable - Where a pointer to the table is returned
*
* RETURN: Status
*
@@ -519,6 +597,7 @@
#ifdef ACPI_APPLICATION
ACPI_STATUS Status;
ACPI_TABLE_HEADER *Table;
+ BOOLEAN IsAmlTable = TRUE;
Status = AcpiDbReadTableFromFile (Filename, &Table);
@@ -527,28 +606,36 @@
return (Status);
}
- /* Attempt to recognize and install the table */
+#ifdef ACPI_DATA_TABLE_DISASSEMBLY
+ IsAmlTable = AcpiUtIsAmlTable (Table);
+#endif
- Status = AeLocalLoadTable (Table);
- if (ACPI_FAILURE (Status))
+ if (IsAmlTable)
{
- if (Status == AE_ALREADY_EXISTS)
- {
- AcpiOsPrintf ("Table %4.4s is already installed\n",
- Table->Signature);
- }
- else
+ /* Attempt to recognize and install the table */
+
+ Status = AeLocalLoadTable (Table);
+ if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not install table, %s\n",
- AcpiFormatException (Status));
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ AcpiOsPrintf ("Table %4.4s is already installed\n",
+ Table->Signature);
+ }
+ else
+ {
+ AcpiOsPrintf ("Could not install table, %s\n",
+ AcpiFormatException (Status));
+ }
+
+ return (Status);
}
- return (Status);
+ fprintf (stderr,
+ "Acpi table [%4.4s] successfully installed and loaded\n",
+ Table->Signature);
}
- fprintf (stderr, "Acpi table [%4.4s] successfully installed and loaded\n",
- Table->Signature);
-
AcpiGbl_AcpiHardwarePresent = FALSE;
if (ReturnTable)
{
Index: exoparg1.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exoparg1.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exoparg1.c -L sys/contrib/dev/acpica/exoparg1.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exoparg1.c
+++ sys/contrib/dev/acpica/exoparg1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg1 - AML execution - opcodes with 1 argument
- * $Revision: 163 $
+ * $Revision: 1.184 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -171,7 +171,8 @@
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_0A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_0A_0T_1R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -188,13 +189,12 @@
Status = AE_NO_MEMORY;
goto Cleanup;
}
-
ReturnDesc->Integer.Value = AcpiOsGetTimer ();
break;
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_0A_0T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -202,16 +202,18 @@
Cleanup:
- if (!WalkState->ResultObj)
- {
- WalkState->ResultObj = ReturnDesc;
- }
-
/* Delete return object on error */
- if (ACPI_FAILURE (Status))
+ if ((ACPI_FAILURE (Status)) || WalkState->ResultObj)
{
AcpiUtRemoveReference (ReturnDesc);
+ WalkState->ResultObj = NULL;
+ }
+ else
+ {
+ /* Save the return value */
+
+ WalkState->ResultObj = ReturnDesc;
}
return_ACPI_STATUS (Status);
@@ -239,7 +241,8 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_0R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -284,7 +287,7 @@
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_0R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
break;
@@ -315,7 +318,8 @@
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_0R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -329,7 +333,7 @@
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_0R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -369,7 +373,8 @@
ACPI_INTEGER Digit;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_1T_1R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -418,7 +423,7 @@
break;
- case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
+ case AML_FIND_SET_RIGHT_BIT_OP: /* FindSetRightBit (Operand, Result) */
ReturnDesc->Integer.Value = Operand[0]->Integer.Value;
@@ -434,8 +439,8 @@
/* Since the bit position is one-based, subtract from 33 (65) */
- ReturnDesc->Integer.Value = Temp32 == 0 ? 0 :
- (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
+ ReturnDesc->Integer.Value =
+ Temp32 == 0 ? 0 : (ACPI_INTEGER_BIT_SIZE + 1) - Temp32;
break;
@@ -462,8 +467,8 @@
if (Temp32 > 9)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "BCD digit too large (not decimal): 0x%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "BCD digit too large (not decimal): 0x%X",
Temp32));
Status = AE_AML_NUMERIC_OVERFLOW;
@@ -472,8 +477,8 @@
/* Sum the digit into the result with the current power of 10 */
- ReturnDesc->Integer.Value += (((ACPI_INTEGER) Temp32) *
- PowerOfTen);
+ ReturnDesc->Integer.Value +=
+ (((ACPI_INTEGER) Temp32) * PowerOfTen);
/* Shift to next BCD digit */
@@ -497,18 +502,20 @@
{
(void) AcpiUtShortDivide (Digit, 10, &Digit, &Temp32);
- /* Insert the BCD digit that resides in the remainder from above */
-
- ReturnDesc->Integer.Value |= (((ACPI_INTEGER) Temp32) <<
- ACPI_MUL_4 (i));
+ /*
+ * Insert the BCD digit that resides in the
+ * remainder from above
+ */
+ ReturnDesc->Integer.Value |=
+ (((ACPI_INTEGER) Temp32) << ACPI_MUL_4 (i));
}
/* Overflow if there is any data left in Digit */
if (Digit > 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Integer too large to convert to BCD: %8.8X%8.8X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Integer too large to convert to BCD: %8.8X%8.8X",
ACPI_FORMAT_UINT64 (Operand[0]->Integer.Value)));
Status = AE_AML_NUMERIC_OVERFLOW;
goto Cleanup;
@@ -535,7 +542,8 @@
/* Get the object reference, store it, and remove our reference */
- Status = AcpiExGetObjectReference (Operand[0], &ReturnDesc2, WalkState);
+ Status = AcpiExGetObjectReference (Operand[0],
+ &ReturnDesc2, WalkState);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -575,10 +583,10 @@
if (!WalkState->ResultObj)
{
/*
- * Normally, we would remove a reference on the Operand[0] parameter;
- * But since it is being used as the internal return object
- * (meaning we would normally increment it), the two cancel out,
- * and we simply don't do anything.
+ * Normally, we would remove a reference on the Operand[0]
+ * parameter; But since it is being used as the internal return
+ * object (meaning we would normally increment it), the two
+ * cancel out, and we simply don't do anything.
*/
WalkState->ResultObj = Operand[0];
WalkState->Operands[0] = NULL; /* Prevent deletion */
@@ -600,6 +608,11 @@
Status = AcpiExConvertToString (Operand[0], &ReturnDesc,
ACPI_EXPLICIT_CONVERT_DECIMAL);
+ if (ReturnDesc == Operand[0])
+ {
+ /* No conversion performed, add ref to handle return value */
+ AcpiUtAddReference (ReturnDesc);
+ }
break;
@@ -607,12 +620,22 @@
Status = AcpiExConvertToString (Operand[0], &ReturnDesc,
ACPI_EXPLICIT_CONVERT_HEX);
+ if (ReturnDesc == Operand[0])
+ {
+ /* No conversion performed, add ref to handle return value */
+ AcpiUtAddReference (ReturnDesc);
+ }
break;
case AML_TO_BUFFER_OP: /* ToBuffer (Data, Result) */
Status = AcpiExConvertToBuffer (Operand[0], &ReturnDesc);
+ if (ReturnDesc == Operand[0])
+ {
+ /* No conversion performed, add ref to handle return value */
+ AcpiUtAddReference (ReturnDesc);
+ }
break;
@@ -620,17 +643,21 @@
Status = AcpiExConvertToInteger (Operand[0], &ReturnDesc,
ACPI_ANY_BASE);
+ if (ReturnDesc == Operand[0])
+ {
+ /* No conversion performed, add ref to handle return value */
+ AcpiUtAddReference (ReturnDesc);
+ }
break;
case AML_SHIFT_LEFT_BIT_OP: /* ShiftLeftBit (Source, BitNum) */
case AML_SHIFT_RIGHT_BIT_OP: /* ShiftRightBit (Source, BitNum) */
- /*
- * These are two obsolete opcodes
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%s is obsolete and not implemented\n",
+ /* These are two obsolete opcodes */
+
+ ACPI_ERROR ((AE_INFO,
+ "%s is obsolete and not implemented",
AcpiPsGetOpcodeName (WalkState->Opcode)));
Status = AE_SUPPORT;
goto Cleanup;
@@ -638,24 +665,21 @@
default: /* Unknown opcode */
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_1T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
- /*
- * Store the return value computed above into the target object
- */
- Status = AcpiExStore (ReturnDesc, Operand[1], WalkState);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Store the return value computed above into the target object */
+ Status = AcpiExStore (ReturnDesc, Operand[1], WalkState);
+ }
-Cleanup:
- if (!WalkState->ResultObj)
- {
- WalkState->ResultObj = ReturnDesc;
- }
+Cleanup:
/* Delete return object on error */
@@ -664,6 +688,13 @@
AcpiUtRemoveReference (ReturnDesc);
}
+ /* Save return object on success */
+
+ else if (!WalkState->ResultObj)
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
@@ -692,7 +723,8 @@
ACPI_INTEGER Value;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_1A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_1A_0T_1R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
/* Examine the AML opcode */
@@ -755,9 +787,9 @@
Status = AcpiExResolveOperands (AML_LNOT_OP, &TempDesc, WalkState);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s: bad operand(s) %s\n",
- AcpiPsGetOpcodeName (WalkState->Opcode),
- AcpiFormatException(Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While resolving operands for [%s]",
+ AcpiPsGetOpcodeName (WalkState->Opcode)));
goto Cleanup;
}
@@ -791,9 +823,9 @@
/*
* Note: The operand is not resolved at this point because we want to
- * get the associated object, not its value. For example, we don't want
- * to resolve a FieldUnit to its value, we want the actual FieldUnit
- * object.
+ * get the associated object, not its value. For example, we don't
+ * want to resolve a FieldUnit to its value, we want the actual
+ * FieldUnit object.
*/
/* Get the type of the base object */
@@ -803,6 +835,7 @@
{
goto Cleanup;
}
+
/* Allocate a descriptor to hold the type. */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
@@ -825,7 +858,8 @@
/* Get the base object */
- Status = AcpiExResolveMultiple (WalkState, Operand[0], &Type, &TempDesc);
+ Status = AcpiExResolveMultiple (WalkState,
+ Operand[0], &Type, &TempDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -859,8 +893,8 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "SizeOf - Operand is not Buf/Int/Str/Pkg - found type %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Operand is not Buf/Int/Str/Pkg - found type %s",
AcpiUtGetTypeName (Type)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -895,7 +929,24 @@
/* Check for a method local or argument, or standalone String */
- if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) == ACPI_DESC_TYPE_NAMED)
+ {
+ TempDesc = AcpiNsGetAttachedObject (
+ (ACPI_NAMESPACE_NODE *) Operand[0]);
+ if (TempDesc &&
+ ((ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_STRING) ||
+ (ACPI_GET_OBJECT_TYPE (TempDesc) == ACPI_TYPE_LOCAL_REFERENCE)))
+ {
+ Operand[0] = TempDesc;
+ AcpiUtAddReference (TempDesc);
+ }
+ else
+ {
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+ }
+ else
{
switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
{
@@ -912,8 +963,10 @@
/* Set Operand[0] to the value of the local/arg */
- Status = AcpiDsMethodDataGetValue (Operand[0]->Reference.Opcode,
- Operand[0]->Reference.Offset, WalkState, &TempDesc);
+ Status = AcpiDsMethodDataGetValue (
+ Operand[0]->Reference.Opcode,
+ Operand[0]->Reference.Offset,
+ WalkState, &TempDesc);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -943,32 +996,41 @@
}
break;
-
case ACPI_TYPE_STRING:
+ break;
+
+ default:
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+ }
+ if (ACPI_GET_DESCRIPTOR_TYPE (Operand[0]) != ACPI_DESC_TYPE_NAMED)
+ {
+ if (ACPI_GET_OBJECT_TYPE (Operand[0]) == ACPI_TYPE_STRING)
+ {
/*
- * This is a DerefOf (String). The string is a reference to a named ACPI object.
+ * This is a DerefOf (String). The string is a reference
+ * to a named ACPI object.
*
* 1) Find the owning Node
- * 2) Dereference the node to an actual object. Could be a Field, so we nee
- * to resolve the node to a value.
+ * 2) Dereference the node to an actual object. Could be a
+ * Field, so we need to resolve the node to a value.
*/
- Status = AcpiNsGetNodeByPath (Operand[0]->String.Pointer,
- WalkState->ScopeInfo->Scope.Node, ACPI_NS_SEARCH_PARENT,
- ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ReturnDesc));
+ Status = AcpiNsGetNode (WalkState->ScopeInfo->Scope.Node,
+ Operand[0]->String.Pointer,
+ ACPI_NS_SEARCH_PARENT,
+ ACPI_CAST_INDIRECT_PTR (
+ ACPI_NAMESPACE_NODE, &ReturnDesc));
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
Status = AcpiExResolveNodeToValue (
- ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ReturnDesc), WalkState);
- goto Cleanup;
-
-
- default:
-
- Status = AE_AML_OPERAND_TYPE;
+ ACPI_CAST_INDIRECT_PTR (
+ ACPI_NAMESPACE_NODE, &ReturnDesc),
+ WalkState);
goto Cleanup;
}
}
@@ -980,15 +1042,18 @@
/*
* This is a DerefOf (ObjectReference)
* Get the actual object from the Node (This is the dereference).
- * -- This case may only happen when a LocalX or ArgX is dereferenced above.
+ * This case may only happen when a LocalX or ArgX is
+ * dereferenced above.
*/
- ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) Operand[0]);
+ ReturnDesc = AcpiNsGetAttachedObject (
+ (ACPI_NAMESPACE_NODE *) Operand[0]);
+ AcpiUtAddReference (ReturnDesc);
}
else
{
/*
- * This must be a reference object produced by either the Index() or
- * RefOf() operator
+ * This must be a reference object produced by either the
+ * Index() or RefOf() operator
*/
switch (Operand[0]->Reference.Opcode)
{
@@ -1032,32 +1097,21 @@
case ACPI_TYPE_PACKAGE:
/*
- * Return the referenced element of the package. We must add
- * another reference to the referenced object, however.
+ * Return the referenced element of the package. We must
+ * add another reference to the referenced object, however.
*/
ReturnDesc = *(Operand[0]->Reference.Where);
- if (!ReturnDesc)
+ if (ReturnDesc)
{
- /*
- * We can't return a NULL dereferenced value. This is
- * an uninitialized package element and is thus a
- * severe error.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "NULL package element obj %p\n",
- Operand[0]));
- Status = AE_AML_UNINITIALIZED_ELEMENT;
- goto Cleanup;
+ AcpiUtAddReference (ReturnDesc);
}
-
- AcpiUtAddReference (ReturnDesc);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown Index TargetType %X in obj %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Index TargetType %X in obj %p",
Operand[0]->Reference.TargetType, Operand[0]));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -1069,10 +1123,11 @@
ReturnDesc = Operand[0]->Reference.Object;
- if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) == ACPI_DESC_TYPE_NAMED)
+ if (ACPI_GET_DESCRIPTOR_TYPE (ReturnDesc) ==
+ ACPI_DESC_TYPE_NAMED)
{
-
- ReturnDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ReturnDesc);
+ ReturnDesc = AcpiNsGetAttachedObject (
+ (ACPI_NAMESPACE_NODE *) ReturnDesc);
}
/* Add another reference to the object! */
@@ -1082,8 +1137,8 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown opcode in ref(%p) - %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown opcode in reference(%p) - %X",
Operand[0], Operand[0]->Reference.Opcode));
Status = AE_TYPE;
@@ -1095,7 +1150,7 @@
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_1A_0T_1R: Unknown opcode %X\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -1111,7 +1166,13 @@
AcpiUtRemoveReference (ReturnDesc);
}
- WalkState->ResultObj = ReturnDesc;
+ /* Save return object on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
Index: tbinstal.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/tbinstal.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/tbinstal.c -L sys/contrib/dev/acpica/tbinstal.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/tbinstal.c
+++ sys/contrib/dev/acpica/tbinstal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbinstal - ACPI table installation and removal
- * $Revision: 74 $
+ * $Revision: 1.91 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +118,7 @@
#define __TBINSTAL_C__
#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/actables.h>
@@ -125,113 +126,146 @@
ACPI_MODULE_NAME ("tbinstal")
-/*******************************************************************************
+/******************************************************************************
*
- * FUNCTION: AcpiTbMatchSignature
+ * FUNCTION: AcpiTbVerifyTable
*
- * PARAMETERS: Signature - Table signature to match
- * TableInfo - Return data
+ * PARAMETERS: TableDesc - table
*
* RETURN: Status
*
- * DESCRIPTION: Compare signature against the list of "ACPI-subsystem-owned"
- * tables (DSDT/FADT/SSDT, etc.) Returns the TableTypeID on match.
+ * DESCRIPTION: this function is called to verify and map table
*
- ******************************************************************************/
+ *****************************************************************************/
ACPI_STATUS
-AcpiTbMatchSignature (
- char *Signature,
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType)
+AcpiTbVerifyTable (
+ ACPI_TABLE_DESC *TableDesc)
{
- ACPI_NATIVE_UINT i;
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("TbMatchSignature");
+ ACPI_FUNCTION_TRACE (TbVerifyTable);
- /*
- * Search for a signature match among the known table types
- */
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ /* Map the table if necessary */
+
+ if (!TableDesc->Pointer)
{
- if (!(AcpiGbl_TableData[i].Flags & SearchType))
+ if ((TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK) ==
+ ACPI_TABLE_ORIGIN_MAPPED)
{
- continue;
+ TableDesc->Pointer = AcpiOsMapMemory (TableDesc->Address, TableDesc->Length);
}
- if (!ACPI_STRNCMP (Signature, AcpiGbl_TableData[i].Signature,
- AcpiGbl_TableData[i].SigLength))
+ if (!TableDesc->Pointer)
{
- /* Found a signature match, return index if requested */
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+ }
- if (TableInfo)
- {
- TableInfo->Type = (UINT8) i;
- }
+ /* FACS is the odd table, has no standard ACPI header and no checksum */
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Table [%4.4s] is an ACPI table consumed by the core subsystem\n",
- (char *) AcpiGbl_TableData[i].Signature));
+ if (!ACPI_COMPARE_NAME (&TableDesc->Signature, ACPI_SIG_FACS))
+ {
+ /* Always calculate checksum, ignore bad checksum if requested */
- return_ACPI_STATUS (AE_OK);
- }
+ Status = AcpiTbVerifyChecksum (TableDesc->Pointer, TableDesc->Length);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Table [%4.4s] is not an ACPI table consumed by the core subsystem - ignored\n",
- (char *) Signature));
-
- return_ACPI_STATUS (AE_TABLE_NOT_SUPPORTED);
+ return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbInstallTable
+ * FUNCTION: AcpiTbAddTable
*
- * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
+ * PARAMETERS: TableDesc - Table descriptor
+ * TableIndex - Where the table index is returned
*
* RETURN: Status
*
- * DESCRIPTION: Load and validate all tables other than the RSDT. The RSDT must
- * already be loaded and validated.
- * Install the table into the global data structs.
+ * DESCRIPTION: This function is called to add the ACPI table
*
******************************************************************************/
ACPI_STATUS
-AcpiTbInstallTable (
- ACPI_TABLE_DESC *TableInfo)
+AcpiTbAddTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT *TableIndex)
{
- ACPI_STATUS Status;
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT Length;
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("TbInstallTable");
+ ACPI_FUNCTION_TRACE (TbAddTable);
- /* Lock tables while installing */
- Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (Status))
+ if (!TableDesc->Pointer)
{
- ACPI_REPORT_ERROR (("Could not acquire table mutex for [%4.4s], %s\n",
- TableInfo->Pointer->Signature, AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
+ Status = AcpiTbVerifyTable (TableDesc);
+ if (ACPI_FAILURE (Status) || !TableDesc->Pointer)
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ /* The table must be either an SSDT or a PSDT */
+
+ if ((!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_PSDT)) &&
+ (!ACPI_COMPARE_NAME (TableDesc->Pointer->Signature, ACPI_SIG_SSDT)))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Table has invalid signature [%4.4s], must be SSDT or PSDT",
+ TableDesc->Pointer->Signature));
+ return_ACPI_STATUS (AE_BAD_SIGNATURE);
}
- /* Install the table into the global data structure */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+ /* Check if table is already registered */
- Status = AcpiTbInitTableDescriptor (TableInfo->Type, TableInfo);
+ for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
+ {
+ if (!AcpiGbl_RootTableList.Tables[i].Pointer)
+ {
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
+ if (ACPI_FAILURE (Status) || !AcpiGbl_RootTableList.Tables[i].Pointer)
+ {
+ continue;
+ }
+ }
+
+ Length = ACPI_MIN (TableDesc->Length,
+ AcpiGbl_RootTableList.Tables[i].Length);
+ if (ACPI_MEMCMP (TableDesc->Pointer,
+ AcpiGbl_RootTableList.Tables[i].Pointer, Length))
+ {
+ continue;
+ }
+
+ /* Table is already registered */
+
+ AcpiTbDeleteTable (TableDesc);
+ *TableIndex = i;
+ goto Release;
+ }
+
+ /*
+ * Add the table to the global table list
+ */
+ Status = AcpiTbStoreTable (TableDesc->Address, TableDesc->Pointer,
+ TableDesc->Length, TableDesc->Flags, TableIndex);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not install ACPI table [%4.4s], %s\n",
- TableInfo->Pointer->Signature, AcpiFormatException (Status)));
+ goto Release;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s located at %p\n",
- AcpiGbl_TableData[TableInfo->Type].Name, TableInfo->Pointer));
+ AcpiTbPrintTableHeader (TableDesc->Address, TableDesc->Pointer);
+Release:
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (Status);
}
@@ -239,419 +273,412 @@
/*******************************************************************************
*
- * FUNCTION: AcpiTbRecognizeTable
+ * FUNCTION: AcpiTbResizeRootTableList
*
- * PARAMETERS: TableInfo - Return value from AcpiTbGetTableBody
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Check a table signature for a match against known table types
- *
- * NOTE: All table pointers are validated as follows:
- * 1) Table pointer must point to valid physical memory
- * 2) Signature must be 4 ASCII chars, even if we don't recognize the
- * name
- * 3) Table must be readable for length specified in the header
- * 4) Table checksum must be valid (with the exception of the FACS
- * which has no checksum for some odd reason)
+ * DESCRIPTION: Expand the size of global table array
*
******************************************************************************/
ACPI_STATUS
-AcpiTbRecognizeTable (
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType)
+AcpiTbResizeRootTableList (
+ void)
{
- ACPI_TABLE_HEADER *TableHeader;
- ACPI_STATUS Status;
+ ACPI_TABLE_DESC *Tables;
- ACPI_FUNCTION_TRACE ("TbRecognizeTable");
+ ACPI_FUNCTION_TRACE (TbResizeRootTableList);
- /* Ensure that we have a valid table pointer */
+ /* AllowResize flag is a parameter to AcpiInitializeTables */
- TableHeader = (ACPI_TABLE_HEADER *) TableInfo->Pointer;
- if (!TableHeader)
+ if (!(AcpiGbl_RootTableList.Flags & ACPI_ROOT_ALLOW_RESIZE))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ ACPI_ERROR ((AE_INFO, "Resize of Root Table Array is not allowed"));
+ return_ACPI_STATUS (AE_SUPPORT);
}
- /*
- * We only "recognize" a limited number of ACPI tables -- namely, the
- * ones that are used by the subsystem (DSDT, FADT, etc.)
- *
- * An AE_TABLE_NOT_SUPPORTED means that the table was not recognized.
- * This can be any one of many valid ACPI tables, it just isn't one of
- * the tables that is consumed by the core subsystem
- */
- Status = AcpiTbMatchSignature (TableHeader->Signature, TableInfo, SearchType);
- if (ACPI_FAILURE (Status))
+ /* Increase the Table Array size */
+
+ Tables = ACPI_ALLOCATE_ZEROED (
+ (AcpiGbl_RootTableList.Size + ACPI_ROOT_TABLE_SIZE_INCREMENT)
+ * sizeof (ACPI_TABLE_DESC));
+ if (!Tables)
{
- return_ACPI_STATUS (Status);
+ ACPI_ERROR ((AE_INFO, "Could not allocate new root table array"));
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiTbValidateTableHeader (TableHeader);
- if (ACPI_FAILURE (Status))
+ /* Copy and free the previous table array */
+
+ if (AcpiGbl_RootTableList.Tables)
{
- return_ACPI_STATUS (Status);
- }
+ ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
+ AcpiGbl_RootTableList.Size * sizeof (ACPI_TABLE_DESC));
- /* Return the table type and length via the info struct */
+ if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
+ {
+ ACPI_FREE (AcpiGbl_RootTableList.Tables);
+ }
+ }
- TableInfo->Length = (ACPI_SIZE) TableHeader->Length;
+ AcpiGbl_RootTableList.Tables = Tables;
+ AcpiGbl_RootTableList.Size += ACPI_ROOT_TABLE_SIZE_INCREMENT;
+ AcpiGbl_RootTableList.Flags |= (UINT8) ACPI_ROOT_ORIGIN_ALLOCATED;
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbInitTableDescriptor
+ * FUNCTION: AcpiTbStoreTable
*
- * PARAMETERS: TableType - The type of the table
- * TableInfo - A table info struct
+ * PARAMETERS: Address - Table address
+ * Table - Table header
+ * Length - Table length
+ * Flags - flags
*
- * RETURN: None.
+ * RETURN: Status and table index.
*
- * DESCRIPTION: Install a table into the global data structs.
+ * DESCRIPTION: Add an ACPI table to the global table list
*
******************************************************************************/
ACPI_STATUS
-AcpiTbInitTableDescriptor (
- ACPI_TABLE_TYPE TableType,
- ACPI_TABLE_DESC *TableInfo)
+AcpiTbStoreTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ UINT8 Flags,
+ ACPI_NATIVE_UINT *TableIndex)
{
- ACPI_TABLE_LIST *ListHead;
- ACPI_TABLE_DESC *TableDesc;
-
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_U32 ("TbInitTableDescriptor", TableType);
+ /* Ensure that there is room for the table in the Root Table List */
- /* Allocate a descriptor for this table */
-
- TableDesc = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
- if (!TableDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /*
- * Install the table into the global data structure
- */
- ListHead = &AcpiGbl_TableLists[TableType];
-
- /*
- * Two major types of tables: 1) Only one instance is allowed. This
- * includes most ACPI tables such as the DSDT. 2) Multiple instances of
- * the table are allowed. This includes SSDT and PSDTs.
- */
- if (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags))
+ if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
{
- /*
- * Only one table allowed, and a table has alread been installed
- * at this location, so return an error.
- */
- if (ListHead->Next)
+ Status = AcpiTbResizeRootTableList();
+ if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (TableDesc);
- return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ return (Status);
}
-
- TableDesc->Next = ListHead->Next;
- ListHead->Next = TableDesc;
-
- if (TableDesc->Next)
- {
- TableDesc->Next->Prev = TableDesc;
- }
-
- ListHead->Count++;
}
- else
- {
- /*
- * Link the new table in to the list of tables of this type.
- * Insert at the end of the list, order IS IMPORTANT.
- *
- * TableDesc->Prev & Next are already NULL from calloc()
- */
- ListHead->Count++;
- if (!ListHead->Next)
- {
- ListHead->Next = TableDesc;
- }
- else
- {
- TableDesc->Next = ListHead->Next;
+ /* Initialize added table */
- while (TableDesc->Next->Next)
- {
- TableDesc->Next = TableDesc->Next->Next;
- }
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address = Address;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Pointer = Table;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Length = Length;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].OwnerId = 0;
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Flags = Flags;
+
+ ACPI_MOVE_32_TO_32 (
+ &(AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Signature),
+ Table->Signature);
+
+ *TableIndex = AcpiGbl_RootTableList.Count;
+ AcpiGbl_RootTableList.Count++;
+ return (Status);
+}
- TableDesc->Next->Next = TableDesc;
- TableDesc->Prev = TableDesc->Next;
- TableDesc->Next = NULL;
- }
- }
- /* Finish initialization of the table descriptor */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbDeleteTable
+ *
+ * PARAMETERS: TableIndex - Table index
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Delete one internal ACPI table
+ *
+ ******************************************************************************/
+
+void
+AcpiTbDeleteTable (
+ ACPI_TABLE_DESC *TableDesc)
+{
- TableDesc->Type = (UINT8) TableType;
- TableDesc->Pointer = TableInfo->Pointer;
- TableDesc->Length = TableInfo->Length;
- TableDesc->Allocation = TableInfo->Allocation;
- TableDesc->AmlStart = (UINT8 *) (TableDesc->Pointer + 1),
- TableDesc->AmlLength = (UINT32) (TableDesc->Length -
- (UINT32) sizeof (ACPI_TABLE_HEADER));
- TableDesc->TableId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_TABLE);
- TableDesc->LoadedIntoNamespace = FALSE;
+ /* Table must be mapped or allocated */
- /*
- * Set the appropriate global pointer (if there is one) to point to the
- * newly installed table
- */
- if (AcpiGbl_TableData[TableType].GlobalPtr)
+ if (!TableDesc->Pointer)
{
- *(AcpiGbl_TableData[TableType].GlobalPtr) = TableInfo->Pointer;
+ return;
}
- /* Return Data */
+ switch (TableDesc->Flags & ACPI_TABLE_ORIGIN_MASK)
+ {
+ case ACPI_TABLE_ORIGIN_MAPPED:
+ AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
+ break;
- TableInfo->TableId = TableDesc->TableId;
- TableInfo->InstalledDesc = TableDesc;
+ case ACPI_TABLE_ORIGIN_ALLOCATED:
+ ACPI_FREE (TableDesc->Pointer);
+ break;
- return_ACPI_STATUS (AE_OK);
+ default:
+ break;
+ }
+
+ TableDesc->Pointer = NULL;
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteAllTables
+ * FUNCTION: AcpiTbTerminate
*
- * PARAMETERS: None.
+ * PARAMETERS: None
*
- * RETURN: None.
+ * RETURN: None
*
* DESCRIPTION: Delete all internal ACPI tables
*
******************************************************************************/
void
-AcpiTbDeleteAllTables (void)
+AcpiTbTerminate (
+ void)
{
- ACPI_TABLE_TYPE Type;
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_TRACE (TbTerminate);
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+
+ /* Delete the individual tables */
+
+ for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
+ {
+ AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
+ }
+
/*
- * Free memory allocated for ACPI tables
- * Memory can either be mapped or allocated
+ * Delete the root table array if allocated locally. Array cannot be
+ * mapped, so we don't need to check for that flag.
*/
- for (Type = 0; Type < NUM_ACPI_TABLE_TYPES; Type++)
+ if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
{
- AcpiTbDeleteTablesByType (Type);
+ ACPI_FREE (AcpiGbl_RootTableList.Tables);
}
+
+ AcpiGbl_RootTableList.Tables = NULL;
+ AcpiGbl_RootTableList.Flags = 0;
+ AcpiGbl_RootTableList.Count = 0;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteTablesByType
+ * FUNCTION: AcpiTbDeleteNamespaceByOwner
*
- * PARAMETERS: Type - The table type to be deleted
+ * PARAMETERS: TableIndex - Table index
*
- * RETURN: None.
+ * RETURN: None
*
- * DESCRIPTION: Delete an internal ACPI table
- * Locks the ACPI table mutex
+ * DESCRIPTION: Delete all namespace objects created when this table was loaded.
*
******************************************************************************/
void
-AcpiTbDeleteTablesByType (
- ACPI_TABLE_TYPE Type)
+AcpiTbDeleteNamespaceByOwner (
+ ACPI_NATIVE_UINT TableIndex)
{
- ACPI_TABLE_DESC *TableDesc;
- UINT32 Count;
- UINT32 i;
-
+ ACPI_OWNER_ID OwnerId;
- ACPI_FUNCTION_TRACE_U32 ("TbDeleteTablesByType", Type);
-
- if (Type > ACPI_TABLE_MAX)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- return_VOID;
+ OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
}
-
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_TABLES)))
+ else
{
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return;
}
- /* Clear the appropriate "typed" global table pointer */
-
- switch (Type)
- {
- case ACPI_TABLE_RSDP:
- AcpiGbl_RSDP = NULL;
- break;
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ AcpiNsDeleteNamespaceByOwner (OwnerId);
+}
- case ACPI_TABLE_DSDT:
- AcpiGbl_DSDT = NULL;
- break;
- case ACPI_TABLE_FADT:
- AcpiGbl_FADT = NULL;
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbAllocateOwnerId
+ *
+ * PARAMETERS: TableIndex - Table index
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Allocates OwnerId in TableDesc
+ *
+ ******************************************************************************/
- case ACPI_TABLE_FACS:
- AcpiGbl_FACS = NULL;
- break;
+ACPI_STATUS
+AcpiTbAllocateOwnerId (
+ ACPI_NATIVE_UINT TableIndex)
+{
+ ACPI_STATUS Status = AE_BAD_PARAMETER;
- case ACPI_TABLE_XSDT:
- AcpiGbl_XSDT = NULL;
- break;
- case ACPI_TABLE_SSDT:
- case ACPI_TABLE_PSDT:
- default:
- break;
- }
+ ACPI_FUNCTION_TRACE (TbAllocateOwnerId);
- /*
- * Free the table
- * 1) Get the head of the list
- */
- TableDesc = AcpiGbl_TableLists[Type].Next;
- Count = AcpiGbl_TableLists[Type].Count;
- /*
- * 2) Walk the entire list, deleting both the allocated tables
- * and the table descriptors
- */
- for (i = 0; i < Count; i++)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- TableDesc = AcpiTbUninstallTable (TableDesc);
+ Status = AcpiUtAllocateOwnerId
+ (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_VOID;
+ return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbDeleteSingleTable
+ * FUNCTION: AcpiTbReleaseOwnerId
*
- * PARAMETERS: TableInfo - A table info struct
+ * PARAMETERS: TableIndex - Table index
*
- * RETURN: None.
+ * RETURN: Status
*
- * DESCRIPTION: Low-level free for a single ACPI table. Handles cases where
- * the table was allocated a buffer or was mapped.
+ * DESCRIPTION: Releases OwnerId in TableDesc
*
******************************************************************************/
-void
-AcpiTbDeleteSingleTable (
- ACPI_TABLE_DESC *TableDesc)
+ACPI_STATUS
+AcpiTbReleaseOwnerId (
+ ACPI_NATIVE_UINT TableIndex)
{
+ ACPI_STATUS Status = AE_BAD_PARAMETER;
- /* Must have a valid table descriptor and pointer */
- if ((!TableDesc) ||
- (!TableDesc->Pointer))
- {
- return;
- }
+ ACPI_FUNCTION_TRACE (TbReleaseOwnerId);
- /* Valid table, determine type of memory allocation */
- switch (TableDesc->Allocation)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- case ACPI_MEM_NOT_ALLOCATED:
- break;
-
- case ACPI_MEM_ALLOCATED:
-
- ACPI_MEM_FREE (TableDesc->Pointer);
- break;
-
- case ACPI_MEM_MAPPED:
-
- AcpiOsUnmapMemory (TableDesc->Pointer, TableDesc->Length);
- break;
-
- default:
- break;
+ AcpiUtReleaseOwnerId (&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
+ Status = AE_OK;
}
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbUninstallTable
+ * FUNCTION: AcpiTbGetOwnerId
*
- * PARAMETERS: TableInfo - A table info struct
+ * PARAMETERS: TableIndex - Table index
+ * OwnerId - Where the table OwnerId is returned
*
- * RETURN: Pointer to the next table in the list (of same type)
+ * RETURN: Status
*
- * DESCRIPTION: Free the memory associated with an internal ACPI table that
- * is either installed or has never been installed.
- * Table mutex should be locked.
+ * DESCRIPTION: returns OwnerId for the ACPI table
*
******************************************************************************/
-ACPI_TABLE_DESC *
-AcpiTbUninstallTable (
- ACPI_TABLE_DESC *TableDesc)
+ACPI_STATUS
+AcpiTbGetOwnerId (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_OWNER_ID *OwnerId)
{
- ACPI_TABLE_DESC *NextDesc;
+ ACPI_STATUS Status = AE_BAD_PARAMETER;
- ACPI_FUNCTION_TRACE_PTR ("TbUninstallTable", TableDesc);
+ ACPI_FUNCTION_TRACE (TbGetOwnerId);
- if (!TableDesc)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- return_PTR (NULL);
+ *OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
+ Status = AE_OK;
}
- /* Unlink the descriptor from the doubly linked list */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+}
- if (TableDesc->Prev)
- {
- TableDesc->Prev->Next = TableDesc->Next;
- }
- else
- {
- /* Is first on list, update list head */
- AcpiGbl_TableLists[TableDesc->Type].Next = TableDesc->Next;
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbIsTableLoaded
+ *
+ * PARAMETERS: TableIndex - Table index
+ *
+ * RETURN: Table Loaded Flag
+ *
+ ******************************************************************************/
- if (TableDesc->Next)
+BOOLEAN
+AcpiTbIsTableLoaded (
+ ACPI_NATIVE_UINT TableIndex)
+{
+ BOOLEAN IsLoaded = FALSE;
+
+
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
{
- TableDesc->Next->Prev = TableDesc->Prev;
+ IsLoaded = (BOOLEAN)
+ (AcpiGbl_RootTableList.Tables[TableIndex].Flags & ACPI_TABLE_IS_LOADED);
}
- /* Free the memory allocated for the table itself */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return (IsLoaded);
+}
- AcpiTbDeleteSingleTable (TableDesc);
- /* Free the table descriptor */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbSetTableLoadedFlag
+ *
+ * PARAMETERS: TableIndex - Table index
+ * IsLoaded - TRUE if table is loaded, FALSE otherwise
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Sets the table loaded flag to either TRUE or FALSE.
+ *
+ ******************************************************************************/
- NextDesc = TableDesc->Next;
- ACPI_MEM_FREE (TableDesc);
+void
+AcpiTbSetTableLoadedFlag (
+ ACPI_NATIVE_UINT TableIndex,
+ BOOLEAN IsLoaded)
+{
- /* Return pointer to the next descriptor */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ if (TableIndex < AcpiGbl_RootTableList.Count)
+ {
+ if (IsLoaded)
+ {
+ AcpiGbl_RootTableList.Tables[TableIndex].Flags |= ACPI_TABLE_IS_LOADED;
+ }
+ else
+ {
+ AcpiGbl_RootTableList.Tables[TableIndex].Flags &= ~ACPI_TABLE_IS_LOADED;
+ }
+ }
- return_PTR (NextDesc);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
}
-
Index: dswscope.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dswscope.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dswscope.c -L sys/contrib/dev/acpica/dswscope.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dswscope.c
+++ sys/contrib/dev/acpica/dswscope.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswscope - Scope stack manipulation
- * $Revision: 60 $
+ * $Revision: 1.69 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,14 +124,13 @@
ACPI_MODULE_NAME ("dswscope")
-#define STACK_POP(head) head
-
-
/****************************************************************************
*
* FUNCTION: AcpiDsScopeStackClear
*
- * PARAMETERS: None
+ * PARAMETERS: WalkState - Current state
+ *
+ * RETURN: None
*
* DESCRIPTION: Pop (and free) everything on the scope stack except the
* root scope object (which remains at the stack top.)
@@ -144,7 +143,7 @@
{
ACPI_GENERIC_STATE *ScopeInfo;
- ACPI_FUNCTION_NAME ("DsScopeStackClear");
+ ACPI_FUNCTION_NAME (DsScopeStackClear);
while (WalkState->ScopeInfo)
@@ -155,7 +154,8 @@
WalkState->ScopeInfo = ScopeInfo->Scope.Next;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Popped object type (%s)\n", AcpiUtGetTypeName (ScopeInfo->Common.Value)));
+ "Popped object type (%s)\n",
+ AcpiUtGetTypeName (ScopeInfo->Common.Value)));
AcpiUtDeleteGenericState (ScopeInfo);
}
}
@@ -165,8 +165,11 @@
*
* FUNCTION: AcpiDsScopeStackPush
*
- * PARAMETERS: *Node, - Name to be made current
- * Type, - Type of frame being pushed
+ * PARAMETERS: Node - Name to be made current
+ * Type - Type of frame being pushed
+ * WalkState - Current state
+ *
+ * RETURN: Status
*
* DESCRIPTION: Push the current scope on the scope stack, and make the
* passed Node current.
@@ -183,14 +186,14 @@
ACPI_GENERIC_STATE *OldScopeInfo;
- ACPI_FUNCTION_TRACE ("DsScopeStackPush");
+ ACPI_FUNCTION_TRACE (DsScopeStackPush);
if (!Node)
{
/* Invalid scope */
- ACPI_REPORT_ERROR (("DsScopeStackPush: null scope passed\n"));
+ ACPI_ERROR ((AE_INFO, "Null scope parameter"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -198,7 +201,8 @@
if (!AcpiUtValidObjectType (Type))
{
- ACPI_REPORT_WARNING (("DsScopeStackPush: Invalid object type: 0x%X\n", Type));
+ ACPI_WARNING ((AE_INFO,
+ "Invalid object type: 0x%X", Type));
}
/* Allocate a new scope object */
@@ -211,9 +215,9 @@
/* Init new scope object */
- ScopeInfo->Common.DataType = ACPI_DESC_TYPE_STATE_WSCOPE;
- ScopeInfo->Scope.Node = Node;
- ScopeInfo->Common.Value = (UINT16) Type;
+ ScopeInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_WSCOPE;
+ ScopeInfo->Scope.Node = Node;
+ ScopeInfo->Common.Value = (UINT16) Type;
WalkState->ScopeDepth++;
@@ -250,16 +254,11 @@
*
* FUNCTION: AcpiDsScopeStackPop
*
- * PARAMETERS: Type - The type of frame to be found
+ * PARAMETERS: WalkState - Current state
*
- * DESCRIPTION: Pop the scope stack until a frame of the requested type
- * is found.
+ * RETURN: Status
*
- * RETURN: Count of frames popped. If no frame of the requested type
- * was found, the count is returned as a negative number and
- * the scope stack is emptied (which sets the current scope
- * to the root). If the scope stack was empty at entry, the
- * function is a no-op and returns 0.
+ * DESCRIPTION: Pop the scope stack once.
*
***************************************************************************/
@@ -271,7 +270,7 @@
ACPI_GENERIC_STATE *NewScopeInfo;
- ACPI_FUNCTION_TRACE ("DsScopeStackPop");
+ ACPI_FUNCTION_TRACE (DsScopeStackPop);
/*
Index: acglobal.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acglobal.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acglobal.h -L sys/contrib/dev/acpica/acglobal.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acglobal.h
+++ sys/contrib/dev/acpica/acglobal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acglobal.h - Declarations for global variables
- * $Revision: 159 $
+ * $Revision: 1.194 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -132,29 +132,6 @@
#define ACPI_INIT_GLOBAL(a,b) a
#endif
-/*
- * Keep local copies of these FADT-based registers. NOTE: These globals
- * are first in this file for alignment reasons on 64-bit systems.
- */
-ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
-ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
-
-
-/*****************************************************************************
- *
- * Debug support
- *
- ****************************************************************************/
-
-/* Runtime configuration of debug print levels */
-
-extern UINT32 AcpiDbgLevel;
-extern UINT32 AcpiDbgLayer;
-
-/* Procedure nesting level for debug output */
-
-extern UINT32 AcpiGbl_NestingLevel;
-
/*****************************************************************************
*
@@ -165,10 +142,16 @@
/*
* Enable "slack" in the AML interpreter? Default is FALSE, and the
* interpreter strictly follows the ACPI specification. Setting to TRUE
- * allows the interpreter to forgive certain bad AML constructs. Currently:
+ * allows the interpreter to ignore certain errors and/or bad AML constructs.
+ *
+ * Currently, these features are enabled by this flag:
+ *
* 1) Allow "implicit return" of last value in a control method
- * 2) Allow access beyond end of operation region
+ * 2) Allow access beyond the end of an operation region
* 3) Allow access to uninitialized locals/args (auto-init to integer 0)
+ * 4) Allow ANY object type to be a source operand for the Store() operator
+ * 5) Allow unresolved references (invalid target name) in package objects
+ * 6) Enable warning messages for behavior that is not ACPI spec compliant
*/
ACPI_EXTERN UINT8 ACPI_INIT_GLOBAL (AcpiGbl_EnableInterpreterSlack, FALSE);
@@ -202,48 +185,58 @@
****************************************************************************/
/*
- * Table pointers.
- * Although these pointers are somewhat redundant with the global AcpiTable,
- * they are convenient because they are typed pointers.
+ * AcpiGbl_RootTableList is the master list of ACPI tables found in the
+ * RSDT/XSDT.
*
- * These tables are single-table only; meaning that there can be at most one
- * of each in the system. Each global points to the actual table.
- */
-ACPI_EXTERN UINT32 AcpiGbl_TableFlags;
-ACPI_EXTERN UINT32 AcpiGbl_RsdtTableCount;
-ACPI_EXTERN RSDP_DESCRIPTOR *AcpiGbl_RSDP;
-ACPI_EXTERN XSDT_DESCRIPTOR *AcpiGbl_XSDT;
-ACPI_EXTERN FADT_DESCRIPTOR *AcpiGbl_FADT;
-ACPI_EXTERN ACPI_TABLE_HEADER *AcpiGbl_DSDT;
-ACPI_EXTERN FACS_DESCRIPTOR *AcpiGbl_FACS;
-ACPI_EXTERN ACPI_COMMON_FACS AcpiGbl_CommonFACS;
-/*
- * Since there may be multiple SSDTs and PSDTS, a single pointer is not
- * sufficient; Therefore, there isn't one!
+ * AcpiGbl_FADT is a local copy of the FADT, converted to a common format.
*/
+ACPI_EXTERN ACPI_INTERNAL_RSDT AcpiGbl_RootTableList;
+ACPI_EXTERN ACPI_TABLE_FADT AcpiGbl_FADT;
+
+/* These addresses are calculated from FADT address values */
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1aEnable;
+ACPI_EXTERN ACPI_GENERIC_ADDRESS AcpiGbl_XPm1bEnable;
/*
- * Handle both ACPI 1.0 and ACPI 2.0 Integer widths
- * If we are running a method that exists in a 32-bit ACPI table.
- * Use only 32 bits of the Integer for conversion.
+ * Handle both ACPI 1.0 and ACPI 2.0 Integer widths. The integer width is
+ * determined by the revision of the DSDT: If the DSDT revision is less than
+ * 2, use only the lower 32 bits of the internal 64-bit Integer.
*/
ACPI_EXTERN UINT8 AcpiGbl_IntegerBitWidth;
ACPI_EXTERN UINT8 AcpiGbl_IntegerByteWidth;
ACPI_EXTERN UINT8 AcpiGbl_IntegerNybbleWidth;
-/*
- * ACPI Table info arrays
- */
-extern ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
-extern ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES];
+
+/*****************************************************************************
+ *
+ * Mutual exlusion within ACPICA subsystem
+ *
+ ****************************************************************************/
/*
- * Predefined mutex objects. This array contains the
+ * Predefined mutex objects. This array contains the
* actual OS mutex handles, indexed by the local ACPI_MUTEX_HANDLEs.
* (The table maps local handles to the real OS handles)
*/
-ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[NUM_MUTEX];
+ACPI_EXTERN ACPI_MUTEX_INFO AcpiGbl_MutexInfo[ACPI_NUM_MUTEX];
+
+/*
+ * Global lock mutex is an actual AML mutex object
+ * Global lock semaphore works in conjunction with the HW global lock
+ */
+ACPI_EXTERN ACPI_OPERAND_OBJECT *AcpiGbl_GlobalLockMutex;
+ACPI_EXTERN ACPI_SEMAPHORE AcpiGbl_GlobalLockSemaphore;
+ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
+ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
+ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
+
+/*
+ * Spinlocks are used for interfaces that can be possibly called at
+ * interrupt level
+ */
+ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_GpeLock; /* For GPE data structs and registers */
+ACPI_EXTERN ACPI_SPINLOCK AcpiGbl_HardwareLock; /* For ACPI H/W except GPE registers */
/*****************************************************************************
@@ -252,40 +245,71 @@
*
****************************************************************************/
+/* Object caches */
+
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_NamespaceCache;
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_StateCache;
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeCache;
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_PsNodeExtCache;
+ACPI_EXTERN ACPI_CACHE_T *AcpiGbl_OperandCache;
+
+/* Global handlers */
-ACPI_EXTERN ACPI_MEMORY_LIST AcpiGbl_MemoryLists[ACPI_NUM_MEM_LISTS];
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_DeviceNotify;
ACPI_EXTERN ACPI_OBJECT_NOTIFY_HANDLER AcpiGbl_SystemNotify;
ACPI_EXTERN ACPI_EXCEPTION_HANDLER AcpiGbl_ExceptionHandler;
ACPI_EXTERN ACPI_INIT_HANDLER AcpiGbl_InitHandler;
ACPI_EXTERN ACPI_WALK_STATE *AcpiGbl_BreakpointWalk;
-ACPI_EXTERN ACPI_HANDLE AcpiGbl_GlobalLockSemaphore;
-ACPI_EXTERN UINT32 AcpiGbl_GlobalLockThreadCount;
+/* Owner ID support */
+
+ACPI_EXTERN UINT32 AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS];
+ACPI_EXTERN UINT8 AcpiGbl_LastOwnerIdIndex;
+ACPI_EXTERN UINT8 AcpiGbl_NextOwnerIdOffset;
+
+/* Misc */
+
ACPI_EXTERN UINT32 AcpiGbl_OriginalMode;
ACPI_EXTERN UINT32 AcpiGbl_RsdpOriginalLocation;
ACPI_EXTERN UINT32 AcpiGbl_NsLookupCount;
ACPI_EXTERN UINT32 AcpiGbl_PsFindCount;
ACPI_EXTERN UINT16 AcpiGbl_Pm1EnableRegisterSave;
-ACPI_EXTERN UINT16 AcpiGbl_NextTableOwnerId;
-ACPI_EXTERN UINT16 AcpiGbl_NextMethodOwnerId;
-ACPI_EXTERN UINT16 AcpiGbl_GlobalLockHandle;
ACPI_EXTERN UINT8 AcpiGbl_DebuggerConfiguration;
-ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockAcquired;
ACPI_EXTERN BOOLEAN AcpiGbl_StepToNextCall;
ACPI_EXTERN BOOLEAN AcpiGbl_AcpiHardwarePresent;
-ACPI_EXTERN BOOLEAN AcpiGbl_GlobalLockPresent;
ACPI_EXTERN BOOLEAN AcpiGbl_EventsInitialized;
ACPI_EXTERN BOOLEAN AcpiGbl_SystemAwakeAndRunning;
+
+#ifndef DEFINE_ACPI_GLOBALS
+
+/* Exception codes */
+
+extern char const *AcpiGbl_ExceptionNames_Env[];
+extern char const *AcpiGbl_ExceptionNames_Pgm[];
+extern char const *AcpiGbl_ExceptionNames_Tbl[];
+extern char const *AcpiGbl_ExceptionNames_Aml[];
+extern char const *AcpiGbl_ExceptionNames_Ctrl[];
+
+/* Other miscellaneous */
+
extern BOOLEAN AcpiGbl_Shutdown;
extern UINT32 AcpiGbl_StartupFlags;
-extern const UINT8 AcpiGbl_DecodeTo8bit[8];
extern const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT];
extern const char *AcpiGbl_HighestDstateNames[4];
extern const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES];
extern const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS];
-extern const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS];
+#endif
+
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+
+/* Lists for tracking memory allocations */
+
+ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_GlobalList;
+ACPI_EXTERN ACPI_MEMORY_LIST *AcpiGbl_NsNodeList;
+ACPI_EXTERN BOOLEAN AcpiGbl_DisplayFinalMemStats;
+#endif
/*****************************************************************************
@@ -318,6 +342,7 @@
ACPI_EXTERN UINT32 AcpiGbl_DeepestNesting;
#endif
+
/*****************************************************************************
*
* Interpreter globals
@@ -334,14 +359,6 @@
/*****************************************************************************
*
- * Parser globals
- *
- ****************************************************************************/
-
-ACPI_EXTERN ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
-
-/*****************************************************************************
- *
* Hardware globals
*
****************************************************************************/
@@ -361,15 +378,42 @@
ACPI_EXTERN ACPI_FIXED_EVENT_HANDLER AcpiGbl_FixedEventHandlers[ACPI_NUM_FIXED_EVENTS];
ACPI_EXTERN ACPI_GPE_XRUPT_INFO *AcpiGbl_GpeXruptListHead;
ACPI_EXTERN ACPI_GPE_BLOCK_INFO *AcpiGbl_GpeFadtBlocks[ACPI_MAX_GPE_BLOCKS];
-ACPI_EXTERN ACPI_HANDLE AcpiGbl_GpeLock;
/*****************************************************************************
*
- * Debugger globals
+ * Debug support
*
****************************************************************************/
+/* Runtime configuration of debug print levels */
+
+extern UINT32 AcpiDbgLevel;
+extern UINT32 AcpiDbgLayer;
+
+/* Procedure nesting level for debug output */
+
+extern UINT32 AcpiGbl_NestingLevel;
+
+/* Event counters */
+
+ACPI_EXTERN UINT32 AcpiGpeCount;
+
+/* Support for dynamic control method tracing mechanism */
+
+ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLevel;
+ACPI_EXTERN UINT32 AcpiGbl_OriginalDbgLayer;
+ACPI_EXTERN ACPI_NAME AcpiGbl_TraceMethodName;
+ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLevel;
+ACPI_EXTERN UINT32 AcpiGbl_TraceDbgLayer;
+ACPI_EXTERN UINT32 AcpiGbl_TraceFlags;
+
+
+/*****************************************************************************
+ *
+ * Debugger globals
+ *
+ ****************************************************************************/
ACPI_EXTERN UINT8 AcpiGbl_DbOutputFlags;
@@ -425,5 +469,4 @@
#endif /* ACPI_DEBUGGER */
-
#endif /* __ACGLOBAL_H__ */
Index: dswexec.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dswexec.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dswexec.c -L sys/contrib/dev/acpica/dswexec.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dswexec.c
+++ sys/contrib/dev/acpica/dswexec.c
@@ -2,7 +2,7 @@
*
* Module Name: dswexec - Dispatcher method execution callbacks;
* dispatch to interpreter.
- * $Revision: 113 $
+ * $Revision: 1.134 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,6 @@
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acdebug.h>
-#include <contrib/dev/acpica/acdisasm.h>
#define _COMPONENT ACPI_DISPATCHER
@@ -133,25 +132,29 @@
/*
* Dispatch table for opcode classes
*/
-static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] = {
- AcpiExOpcode_0A_0T_1R,
- AcpiExOpcode_1A_0T_0R,
- AcpiExOpcode_1A_0T_1R,
- AcpiExOpcode_1A_1T_0R,
- AcpiExOpcode_1A_1T_1R,
- AcpiExOpcode_2A_0T_0R,
- AcpiExOpcode_2A_0T_1R,
- AcpiExOpcode_2A_1T_1R,
- AcpiExOpcode_2A_2T_1R,
- AcpiExOpcode_3A_0T_0R,
- AcpiExOpcode_3A_1T_1R,
- AcpiExOpcode_6A_0T_1R};
+static ACPI_EXECUTE_OP AcpiGbl_OpTypeDispatch [] =
+{
+ AcpiExOpcode_0A_0T_1R,
+ AcpiExOpcode_1A_0T_0R,
+ AcpiExOpcode_1A_0T_1R,
+ AcpiExOpcode_1A_1T_0R,
+ AcpiExOpcode_1A_1T_1R,
+ AcpiExOpcode_2A_0T_0R,
+ AcpiExOpcode_2A_0T_1R,
+ AcpiExOpcode_2A_1T_1R,
+ AcpiExOpcode_2A_2T_1R,
+ AcpiExOpcode_3A_0T_0R,
+ AcpiExOpcode_3A_1T_1R,
+ AcpiExOpcode_6A_0T_1R
+};
+
/*****************************************************************************
*
* FUNCTION: AcpiDsGetPredicateValue
*
* PARAMETERS: WalkState - Current state of the parse tree walk
+ * ResultObj - if non-zero, pop result from result stack
*
* RETURN: Status
*
@@ -166,9 +169,10 @@
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *LocalObjDesc = NULL;
- ACPI_FUNCTION_TRACE_PTR ("DsGetPredicateValue", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsGetPredicateValue, WalkState);
WalkState->ControlState->Common.State = 0;
@@ -178,9 +182,8 @@
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not get result from predicate evaluation, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not get result from predicate evaluation"));
return_ACPI_STATUS (Status);
}
@@ -204,20 +207,27 @@
if (!ObjDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No predicate ObjDesc=%p State=%p\n",
+ ACPI_ERROR ((AE_INFO,
+ "No predicate ObjDesc=%p State=%p",
ObjDesc, WalkState));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
/*
- * Result of predicate evaluation currently must
- * be a number
+ * Result of predicate evaluation must be an Integer
+ * object. Implicitly convert the argument if necessary.
*/
- if (ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER)
+ Status = AcpiExConvertToInteger (ObjDesc, &LocalObjDesc, 16);
+ if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Bad predicate (not a number) ObjDesc=%p State=%p Type=%X\n",
+ goto Cleanup;
+ }
+
+ if (ACPI_GET_OBJECT_TYPE (LocalObjDesc) != ACPI_TYPE_INTEGER)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Bad predicate (not an integer) ObjDesc=%p State=%p Type=%X",
ObjDesc, WalkState, ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_OPERAND_TYPE;
@@ -226,13 +236,13 @@
/* Truncate the predicate to 32-bits if necessary */
- AcpiExTruncateFor32bitTable (ObjDesc);
+ AcpiExTruncateFor32bitTable (LocalObjDesc);
/*
* Save the result of the predicate evaluation on
* the control stack
*/
- if (ObjDesc->Integer.Value)
+ if (LocalObjDesc->Integer.Value)
{
WalkState->ControlState->Common.Value = TRUE;
}
@@ -254,12 +264,16 @@
/* Break to debugger to display result */
- ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (ObjDesc, WalkState));
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (LocalObjDesc, WalkState));
/*
* Delete the predicate result object (we know that
* we don't need it anymore)
*/
+ if (LocalObjDesc != ObjDesc)
+ {
+ AcpiUtRemoveReference (LocalObjDesc);
+ }
AcpiUtRemoveReference (ObjDesc);
WalkState->ControlState->Common.State = ACPI_CONTROL_NORMAL;
@@ -272,7 +286,7 @@
* FUNCTION: AcpiDsExecBeginOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
- * OutOp - Return op if a new one is created
+ * OutOp - Where to return op if a new one is created
*
* RETURN: Status
*
@@ -292,7 +306,7 @@
UINT32 OpcodeClass;
- ACPI_FUNCTION_TRACE_PTR ("DsExecBeginOp", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsExecBeginOp, WalkState);
Op = WalkState->Op;
@@ -301,7 +315,7 @@
Status = AcpiDsLoad2BeginOp (WalkState, OutOp);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto ErrorExit;
}
Op = *OutOp;
@@ -311,13 +325,14 @@
if (AcpiNsOpensScope (WalkState->OpInfo->ObjectType))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "(%s) Popping scope for Op %p\n",
AcpiUtGetTypeName (WalkState->OpInfo->ObjectType), Op));
Status = AcpiDsScopeStackPop (WalkState);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto ErrorExit;
}
}
}
@@ -368,44 +383,29 @@
{
case AML_CLASS_CONTROL:
- Status = AcpiDsResultStackPush (WalkState);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
Status = AcpiDsExecBeginControlOp (WalkState, Op);
break;
case AML_CLASS_NAMED_OBJECT:
- if (WalkState->WalkType == ACPI_WALK_METHOD)
+ if (WalkState->WalkType & ACPI_WALK_METHOD)
{
/*
- * Found a named object declaration during method
- * execution; we must enter this object into the
- * namespace. The created object is temporary and
- * will be deleted upon completion of the execution
- * of this method.
+ * Found a named object declaration during method execution;
+ * we must enter this object into the namespace. The created
+ * object is temporary and will be deleted upon completion of
+ * the execution of this method.
*/
Status = AcpiDsLoad2BeginOp (WalkState, NULL);
}
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- Status = AcpiDsResultStackPush (WalkState);
- }
break;
case AML_CLASS_EXECUTE:
case AML_CLASS_CREATE:
- /* most operators with arguments */
- /* Start a new result/operand state */
-
- Status = AcpiDsResultStackPush (WalkState);
break;
@@ -416,6 +416,11 @@
/* Nothing to do here during method execution */
return_ACPI_STATUS (Status);
+
+
+ErrorExit:
+ Status = AcpiDsMethodError (Status, WalkState);
+ return_ACPI_STATUS (Status);
}
@@ -424,8 +429,6 @@
* FUNCTION: AcpiDsExecEndOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been completed in the
- * walk; Arguments have now been evaluated.
*
* RETURN: Status
*
@@ -447,7 +450,7 @@
ACPI_PARSE_OBJECT *FirstArg;
- ACPI_FUNCTION_TRACE_PTR ("DsExecEndOp", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsExecEndOp, WalkState);
Op = WalkState->Op;
@@ -456,7 +459,7 @@
if (OpClass == AML_CLASS_UNKNOWN)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown opcode %X\n", Op->Common.AmlOpcode));
+ ACPI_ERROR ((AE_INFO, "Unknown opcode %X", Op->Common.AmlOpcode));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
@@ -465,6 +468,7 @@
/* Init the walk state */
WalkState->NumOperands = 0;
+ WalkState->OperandIndex = 0;
WalkState->ReturnDesc = NULL;
WalkState->ResultObj = NULL;
@@ -477,11 +481,20 @@
switch (OpClass)
{
- case AML_CLASS_ARGUMENT: /* constants, literals, etc. -- do nothing */
+ case AML_CLASS_ARGUMENT: /* Constants, literals, etc. */
+
+ if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
+ {
+ Status = AcpiDsEvaluateNamePath (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+ }
break;
- case AML_CLASS_EXECUTE: /* most operators with arguments */
+ case AML_CLASS_EXECUTE: /* Most operators with arguments */
/* Build resolved operand stack */
@@ -491,25 +504,27 @@
goto Cleanup;
}
- /* Done with this result state (Now that operand stack is built) */
-
- Status = AcpiDsResultStackPop (WalkState);
- if (ACPI_FAILURE (Status))
+ /*
+ * All opcodes require operand resolution, with the only exceptions
+ * being the ObjectType and SizeOf operators.
+ */
+ if (!(WalkState->OpInfo->Flags & AML_NO_OPERAND_RESOLVE))
{
- goto Cleanup;
- }
+ /* Resolve all operands */
- /* Resolve all operands */
-
- Status = AcpiExResolveOperands (WalkState->Opcode,
+ Status = AcpiExResolveOperands (WalkState->Opcode,
&(WalkState->Operands [WalkState->NumOperands -1]),
WalkState);
+ if (ACPI_SUCCESS (Status))
+ {
+ ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
+ AcpiPsGetOpcodeName (WalkState->Opcode),
+ WalkState->NumOperands, "after ExResolveOperands");
+ }
+ }
+
if (ACPI_SUCCESS (Status))
{
- ACPI_DUMP_OPERANDS (ACPI_WALK_OPERANDS, ACPI_IMODE_EXECUTE,
- AcpiPsGetOpcodeName (WalkState->Opcode),
- WalkState->NumOperands, "after ExResolveOperands");
-
/*
* Dispatch the request to the appropriate interpreter handler
* routine. There is one routine per opcode "type" based upon the
@@ -536,10 +551,9 @@
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "[%s]: Could not resolve operands, %s\n",
- AcpiPsGetOpcodeName (WalkState->Opcode),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While resolving operands for [%s]",
+ AcpiPsGetOpcodeName (WalkState->Opcode)));
}
}
@@ -556,7 +570,6 @@
{
Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
}
-
break;
@@ -569,21 +582,33 @@
/* 1 Operand, 0 ExternalResult, 0 InternalResult */
Status = AcpiDsExecEndControlOp (WalkState, Op);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
- Status = AcpiDsResultStackPop (WalkState);
break;
case AML_TYPE_METHOD_CALL:
+ /*
+ * If the method is referenced from within a package
+ * declaration, it is not a invocation of the method, just
+ * a reference to it.
+ */
+ if ((Op->Asl.Parent) &&
+ ((Op->Asl.Parent->Asl.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Asl.Parent->Asl.AmlOpcode == AML_VAR_PACKAGE_OP)))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Method Reference in a Package, Op=%p\n", Op));
+
+ Op->Common.Node = (ACPI_NAMESPACE_NODE *) Op->Asl.Value.Arg->Asl.Node->Object;
+ AcpiUtAddReference (Op->Asl.Value.Arg->Asl.Node->Object);
+ return_ACPI_STATUS (AE_OK);
+ }
+
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Method invocation, Op=%p\n", Op));
/*
- * (AML_METHODCALL) Op->Value->Arg->Node contains
+ * (AML_METHODCALL) Op->Asl.Value.Arg->Asl.Node contains
* the method Node pointer
*/
/* NextOp points to the op that holds the method name */
@@ -655,13 +680,15 @@
case AML_NAME_OP:
/*
- * Put the Node on the object stack (Contains the ACPI Name of
- * this object)
+ * Put the Node on the object stack (Contains the ACPI Name
+ * of this object)
*/
WalkState->Operands[0] = (void *) Op->Common.Parent->Common.Node;
WalkState->NumOperands = 1;
- Status = AcpiDsCreateNode (WalkState, Op->Common.Parent->Common.Node, Op->Common.Parent);
+ Status = AcpiDsCreateNode (WalkState,
+ Op->Common.Parent->Common.Node,
+ Op->Common.Parent);
if (ACPI_FAILURE (Status))
{
break;
@@ -673,7 +700,7 @@
case AML_INT_EVAL_SUBTREE_OP:
Status = AcpiDsEvalDataObjectOperands (WalkState, Op,
- AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
+ AcpiNsGetAttachedObject (Op->Common.Parent->Common.Node));
break;
default:
@@ -686,8 +713,7 @@
* If a result object was returned from above, push it on the
* current result stack
*/
- if (ACPI_SUCCESS (Status) &&
- WalkState->ResultObj)
+ if (WalkState->ResultObj)
{
Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
}
@@ -715,16 +741,14 @@
{
break;
}
-
- Status = AcpiDsResultStackPop (WalkState);
}
-
break;
case AML_TYPE_UNDEFINED:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Undefined opcode type Op=%p\n", Op));
+ ACPI_ERROR ((AE_INFO,
+ "Undefined opcode type Op=%p", Op));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
@@ -738,8 +762,8 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unimplemented opcode, class=%X type=%X Opcode=%X Op=%p",
OpClass, OpType, Op->Common.AmlOpcode, Op));
Status = AE_NOT_IMPLEMENTED;
@@ -757,7 +781,6 @@
* Check if we just completed the evaluation of a
* conditional predicate
*/
-
if ((ACPI_SUCCESS (Status)) &&
(WalkState->ControlState) &&
(WalkState->ControlState->Common.State ==
@@ -771,24 +794,12 @@
Cleanup:
- /* Invoke exception handler on error */
-
- if (ACPI_FAILURE (Status) &&
- AcpiGbl_ExceptionHandler &&
- !(Status & AE_CODE_CONTROL))
- {
- AcpiExExitInterpreter ();
- Status = AcpiGbl_ExceptionHandler (Status,
- WalkState->MethodNode->Name.Integer, WalkState->Opcode,
- WalkState->AmlOffset, NULL);
- AcpiExEnterInterpreter ();
- }
-
if (WalkState->ResultObj)
{
/* Break to debugger to display result */
- ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj, WalkState));
+ ACPI_DEBUGGER_EXEC (AcpiDbDisplayResultObject (WalkState->ResultObj,
+ WalkState));
/*
* Delete the result op if and only if:
@@ -806,20 +817,16 @@
}
#endif
- /* Always clear the object stack */
-
- WalkState->NumOperands = 0;
-
-#ifdef ACPI_DISASSEMBLER
-
- /* On error, display method locals/args */
+ /* Invoke exception handler on error */
if (ACPI_FAILURE (Status))
{
- AcpiDmDumpMethodInfo (Status, WalkState, Op);
+ Status = AcpiDsMethodError (Status, WalkState);
}
-#endif
+ /* Always clear the object stack */
+
+ WalkState->NumOperands = 0;
return_ACPI_STATUS (Status);
}
Index: uteval.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/uteval.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/uteval.c -L sys/contrib/dev/acpica/uteval.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/uteval.c
+++ sys/contrib/dev/acpica/uteval.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: uteval - Object evaluation
- * $Revision: 54 $
+ * $Revision: 1.71 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,50 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("uteval")
+/* Local prototypes */
+
+static void
+AcpiUtCopyIdString (
+ char *Destination,
+ char *Source,
+ ACPI_SIZE MaxLength);
+
+static ACPI_STATUS
+AcpiUtTranslateOneCid (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_COMPATIBLE_ID *OneCid);
+
+
+/*
+ * Strings supported by the _OSI predefined (internal) method.
+ */
+static const char *AcpiInterfacesSupported[] =
+{
+ /* Operating System Vendor Strings */
+
+ "Linux",
+ "Windows 2000",
+ "Windows 2001",
+ "Windows 2001 SP0",
+ "Windows 2001 SP1",
+ "Windows 2001 SP2",
+ "Windows 2001 SP3",
+ "Windows 2001 SP4",
+ "Windows 2001.1",
+ "Windows 2001.1 SP1", /* Added 03/2006 */
+ "Windows 2006", /* Added 03/2006 */
+
+ /* Feature Group Strings */
+
+ "Extended Address Space Descriptor"
+
+ /*
+ * All "optional" feature group strings (features that are implemented
+ * by the host) should be implemented in the host version of
+ * AcpiOsValidateInterface and should not be added here.
+ */
+};
+
/*******************************************************************************
*
@@ -133,8 +177,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Implementation of _OSI predefined control method
- * Supported = _OSI (String)
+ * DESCRIPTION: Implementation of the _OSI predefined control method
*
******************************************************************************/
@@ -142,12 +185,13 @@
AcpiUtOsiImplementation (
ACPI_WALK_STATE *WalkState)
{
+ ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *StringDesc;
ACPI_OPERAND_OBJECT *ReturnDesc;
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("UtOsiImplementation");
+ ACPI_FUNCTION_TRACE (UtOsiImplementation);
/* Validate the string input argument */
@@ -158,7 +202,7 @@
return_ACPI_STATUS (AE_TYPE);
}
- /* Create a return object (Default value = 0) */
+ /* Create a return object */
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
@@ -166,21 +210,39 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Compare input string to table of supported strings */
+ /* Default return value is SUPPORTED */
+
+ ReturnDesc->Integer.Value = ACPI_UINT32_MAX;
+ WalkState->ReturnDesc = ReturnDesc;
+
+ /* Compare input string to static table of supported interfaces */
- for (i = 0; i < ACPI_NUM_OSI_STRINGS; i++)
+ for (i = 0; i < ACPI_ARRAY_LENGTH (AcpiInterfacesSupported); i++)
{
- if (!ACPI_STRCMP (StringDesc->String.Pointer,
- (char *) (uintptr_t) AcpiGbl_ValidOsiStrings[i]))
+ if (!ACPI_STRCMP (StringDesc->String.Pointer, AcpiInterfacesSupported[i]))
{
- /* This string is supported */
+ /* The interface is supported */
- ReturnDesc->Integer.Value = 0xFFFFFFFF;
- break;
+ return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
}
- WalkState->ReturnDesc = ReturnDesc;
+ /*
+ * Did not match the string in the static table, call the host OSL to
+ * check for a match with one of the optional strings (such as
+ * "Module Device", "3.0 Thermal Model", etc.)
+ */
+ Status = AcpiOsValidateInterface (StringDesc->String.Pointer);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* The interface is supported */
+
+ return_ACPI_STATUS (AE_CTRL_TERMINATE);
+ }
+
+ /* The interface is not supported */
+
+ ReturnDesc->Integer.Value = 0;
return_ACPI_STATUS (AE_CTRL_TERMINATE);
}
@@ -211,21 +273,29 @@
UINT32 ExpectedReturnBtypes,
ACPI_OPERAND_OBJECT **ReturnDesc)
{
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
ACPI_STATUS Status;
UINT32 ReturnBtype;
- ACPI_FUNCTION_TRACE ("UtEvaluateObject");
+ ACPI_FUNCTION_TRACE (UtEvaluateObject);
+
+ /* Allocate the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
- Info.Node = PrefixNode;
- Info.Parameters = NULL;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ Info->PrefixNode = PrefixNode;
+ Info->Pathname = Path;
+ Info->ParameterType = ACPI_PARAM_ARGS;
/* Evaluate the object/method */
- Status = AcpiNsEvaluateRelative (Path, &Info);
+ Status = AcpiNsEvaluate (Info);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@@ -235,31 +305,31 @@
}
else
{
- ACPI_REPORT_METHOD_ERROR ("Method execution failed",
+ ACPI_ERROR_METHOD ("Method execution failed",
PrefixNode, Path, Status);
}
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Did we get a return object? */
- if (!Info.ReturnObject)
+ if (!Info->ReturnObject)
{
if (ExpectedReturnBtypes)
{
- ACPI_REPORT_METHOD_ERROR ("No object was returned from",
+ ACPI_ERROR_METHOD ("No object was returned from",
PrefixNode, Path, AE_NOT_EXIST);
- return_ACPI_STATUS (AE_NOT_EXIST);
+ Status = AE_NOT_EXIST;
}
- return_ACPI_STATUS (AE_OK);
+ goto Cleanup;
}
/* Map the return object type to the bitmapped type */
- switch (ACPI_GET_OBJECT_TYPE (Info.ReturnObject))
+ switch (ACPI_GET_OBJECT_TYPE (Info->ReturnObject))
{
case ACPI_TYPE_INTEGER:
ReturnBtype = ACPI_BTYPE_INTEGER;
@@ -282,27 +352,44 @@
break;
}
+ if ((AcpiGbl_EnableInterpreterSlack) &&
+ (!ExpectedReturnBtypes))
+ {
+ /*
+ * We received a return object, but one was not expected. This can
+ * happen frequently if the "implicit return" feature is enabled.
+ * Just delete the return object and return AE_OK.
+ */
+ AcpiUtRemoveReference (Info->ReturnObject);
+ goto Cleanup;
+ }
+
/* Is the return object one of the expected types? */
if (!(ExpectedReturnBtypes & ReturnBtype))
{
- ACPI_REPORT_METHOD_ERROR ("Return object type is incorrect",
+ ACPI_ERROR_METHOD ("Return object type is incorrect",
PrefixNode, Path, AE_TYPE);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Type returned from %s was incorrect: %X\n",
- Path, ACPI_GET_OBJECT_TYPE (Info.ReturnObject)));
+ ACPI_ERROR ((AE_INFO,
+ "Type returned from %s was incorrect: %s, expected Btypes: %X",
+ Path, AcpiUtGetObjectTypeName (Info->ReturnObject),
+ ExpectedReturnBtypes));
/* On error exit, we must delete the return object */
- AcpiUtRemoveReference (Info.ReturnObject);
- return_ACPI_STATUS (AE_TYPE);
+ AcpiUtRemoveReference (Info->ReturnObject);
+ Status = AE_TYPE;
+ goto Cleanup;
}
/* Object type is OK, return it */
- *ReturnDesc = Info.ReturnObject;
- return_ACPI_STATUS (AE_OK);
+ *ReturnDesc = Info->ReturnObject;
+
+Cleanup:
+ ACPI_FREE (Info);
+ return_ACPI_STATUS (Status);
}
@@ -310,9 +397,9 @@
*
* FUNCTION: AcpiUtEvaluateNumericObject
*
- * PARAMETERS: *ObjectName - Object name to be evaluated
+ * PARAMETERS: ObjectName - Object name to be evaluated
* DeviceNode - Node for the device
- * *Address - Where the value is returned
+ * Address - Where the value is returned
*
* RETURN: Status
*
@@ -333,7 +420,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtEvaluateNumericObject");
+ ACPI_FUNCTION_TRACE (UtEvaluateNumericObject);
Status = AcpiUtEvaluateObject (DeviceNode, ObjectName,
@@ -377,7 +464,6 @@
ACPI_SIZE MaxLength)
{
-
/*
* Workaround for ID strings that have a leading asterisk. This construct
* is not allowed by the ACPI specification (ID strings must be
@@ -400,7 +486,7 @@
* FUNCTION: AcpiUtExecute_HID
*
* PARAMETERS: DeviceNode - Node for the device
- * *Hid - Where the HID is returned
+ * Hid - Where the HID is returned
*
* RETURN: Status
*
@@ -420,7 +506,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtExecute_HID");
+ ACPI_FUNCTION_TRACE (UtExecute_HID);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__HID,
@@ -509,7 +595,7 @@
* FUNCTION: AcpiUtExecute_CID
*
* PARAMETERS: DeviceNode - Node for the device
- * *Cid - Where the CID is returned
+ * ReturnCidList - Where the CID list is returned
*
* RETURN: Status
*
@@ -533,7 +619,7 @@
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("UtExecute_CID");
+ ACPI_FUNCTION_TRACE (UtExecute_CID);
/* Evaluate the _CID method for this device */
@@ -559,7 +645,7 @@
Size = (((Count - 1) * sizeof (ACPI_COMPATIBLE_ID)) +
sizeof (ACPI_COMPATIBLE_ID_LIST));
- CidList = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Size);
+ CidList = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Size);
if (!CidList)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -571,10 +657,10 @@
CidList->Size = Size;
/*
- * A _CID can return either a single compatible ID or a package of compatible
- * IDs. Each compatible ID can be one of the following:
- * -- Number (32 bit compressed EISA ID) or
- * -- String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss").
+ * A _CID can return either a single compatible ID or a package of
+ * compatible IDs. Each compatible ID can be one of the following:
+ * 1) Integer (32 bit compressed EISA ID) or
+ * 2) String (PCI ID format, e.g. "PCI\VEN_vvvv&DEV_dddd&SUBSYS_ssssssss")
*/
/* The _CID object can be either a single CID or a package (list) of CIDs */
@@ -604,7 +690,7 @@
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (CidList);
+ ACPI_FREE (CidList);
}
else
{
@@ -623,7 +709,7 @@
* FUNCTION: AcpiUtExecute_UID
*
* PARAMETERS: DeviceNode - Node for the device
- * *Uid - Where the UID is returned
+ * Uid - Where the UID is returned
*
* RETURN: Status
*
@@ -643,7 +729,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtExecute_UID");
+ ACPI_FUNCTION_TRACE (UtExecute_UID);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__UID,
@@ -679,7 +765,7 @@
* FUNCTION: AcpiUtExecute_STA
*
* PARAMETERS: DeviceNode - Node for the device
- * *Flags - Where the status flags are returned
+ * Flags - Where the status flags are returned
*
* RETURN: Status
*
@@ -699,7 +785,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtExecute_STA");
+ ACPI_FUNCTION_TRACE (UtExecute_STA);
Status = AcpiUtEvaluateObject (DeviceNode, METHOD_NAME__STA,
@@ -712,7 +798,7 @@
"_STA on %4.4s was not found, assuming device is present\n",
AcpiUtGetNodeName (DeviceNode)));
- *Flags = 0x0F;
+ *Flags = ACPI_UINT32_MAX;
Status = AE_OK;
}
@@ -735,7 +821,7 @@
* FUNCTION: AcpiUtExecute_Sxds
*
* PARAMETERS: DeviceNode - Node for the device
- * *Flags - Where the status flags are returned
+ * Flags - Where the status flags are returned
*
* RETURN: Status
*
@@ -756,14 +842,14 @@
UINT32 i;
- ACPI_FUNCTION_TRACE ("UtExecute_Sxds");
+ ACPI_FUNCTION_TRACE (UtExecute_Sxds);
for (i = 0; i < 4; i++)
{
Highest[i] = 0xFF;
Status = AcpiUtEvaluateObject (DeviceNode,
- (char *) (uintptr_t) AcpiGbl_HighestDstateNames[i],
+ ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]),
ACPI_BTYPE_INTEGER, &ObjDesc);
if (ACPI_FAILURE (Status))
{
@@ -771,7 +857,7 @@
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"%s on Device %4.4s, %s\n",
- (char *) (uintptr_t) AcpiGbl_HighestDstateNames[i],
+ ACPI_CAST_PTR (char, AcpiGbl_HighestDstateNames[i]),
AcpiUtGetNodeName (DeviceNode),
AcpiFormatException (Status)));
Index: acutils.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acutils.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acutils.h -L sys/contrib/dev/acpica/acutils.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acutils.h
+++ sys/contrib/dev/acpica/acutils.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acutils.h -- prototypes for the common (subsystem-wide) procedures
- * $Revision: 164 $
+ * $Revision: 1.200 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +118,47 @@
#define _ACUTILS_H
+extern const UINT8 AcpiGbl_ResourceAmlSizes[];
+
+/* Strings used by the disassembler and debugger resource dump routines */
+
+#if defined(ACPI_DISASSEMBLER) || defined (ACPI_DEBUGGER)
+
+extern const char *AcpiGbl_BmDecode[];
+extern const char *AcpiGbl_ConfigDecode[];
+extern const char *AcpiGbl_ConsumeDecode[];
+extern const char *AcpiGbl_DecDecode[];
+extern const char *AcpiGbl_HeDecode[];
+extern const char *AcpiGbl_IoDecode[];
+extern const char *AcpiGbl_LlDecode[];
+extern const char *AcpiGbl_MaxDecode[];
+extern const char *AcpiGbl_MemDecode[];
+extern const char *AcpiGbl_MinDecode[];
+extern const char *AcpiGbl_MtpDecode[];
+extern const char *AcpiGbl_RngDecode[];
+extern const char *AcpiGbl_RwDecode[];
+extern const char *AcpiGbl_ShrDecode[];
+extern const char *AcpiGbl_SizDecode[];
+extern const char *AcpiGbl_TrsDecode[];
+extern const char *AcpiGbl_TtpDecode[];
+extern const char *AcpiGbl_TypDecode[];
+#endif
+
+/* Types for Resource descriptor entries */
+
+#define ACPI_INVALID_RESOURCE 0
+#define ACPI_FIXED_LENGTH 1
+#define ACPI_VARIABLE_LENGTH 2
+#define ACPI_SMALL_VARIABLE_LENGTH 3
+
+typedef
+ACPI_STATUS (*ACPI_WALK_AML_CALLBACK) (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context);
+
typedef
ACPI_STATUS (*ACPI_PKG_CALLBACK) (
UINT8 ObjectType,
@@ -125,13 +166,6 @@
ACPI_GENERIC_STATE *State,
void *Context);
-ACPI_STATUS
-AcpiUtWalkPackageTree (
- ACPI_OPERAND_OBJECT *SourceObject,
- void *TargetObject,
- ACPI_PKG_CALLBACK WalkCallback,
- void *Context);
-
typedef struct acpi_pkg_info
{
UINT8 *FreeSpace;
@@ -153,37 +187,13 @@
#define DB_QWORD_DISPLAY 8
-/* Global initialization interfaces */
-
-void
-AcpiUtInitGlobals (
- void);
-
-void
-AcpiUtTerminate (
- void);
-
-
/*
- * UtInit - miscellaneous initialization and shutdown
+ * utglobal - Global data structures and procedures
*/
-
-ACPI_STATUS
-AcpiUtHardwareInitialize (
- void);
-
void
-AcpiUtSubsystemShutdown (
- void);
-
-ACPI_STATUS
-AcpiUtValidateFadt (
+AcpiUtInitGlobals (
void);
-/*
- * UtGlobal - Global data structures and procedures
- */
-
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
char *
@@ -225,15 +235,22 @@
AcpiUtValidObjectType (
ACPI_OBJECT_TYPE Type);
-ACPI_OWNER_ID
-AcpiUtAllocateOwnerId (
- UINT32 IdType);
-
/*
- * UtClib - Local implementations of C library functions
+ * utinit - miscellaneous initialization and shutdown
*/
+ACPI_STATUS
+AcpiUtHardwareInitialize (
+ void);
+
+void
+AcpiUtSubsystemShutdown (
+ void);
+
+/*
+ * utclib - Local implementations of C library functions
+ */
#ifndef ACPI_USE_SYSTEM_CLIBRARY
ACPI_SIZE
@@ -330,14 +347,13 @@
#define ACPI_IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
#define ACPI_IS_PRINT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP | _ACPI_DI | _ACPI_SP | _ACPI_PU))
#define ACPI_IS_ALPHA(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO | _ACPI_UP))
-#define ACPI_IS_ASCII(c) ((c) < 0x80)
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
+
/*
- * UtCopy - Object construction and conversion interfaces
+ * utcopy - Object construction and conversion interfaces
*/
-
ACPI_STATUS
AcpiUtBuildSimpleObject(
ACPI_OPERAND_OBJECT *Obj,
@@ -352,30 +368,11 @@
UINT32 *SpaceUsed);
ACPI_STATUS
-AcpiUtCopyIelementToEelement (
- UINT8 ObjectType,
- ACPI_OPERAND_OBJECT *SourceObject,
- ACPI_GENERIC_STATE *State,
- void *Context);
-
-ACPI_STATUS
-AcpiUtCopyIelementToIelement (
- UINT8 ObjectType,
- ACPI_OPERAND_OBJECT *SourceObject,
- ACPI_GENERIC_STATE *State,
- void *Context);
-
-ACPI_STATUS
AcpiUtCopyIobjectToEobject (
ACPI_OPERAND_OBJECT *Obj,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
-AcpiUtCopyEsimpleToIsimple(
- ACPI_OBJECT *UserObj,
- ACPI_OPERAND_OBJECT **ReturnObj);
-
-ACPI_STATUS
AcpiUtCopyEobjectToIobject (
ACPI_OBJECT *Obj,
ACPI_OPERAND_OBJECT **InternalObj);
@@ -386,17 +383,6 @@
ACPI_OPERAND_OBJECT *DestObj);
ACPI_STATUS
-AcpiUtCopyIpackageToIpackage (
- ACPI_OPERAND_OBJECT *SourceObj,
- ACPI_OPERAND_OBJECT *DestObj,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiUtCopySimpleObject (
- ACPI_OPERAND_OBJECT *SourceDesc,
- ACPI_OPERAND_OBJECT *DestDesc);
-
-ACPI_STATUS
AcpiUtCopyIobjectToIobject (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT **DestDesc,
@@ -404,9 +390,8 @@
/*
- * UtCreate - Object creation
+ * utcreate - Object creation
*/
-
ACPI_STATUS
AcpiUtUpdateObjectReference (
ACPI_OPERAND_OBJECT *Object,
@@ -414,9 +399,8 @@
/*
- * UtDebug - Debug interfaces
+ * utdebug - Debug interfaces
*/
-
void
AcpiUtInitStackPtrTrace (
void);
@@ -428,97 +412,154 @@
void
AcpiUtTrace (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo);
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId);
void
AcpiUtTracePtr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
void *Pointer);
void
AcpiUtTraceU32 (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT32 Integer);
void
AcpiUtTraceStr (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *String);
void
AcpiUtExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo);
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId);
void
AcpiUtStatusExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_STATUS Status);
void
AcpiUtValueExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
ACPI_INTEGER Value);
void
AcpiUtPtrExit (
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
UINT8 *Ptr);
void
-AcpiUtReportInfo (
- char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId);
+AcpiUtDumpBuffer (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display,
+ UINT32 componentId);
+
+void
+AcpiUtDumpBuffer2 (
+ UINT8 *Buffer,
+ UINT32 Count,
+ UINT32 Display);
void
AcpiUtReportError (
char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId);
+ UINT32 LineNumber);
void
-AcpiUtReportWarning (
+AcpiUtReportInfo (
char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId);
+ UINT32 LineNumber);
void
-AcpiUtDumpBuffer (
- UINT8 *Buffer,
- UINT32 Count,
- UINT32 Display,
- UINT32 componentId);
+AcpiUtReportWarning (
+ char *ModuleName,
+ UINT32 LineNumber);
+
+/* Error and message reporting interfaces */
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrint (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
char *Format,
- ...) ACPI_PRINTF_LIKE_FUNC;
+ ...) ACPI_PRINTF_LIKE(6);
void ACPI_INTERNAL_VAR_XFACE
AcpiUtDebugPrintRaw (
UINT32 RequestedDebugLevel,
UINT32 LineNumber,
- ACPI_DEBUG_PRINT_INFO *DbgInfo,
+ const char *FunctionName,
+ char *ModuleName,
+ UINT32 ComponentId,
+ char *Format,
+ ...) ACPI_PRINTF_LIKE(6);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ char *Format,
+ ...) ACPI_PRINTF_LIKE(3);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtException (
+ char *ModuleName,
+ UINT32 LineNumber,
+ ACPI_STATUS Status,
+ char *Format,
+ ...) ACPI_PRINTF_LIKE(4);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtWarning (
+ char *ModuleName,
+ UINT32 LineNumber,
+ char *Format,
+ ...) ACPI_PRINTF_LIKE(3);
+
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtInfo (
+ char *ModuleName,
+ UINT32 LineNumber,
char *Format,
- ...) ACPI_PRINTF_LIKE_FUNC;
+ ...) ACPI_PRINTF_LIKE(3);
/*
- * UtDelete - Object deletion
+ * utdelete - Object deletion and reference counts
*/
+void
+AcpiUtAddReference (
+ ACPI_OPERAND_OBJECT *Object);
void
-AcpiUtDeleteInternalObj (
+AcpiUtRemoveReference (
ACPI_OPERAND_OBJECT *Object);
void
@@ -535,25 +576,8 @@
/*
- * UtEval - object evaluation
+ * uteval - object evaluation
*/
-
-/* Method name strings */
-
-#define METHOD_NAME__HID "_HID"
-#define METHOD_NAME__CID "_CID"
-#define METHOD_NAME__UID "_UID"
-#define METHOD_NAME__ADR "_ADR"
-#define METHOD_NAME__STA "_STA"
-#define METHOD_NAME__REG "_REG"
-#define METHOD_NAME__SEG "_SEG"
-#define METHOD_NAME__BBN "_BBN"
-#define METHOD_NAME__PRT "_PRT"
-#define METHOD_NAME__CRS "_CRS"
-#define METHOD_NAME__PRS "_PRS"
-#define METHOD_NAME__PRW "_PRW"
-
-
ACPI_STATUS
AcpiUtOsiImplementation (
ACPI_WALK_STATE *WalkState);
@@ -596,39 +620,10 @@
ACPI_NAMESPACE_NODE *DeviceNode,
UINT8 *Highest);
-/*
- * UtMutex - mutual exclusion interfaces
- */
-
-ACPI_STATUS
-AcpiUtMutexInitialize (
- void);
-
-void
-AcpiUtMutexTerminate (
- void);
-
-ACPI_STATUS
-AcpiUtCreateMutex (
- ACPI_MUTEX_HANDLE MutexId);
-
-ACPI_STATUS
-AcpiUtDeleteMutex (
- ACPI_MUTEX_HANDLE MutexId);
-
-ACPI_STATUS
-AcpiUtAcquireMutex (
- ACPI_MUTEX_HANDLE MutexId);
-
-ACPI_STATUS
-AcpiUtReleaseMutex (
- ACPI_MUTEX_HANDLE MutexId);
-
/*
- * UtObject - internal object create/delete/cache routines
+ * utobject - internal object create/delete/cache routines
*/
-
ACPI_OPERAND_OBJECT *
AcpiUtCreateInternalObjectDbg (
char *ModuleName,
@@ -642,8 +637,8 @@
UINT32 LineNumber,
UINT32 ComponentId);
-#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_THIS_MODULE,__LINE__,_COMPONENT,t)
-#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_THIS_MODULE,__LINE__,_COMPONENT)
+#define AcpiUtCreateInternalObject(t) AcpiUtCreateInternalObjectDbg (_AcpiModuleName,__LINE__,_COMPONENT,t)
+#define AcpiUtAllocateObjectDesc() AcpiUtAllocateObjectDescDbg (_AcpiModuleName,__LINE__,_COMPONENT)
void
AcpiUtDeleteObjectDesc (
@@ -661,50 +656,15 @@
AcpiUtCreateStringObject (
ACPI_SIZE StringSize);
-
-/*
- * UtRefCnt - Object reference count management
- */
-
-void
-AcpiUtAddReference (
- ACPI_OPERAND_OBJECT *Object);
-
-void
-AcpiUtRemoveReference (
- ACPI_OPERAND_OBJECT *Object);
-
-/*
- * UtSize - Object size routines
- */
-
-ACPI_STATUS
-AcpiUtGetSimpleObjectSize (
- ACPI_OPERAND_OBJECT *Obj,
- ACPI_SIZE *ObjLength);
-
-ACPI_STATUS
-AcpiUtGetPackageObjectSize (
- ACPI_OPERAND_OBJECT *Obj,
- ACPI_SIZE *ObjLength);
-
ACPI_STATUS
AcpiUtGetObjectSize(
ACPI_OPERAND_OBJECT *Obj,
ACPI_SIZE *ObjLength);
-ACPI_STATUS
-AcpiUtGetElementLength (
- UINT8 ObjectType,
- ACPI_OPERAND_OBJECT *SourceObject,
- ACPI_GENERIC_STATE *State,
- void *Context);
-
/*
- * UtState - Generic state creation/cache routines
+ * utstate - Generic state creation/cache routines
*/
-
void
AcpiUtPushGenericState (
ACPI_GENERIC_STATE **ListHead,
@@ -755,23 +715,10 @@
AcpiUtDeleteGenericState (
ACPI_GENERIC_STATE *State);
-void
-AcpiUtDeleteGenericStateCache (
- void);
-
-void
-AcpiUtDeleteObjectCache (
- void);
/*
- * utmisc
+ * utmath
*/
-
-void
-AcpiUtPrintString (
- char *String,
- UINT8 MaxLength);
-
ACPI_STATUS
AcpiUtDivide (
ACPI_INTEGER InDividend,
@@ -786,13 +733,53 @@
ACPI_INTEGER *OutQuotient,
UINT32 *OutRemainder);
+/*
+ * utmisc
+ */
+const char *
+AcpiUtValidateException (
+ ACPI_STATUS Status);
+
+BOOLEAN
+AcpiUtIsAmlTable (
+ ACPI_TABLE_HEADER *Table);
+
+ACPI_STATUS
+AcpiUtAllocateOwnerId (
+ ACPI_OWNER_ID *OwnerId);
+
+void
+AcpiUtReleaseOwnerId (
+ ACPI_OWNER_ID *OwnerId);
+
+ACPI_STATUS
+AcpiUtWalkPackageTree (
+ ACPI_OPERAND_OBJECT *SourceObject,
+ void *TargetObject,
+ ACPI_PKG_CALLBACK WalkCallback,
+ void *Context);
+
+void
+AcpiUtStrupr (
+ char *SrcString);
+
+void
+AcpiUtPrintString (
+ char *String,
+ UINT8 MaxLength);
+
BOOLEAN
AcpiUtValidAcpiName (
UINT32 Name);
+ACPI_NAME
+AcpiUtRepairName (
+ char *Name);
+
BOOLEAN
-AcpiUtValidAcpiCharacter (
- char Character);
+AcpiUtValidAcpiChar (
+ char Character,
+ ACPI_NATIVE_UINT Position);
ACPI_STATUS
AcpiUtStrtoul64 (
@@ -804,19 +791,6 @@
#define ACPI_ANY_BASE 0
-char *
-AcpiUtStrupr (
- char *SrcString);
-
-UINT8 *
-AcpiUtGetResourceEndTag (
- ACPI_OPERAND_OBJECT *ObjDesc);
-
-UINT8
-AcpiUtGenerateChecksum (
- UINT8 *Buffer,
- UINT32 Length);
-
UINT32
AcpiUtDwordByteSwap (
UINT32 Value);
@@ -831,26 +805,76 @@
UINT8 Type,
ACPI_NAMESPACE_NODE *ObjHandle,
char *Path);
-
#endif
/*
- * Utalloc - memory allocation and object caching
+ * utresrc
*/
+ACPI_STATUS
+AcpiUtWalkAmlResources (
+ UINT8 *Aml,
+ ACPI_SIZE AmlLength,
+ ACPI_WALK_AML_CALLBACK UserFunction,
+ void *Context);
-void *
-AcpiUtAcquireFromCache (
- UINT32 ListId);
+ACPI_STATUS
+AcpiUtValidateResource (
+ void *Aml,
+ UINT8 *ReturnIndex);
-void
-AcpiUtReleaseToCache (
- UINT32 ListId,
- void *Object);
+UINT32
+AcpiUtGetDescriptorLength (
+ void *Aml);
+
+UINT16
+AcpiUtGetResourceLength (
+ void *Aml);
+
+UINT8
+AcpiUtGetResourceHeaderLength (
+ void *Aml);
+
+UINT8
+AcpiUtGetResourceType (
+ void *Aml);
+
+ACPI_STATUS
+AcpiUtGetResourceEndTag (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT8 **EndTag);
+
+
+/*
+ * utmutex - mutex support
+ */
+ACPI_STATUS
+AcpiUtMutexInitialize (
+ void);
void
-AcpiUtDeleteGenericCache (
- UINT32 ListId);
+AcpiUtMutexTerminate (
+ void);
+
+ACPI_STATUS
+AcpiUtAcquireMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+ACPI_STATUS
+AcpiUtReleaseMutex (
+ ACPI_MUTEX_HANDLE MutexId);
+
+
+/*
+ * utalloc - memory allocation and object caching
+ */
+ACPI_STATUS
+AcpiUtCreateCaches (
+ void);
+
+ACPI_STATUS
+AcpiUtDeleteCaches (
+ void);
ACPI_STATUS
AcpiUtValidateBuffer (
@@ -861,9 +885,6 @@
ACPI_BUFFER *Buffer,
ACPI_SIZE RequiredLength);
-
-/* Memory allocation functions */
-
void *
AcpiUtAllocate (
ACPI_SIZE Size,
@@ -872,15 +893,13 @@
UINT32 Line);
void *
-AcpiUtCallocate (
+AcpiUtAllocateZeroed (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
UINT32 Line);
-
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-
void *
AcpiUtAllocateAndTrack (
ACPI_SIZE Size,
@@ -889,7 +908,7 @@
UINT32 Line);
void *
-AcpiUtCallocateAndTrack (
+AcpiUtAllocateZeroedAndTrack (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
@@ -902,29 +921,6 @@
char *Module,
UINT32 Line);
-ACPI_DEBUG_MEM_BLOCK *
-AcpiUtFindAllocation (
- UINT32 ListId,
- void *Allocation);
-
-ACPI_STATUS
-AcpiUtTrackAllocation (
- UINT32 ListId,
- ACPI_DEBUG_MEM_BLOCK *Address,
- ACPI_SIZE Size,
- UINT8 AllocType,
- UINT32 Component,
- char *Module,
- UINT32 Line);
-
-ACPI_STATUS
-AcpiUtRemoveAllocation (
- UINT32 ListId,
- ACPI_DEBUG_MEM_BLOCK *Address,
- UINT32 Component,
- char *Module,
- UINT32 Line);
-
void
AcpiUtDumpAllocationInfo (
void);
@@ -933,7 +929,14 @@
AcpiUtDumpAllocations (
UINT32 Component,
char *Module);
-#endif
+ACPI_STATUS
+AcpiUtCreateList (
+ char *ListName,
+ UINT16 ObjectSize,
+ ACPI_MEMORY_LIST **ReturnCache);
+
+
+#endif
#endif /* _ACUTILS_H */
Index: tbutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/tbutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/tbutils.c -L sys/contrib/dev/acpica/tbutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/tbutils.c
+++ sys/contrib/dev/acpica/tbutils.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: tbutils - Table manipulation utilities
- * $Revision: 61 $
+ * Module Name: tbutils - table utilities
+ * $Revision: 1.88 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,204 +119,476 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/actables.h>
-
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbutils")
+/* Local prototypes */
+
+static ACPI_PHYSICAL_ADDRESS
+AcpiTbGetRootTableEntry (
+ UINT8 *TableEntry,
+ ACPI_NATIVE_UINT TableEntrySize);
+
/*******************************************************************************
*
- * FUNCTION: AcpiTbHandleToObject
+ * FUNCTION: AcpiTbTablesLoaded
*
- * PARAMETERS: TableId - Id for which the function is searching
- * TableDesc - Pointer to return the matching table
- * descriptor.
+ * PARAMETERS: None
*
- * RETURN: Search the tables to find one with a matching TableId and
- * return a pointer to that table descriptor.
+ * RETURN: TRUE if required ACPI tables are loaded
+ *
+ * DESCRIPTION: Determine if the minimum required ACPI tables are present
+ * (FADT, FACS, DSDT)
*
******************************************************************************/
-ACPI_STATUS
-AcpiTbHandleToObject (
- UINT16 TableId,
- ACPI_TABLE_DESC **ReturnTableDesc)
+BOOLEAN
+AcpiTbTablesLoaded (
+ void)
{
- UINT32 i;
- ACPI_TABLE_DESC *TableDesc;
+
+ if (AcpiGbl_RootTableList.Count >= 3)
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
- ACPI_FUNCTION_NAME ("TbHandleToObject");
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbPrintTableHeader
+ *
+ * PARAMETERS: Address - Table physical address
+ * Header - Table header
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print an ACPI table header. Special cases for FACS and RSDP.
+ *
+ ******************************************************************************/
+void
+AcpiTbPrintTableHeader (
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Header)
+{
- for (i = 0; i < ACPI_TABLE_MAX; i++)
+ if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_FACS))
{
- TableDesc = AcpiGbl_TableLists[i].Next;
- while (TableDesc)
- {
- if (TableDesc->TableId == TableId)
- {
- *ReturnTableDesc = TableDesc;
- return (AE_OK);
- }
+ /* FACS only has signature and length fields of common table header */
- TableDesc = TableDesc->Next;
- }
+ ACPI_INFO ((AE_INFO, "%4.4s @ 0x%p/0x%04X",
+ Header->Signature, ACPI_CAST_PTR (void, Address), Header->Length));
}
+ else if (ACPI_COMPARE_NAME (Header->Signature, ACPI_SIG_RSDP))
+ {
+ /* RSDP has no common fields */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "TableId=%X does not exist\n", TableId));
- return (AE_BAD_PARAMETER);
+ ACPI_INFO ((AE_INFO, "RSDP @ 0x%p/0x%04X (v%3.3d %6.6s)",
+ ACPI_CAST_PTR (void, Address),
+ (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision > 0) ?
+ ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Length : 20,
+ ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->Revision,
+ ACPI_CAST_PTR (ACPI_TABLE_RSDP, Header)->OemId));
+ }
+ else
+ {
+ /* Standard ACPI table with full common header */
+
+ ACPI_INFO ((AE_INFO,
+ "%4.4s @ 0x%p/0x%04X (v%3.3d %6.6s %8.8s 0x%08X %4.4s 0x%08X)",
+ Header->Signature, ACPI_CAST_PTR (void, Address),
+ Header->Length, Header->Revision, Header->OemId,
+ Header->OemTableId, Header->OemRevision, Header->AslCompilerId,
+ Header->AslCompilerRevision));
+ }
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbValidateTableHeader
+ * FUNCTION: AcpiTbValidateChecksum
*
- * PARAMETERS: TableHeader - Logical pointer to the table
+ * PARAMETERS: Table - ACPI table to verify
+ * Length - Length of entire table
*
* RETURN: Status
*
- * DESCRIPTION: Check an ACPI table header for validity
- *
- * NOTE: Table pointers are validated as follows:
- * 1) Table pointer must point to valid physical memory
- * 2) Signature must be 4 ASCII chars, even if we don't recognize the
- * name
- * 3) Table must be readable for length specified in the header
- * 4) Table checksum must be valid (with the exception of the FACS
- * which has no checksum because it contains variable fields)
+ * DESCRIPTION: Verifies that the table checksums to zero. Optionally returns
+ * exception on bad checksum.
*
******************************************************************************/
ACPI_STATUS
-AcpiTbValidateTableHeader (
- ACPI_TABLE_HEADER *TableHeader)
+AcpiTbVerifyChecksum (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length)
{
- ACPI_NAME Signature;
+ UINT8 Checksum;
- ACPI_FUNCTION_NAME ("TbValidateTableHeader");
+ /* Compute the checksum on the table */
+ Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Length);
- /* Verify that this is a valid address */
+ /* Checksum ok? (should be zero) */
- if (!AcpiOsReadable (TableHeader, sizeof (ACPI_TABLE_HEADER)))
+ if (Checksum)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Cannot read table header at %p\n", TableHeader));
- return (AE_BAD_ADDRESS);
+ ACPI_WARNING ((AE_INFO,
+ "Incorrect checksum in table [%4.4s] - %2.2X, should be %2.2X",
+ Table->Signature, Table->Checksum, (UINT8) (Table->Checksum - Checksum)));
+
+#if (ACPI_CHECKSUM_ABORT)
+ return (AE_BAD_CHECKSUM);
+#endif
}
- /* Ensure that the signature is 4 ASCII characters */
+ return (AE_OK);
+}
- ACPI_MOVE_32_TO_32 (&Signature, TableHeader->Signature);
- if (!AcpiUtValidAcpiName (Signature))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Table signature at %p [%p] has invalid characters\n",
- TableHeader, &Signature));
- ACPI_REPORT_WARNING (("Invalid table signature found: [%4.4s]\n",
- (char *) &Signature));
- ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_BAD_SIGNATURE);
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbChecksum
+ *
+ * PARAMETERS: Buffer - Pointer to memory region to be checked
+ * Length - Length of this memory region
+ *
+ * RETURN: Checksum (UINT8)
+ *
+ * DESCRIPTION: Calculates circular checksum of memory region.
+ *
+ ******************************************************************************/
- /* Validate the table length */
+UINT8
+AcpiTbChecksum (
+ UINT8 *Buffer,
+ ACPI_NATIVE_UINT Length)
+{
+ UINT8 Sum = 0;
+ UINT8 *End = Buffer + Length;
- if (TableHeader->Length < sizeof (ACPI_TABLE_HEADER))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid length in table header %p name %4.4s\n",
- TableHeader, (char *) &Signature));
- ACPI_REPORT_WARNING (("Invalid table header length (0x%X) found\n",
- (UINT32) TableHeader->Length));
- ACPI_DUMP_BUFFER (TableHeader, sizeof (ACPI_TABLE_HEADER));
- return (AE_BAD_HEADER);
+ while (Buffer < End)
+ {
+ Sum = (UINT8) (Sum + *(Buffer++));
}
- return (AE_OK);
+ return Sum;
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbVerifyTableChecksum
+ * FUNCTION: AcpiTbInstallTable
*
- * PARAMETERS: *TableHeader - ACPI table to verify
+ * PARAMETERS: Address - Physical address of DSDT or FACS
+ * Flags - Flags
+ * Signature - Table signature, NULL if no need to
+ * match
+ * TableIndex - Index into root table array
*
- * RETURN: 8 bit checksum of table
+ * RETURN: None
*
- * DESCRIPTION: Does an 8 bit checksum of table and returns status. A correct
- * table should have a checksum of 0.
+ * DESCRIPTION: Install an ACPI table into the global data structure.
*
******************************************************************************/
-ACPI_STATUS
-AcpiTbVerifyTableChecksum (
- ACPI_TABLE_HEADER *TableHeader)
+void
+AcpiTbInstallTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT8 Flags,
+ char *Signature,
+ ACPI_NATIVE_UINT TableIndex)
{
- UINT8 Checksum;
- ACPI_STATUS Status = AE_OK;
+ ACPI_TABLE_HEADER *Table;
- ACPI_FUNCTION_TRACE ("TbVerifyTableChecksum");
+ if (!Address)
+ {
+ ACPI_ERROR ((AE_INFO, "Null physical address for ACPI table [%s]",
+ Signature));
+ return;
+ }
+ /* Map just the table header */
- /* Compute the checksum on the table */
+ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
+ if (!Table)
+ {
+ return;
+ }
- Checksum = AcpiTbChecksum (TableHeader, TableHeader->Length);
+ /* If a particular signature is expected, signature must match */
- /* Return the appropriate exception */
+ if (Signature &&
+ !ACPI_COMPARE_NAME (Table->Signature, Signature))
+ {
+ ACPI_ERROR ((AE_INFO, "Invalid signature 0x%X for ACPI table [%s]",
+ *ACPI_CAST_PTR (UINT32, Table->Signature), Signature));
+ goto UnmapAndExit;
+ }
- if (Checksum)
+ /* Initialize the table entry */
+
+ AcpiGbl_RootTableList.Tables[TableIndex].Address = Address;
+ AcpiGbl_RootTableList.Tables[TableIndex].Length = Table->Length;
+ AcpiGbl_RootTableList.Tables[TableIndex].Flags = Flags;
+
+ ACPI_MOVE_32_TO_32 (
+ &(AcpiGbl_RootTableList.Tables[TableIndex].Signature),
+ Table->Signature);
+
+ AcpiTbPrintTableHeader (Address, Table);
+
+ if (TableIndex == ACPI_TABLE_INDEX_DSDT)
{
- ACPI_REPORT_WARNING (("Invalid checksum in table [%4.4s] (%02X, sum %02X is not zero)\n",
- TableHeader->Signature, (UINT32) TableHeader->Checksum, (UINT32) Checksum));
+ /* Global integer width is based upon revision of the DSDT */
- Status = AE_BAD_CHECKSUM;
+ AcpiUtSetIntegerWidth (Table->Revision);
}
- return_ACPI_STATUS (Status);
+
+UnmapAndExit:
+ AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
}
/*******************************************************************************
*
- * FUNCTION: AcpiTbChecksum
+ * FUNCTION: AcpiTbGetRootTableEntry
+ *
+ * PARAMETERS: TableEntry - Pointer to the RSDT/XSDT table entry
+ * TableEntrySize - sizeof 32 or 64 (RSDT or XSDT)
*
- * PARAMETERS: Buffer - Buffer to checksum
- * Length - Size of the buffer
+ * RETURN: Physical address extracted from the root table
*
- * RETURNS 8 bit checksum of buffer
+ * DESCRIPTION: Get one root table entry. Handles 32-bit and 64-bit cases on
+ * both 32-bit and 64-bit platforms
*
- * DESCRIPTION: Computes an 8 bit checksum of the buffer(length) and returns it.
+ * NOTE: ACPI_PHYSICAL_ADDRESS is 32-bit on 32-bit platforms, 64-bit on
+ * 64-bit platforms.
*
******************************************************************************/
-UINT8
-AcpiTbChecksum (
- void *Buffer,
- UINT32 Length)
+static ACPI_PHYSICAL_ADDRESS
+AcpiTbGetRootTableEntry (
+ UINT8 *TableEntry,
+ ACPI_NATIVE_UINT TableEntrySize)
{
- const UINT8 *limit;
- const UINT8 *rover;
- UINT8 sum = 0;
+ UINT64 Address64;
- if (Buffer && Length)
+ /*
+ * Get the table physical address (32-bit for RSDT, 64-bit for XSDT):
+ * Note: Addresses are 32-bit aligned (not 64) in both RSDT and XSDT
+ */
+ if (TableEntrySize == sizeof (UINT32))
{
- /* Buffer and Length are valid */
-
- limit = (UINT8 *) Buffer + Length;
+ /*
+ * 32-bit platform, RSDT: Return 32-bit table entry
+ * 64-bit platform, RSDT: Expand 32-bit to 64-bit and return
+ */
+ return ((ACPI_PHYSICAL_ADDRESS) (*ACPI_CAST_PTR (UINT32, TableEntry)));
+ }
+ else
+ {
+ /*
+ * 32-bit platform, XSDT: Truncate 64-bit to 32-bit and return
+ * 64-bit platform, XSDT: Move (unaligned) 64-bit to local, return 64-bit
+ */
+ ACPI_MOVE_64_TO_64 (&Address64, TableEntry);
- for (rover = Buffer; rover < limit; rover++)
+#if ACPI_MACHINE_WIDTH == 32
+ if (Address64 > ACPI_UINT32_MAX)
{
- sum = (UINT8) (sum + *rover);
+ /* Will truncate 64-bit address to 32 bits, issue warning */
+
+ ACPI_WARNING ((AE_INFO,
+ "64-bit Physical Address in XSDT is too large (%8.8X%8.8X), truncating",
+ ACPI_FORMAT_UINT64 (Address64)));
}
+#endif
+ return ((ACPI_PHYSICAL_ADDRESS) (Address64));
}
- return (sum);
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbParseRootTable
+ *
+ * PARAMETERS: Rsdp - Pointer to the RSDP
+ * Flags - Flags
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: This function is called to parse the Root System Description
+ * Table (RSDT or XSDT)
+ *
+ * NOTE: Tables are mapped (not copied) for efficiency. The FACS must
+ * be mapped and cannot be copied because it contains the actual
+ * memory location of the ACPI Global Lock.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiTbParseRootTable (
+ ACPI_PHYSICAL_ADDRESS RsdpAddress,
+ UINT8 Flags)
+{
+ ACPI_TABLE_RSDP *Rsdp;
+ ACPI_NATIVE_UINT TableEntrySize;
+ ACPI_NATIVE_UINT i;
+ UINT32 TableCount;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_PHYSICAL_ADDRESS Address;
+ UINT32 Length;
+ UINT8 *TableEntry;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (TbParseRootTable);
+
+
+ /*
+ * Map the entire RSDP and extract the address of the RSDT or XSDT
+ */
+ Rsdp = AcpiOsMapMemory (RsdpAddress, sizeof (ACPI_TABLE_RSDP));
+ if (!Rsdp)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ AcpiTbPrintTableHeader (RsdpAddress, ACPI_CAST_PTR (ACPI_TABLE_HEADER, Rsdp));
+
+ /* Differentiate between RSDT and XSDT root tables */
+
+ if (Rsdp->Revision > 1 && Rsdp->XsdtPhysicalAddress)
+ {
+ /*
+ * Root table is an XSDT (64-bit physical addresses). We must use the
+ * XSDT if the revision is > 1 and the XSDT pointer is present, as per
+ * the ACPI specification.
+ */
+ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->XsdtPhysicalAddress;
+ TableEntrySize = sizeof (UINT64);
+ }
+ else
+ {
+ /* Root table is an RSDT (32-bit physical addresses) */
+
+ Address = (ACPI_PHYSICAL_ADDRESS) Rsdp->RsdtPhysicalAddress;
+ TableEntrySize = sizeof (UINT32);
+ }
+
+ /*
+ * It is not possible to map more than one entry in some environments,
+ * so unmap the RSDP here before mapping other tables
+ */
+ AcpiOsUnmapMemory (Rsdp, sizeof (ACPI_TABLE_RSDP));
+
+
+ /* Map the RSDT/XSDT table header to get the full table length */
+
+ Table = AcpiOsMapMemory (Address, sizeof (ACPI_TABLE_HEADER));
+ if (!Table)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ AcpiTbPrintTableHeader (Address, Table);
+
+ /* Get the length of the full table, verify length and map entire table */
+
+ Length = Table->Length;
+ AcpiOsUnmapMemory (Table, sizeof (ACPI_TABLE_HEADER));
+
+ if (Length < sizeof (ACPI_TABLE_HEADER))
+ {
+ ACPI_ERROR ((AE_INFO, "Invalid length 0x%X in RSDT/XSDT", Length));
+ return_ACPI_STATUS (AE_INVALID_TABLE_LENGTH);
+ }
+
+ Table = AcpiOsMapMemory (Address, Length);
+ if (!Table)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ /* Validate the root table checksum */
+
+ Status = AcpiTbVerifyChecksum (Table, Length);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsUnmapMemory (Table, Length);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Calculate the number of tables described in the root table */
+
+ TableCount = (UINT32) ((Table->Length - sizeof (ACPI_TABLE_HEADER)) / TableEntrySize);
+
+ /*
+ * First two entries in the table array are reserved for the DSDT and FACS,
+ * which are not actually present in the RSDT/XSDT - they come from the FADT
+ */
+ TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER);
+ AcpiGbl_RootTableList.Count = 2;
+
+ /*
+ * Initialize the root table array from the RSDT/XSDT
+ */
+ for (i = 0; i < TableCount; i++)
+ {
+ if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
+ {
+ /* There is no more room in the root table array, attempt resize */
+
+ Status = AcpiTbResizeRootTableList ();
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_WARNING ((AE_INFO, "Truncating %u table entries!",
+ (unsigned) (AcpiGbl_RootTableList.Size - AcpiGbl_RootTableList.Count)));
+ break;
+ }
+ }
+
+ /* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
+
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address =
+ AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);
+
+ TableEntry += TableEntrySize;
+ AcpiGbl_RootTableList.Count++;
+ }
+
+ /*
+ * It is not possible to map more than one entry in some environments,
+ * so unmap the root table here before mapping other tables
+ */
+ AcpiOsUnmapMemory (Table, Length);
+
+ /*
+ * Complete the initialization of the root table array by examining
+ * the header of each table
+ */
+ for (i = 2; i < AcpiGbl_RootTableList.Count; i++)
+ {
+ AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address,
+ Flags, NULL, i);
+
+ /* Special case for FADT - get the DSDT and FACS */
+
+ if (ACPI_COMPARE_NAME (
+ &AcpiGbl_RootTableList.Tables[i].Signature, ACPI_SIG_FADT))
+ {
+ AcpiTbParseFadt (i, Flags);
+ }
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
Index: dsopcode.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dsopcode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dsopcode.c -L sys/contrib/dev/acpica/dsopcode.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dsopcode.c
+++ sys/contrib/dev/acpica/dsopcode.c
@@ -2,7 +2,7 @@
*
* Module Name: dsopcode - Dispatcher Op Region support and handling of
* "control" opcodes
- * $Revision: 95 $
+ * $Revision: 1.111 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,12 +128,31 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsopcode")
+/* Local prototypes */
-/*****************************************************************************
+static ACPI_STATUS
+AcpiDsExecuteArguments (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_NAMESPACE_NODE *ScopeNode,
+ UINT32 AmlLength,
+ UINT8 *AmlStart);
+
+static ACPI_STATUS
+AcpiDsInitBufferField (
+ UINT16 AmlOpcode,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_OPERAND_OBJECT *BufferDesc,
+ ACPI_OPERAND_OBJECT *OffsetDesc,
+ ACPI_OPERAND_OBJECT *LengthDesc,
+ ACPI_OPERAND_OBJECT *ResultDesc);
+
+
+/*******************************************************************************
*
* FUNCTION: AcpiDsExecuteArguments
*
- * PARAMETERS: Node - Parent NS node
+ * PARAMETERS: Node - Object NS node
+ * ScopeNode - Parent NS node
* AmlLength - Length of executable AML
* AmlStart - Pointer to the AML
*
@@ -141,9 +160,9 @@
*
* DESCRIPTION: Late (deferred) execution of region or field arguments
*
- ****************************************************************************/
+ ******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsExecuteArguments (
ACPI_NAMESPACE_NODE *Node,
ACPI_NAMESPACE_NODE *ScopeNode,
@@ -155,7 +174,7 @@
ACPI_WALK_STATE *WalkState;
- ACPI_FUNCTION_TRACE ("DsExecuteArguments");
+ ACPI_FUNCTION_TRACE (DsExecuteArguments);
/*
@@ -176,15 +195,16 @@
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
- AmlLength, NULL, 1);
+ AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Mark this parse as a deferred opcode */
@@ -197,8 +217,7 @@
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
{
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Get and init the Op created above */
@@ -221,29 +240,32 @@
WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
if (!WalkState)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
/* Execute the opcode and arguments */
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, AmlStart,
- AmlLength, NULL, 3);
+ AmlLength, NULL, ACPI_IMODE_EXECUTE);
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Mark this execution as a deferred opcode */
WalkState->DeferredNode = Node;
Status = AcpiPsParseAml (WalkState);
+
+Cleanup:
AcpiPsDeleteParseTree (Op);
return_ACPI_STATUS (Status);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsGetBufferFieldArguments
*
@@ -254,7 +276,7 @@
* DESCRIPTION: Get BufferField Buffer and Index. This implements the late
* evaluation of these field attributes.
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsGetBufferFieldArguments (
@@ -265,7 +287,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsGetBufferFieldArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetBufferFieldArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@@ -290,7 +312,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsGetBufferArguments
*
@@ -301,7 +323,7 @@
* DESCRIPTION: Get Buffer length and initializer byte list. This implements
* the late evaluation of these attributes.
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsGetBufferArguments (
@@ -311,7 +333,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsGetBufferArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetBufferArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@@ -324,8 +346,8 @@
Node = ObjDesc->Buffer.Node;
if (!Node)
{
- ACPI_REPORT_ERROR ((
- "No pointer back to NS node in buffer obj %p\n", ObjDesc));
+ ACPI_ERROR ((AE_INFO,
+ "No pointer back to NS node in buffer obj %p", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -339,7 +361,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsGetPackageArguments
*
@@ -350,7 +372,7 @@
* DESCRIPTION: Get Package length and initializer byte list. This implements
* the late evaluation of these attributes.
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsGetPackageArguments (
@@ -360,7 +382,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsGetPackageArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetPackageArguments, ObjDesc);
if (ObjDesc->Common.Flags & AOPOBJ_DATA_VALID)
@@ -373,8 +395,8 @@
Node = ObjDesc->Package.Node;
if (!Node)
{
- ACPI_REPORT_ERROR ((
- "No pointer back to NS node in package %p\n", ObjDesc));
+ ACPI_ERROR ((AE_INFO,
+ "No pointer back to NS node in package %p", ObjDesc));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -410,7 +432,7 @@
ACPI_OPERAND_OBJECT *ExtraDesc;
- ACPI_FUNCTION_TRACE_PTR ("DsGetRegionArguments", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsGetRegionArguments, ObjDesc);
if (ObjDesc->Region.Flags & AOPOBJ_DATA_VALID)
@@ -437,21 +459,43 @@
Status = AcpiDsExecuteArguments (Node, AcpiNsGetParentNode (Node),
ExtraDesc->Extra.AmlLength, ExtraDesc->Extra.AmlStart);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Validate the region address/length via the host OS */
+
+ Status = AcpiOsValidateAddress (ObjDesc->Region.SpaceId,
+ ObjDesc->Region.Address, (ACPI_SIZE) ObjDesc->Region.Length);
+ if (ACPI_FAILURE (Status))
+ {
+ /*
+ * Invalid address/length. We will emit an error message and mark
+ * the region as invalid, so that it will cause an additional error if
+ * it is ever used. Then return AE_OK.
+ */
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "During address validation of OpRegion [%4.4s]", Node->Name.Ascii));
+ ObjDesc->Common.Flags |= AOPOBJ_INVALID;
+ Status = AE_OK;
+ }
+
return_ACPI_STATUS (Status);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsInitializeRegion
*
- * PARAMETERS: Op - A valid region Op object
+ * PARAMETERS: ObjHandle - Region namespace node
*
* RETURN: Status
*
* DESCRIPTION: Front end to EvInitializeRegion
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsInitializeRegion (
@@ -470,7 +514,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsInitBufferField
*
@@ -478,16 +522,16 @@
* ObjDesc - BufferField object
* BufferDesc - Host Buffer
* OffsetDesc - Offset into buffer
- * Length - Length of field (CREATE_FIELD_OP only)
- * Result - Where to store the result
+ * LengthDesc - Length of field (CREATE_FIELD_OP only)
+ * ResultDesc - Where to store the result
*
* RETURN: Status
*
* DESCRIPTION: Perform actual initialization of a buffer field
*
- ****************************************************************************/
+ ******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsInitBufferField (
UINT16 AmlOpcode,
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -503,15 +547,15 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsInitBufferField", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (DsInitBufferField, ObjDesc);
/* Host object must be a Buffer */
if (ACPI_GET_OBJECT_TYPE (BufferDesc) != ACPI_TYPE_BUFFER)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Target of Create Field is not a Buffer object - %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Target of Create Field is not a Buffer object - %s",
AcpiUtGetObjectTypeName (BufferDesc)));
Status = AE_AML_OPERAND_TYPE;
@@ -525,8 +569,10 @@
*/
if (ACPI_GET_DESCRIPTOR_TYPE (ResultDesc) != ACPI_DESC_TYPE_NAMED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) destination not a NS Node [%s]\n",
- AcpiPsGetOpcodeName (AmlOpcode), AcpiUtGetDescriptorName (ResultDesc)));
+ ACPI_ERROR ((AE_INFO,
+ "(%s) destination not a NS Node [%s]",
+ AcpiPsGetOpcodeName (AmlOpcode),
+ AcpiUtGetDescriptorName (ResultDesc)));
Status = AE_AML_OPERAND_TYPE;
goto Cleanup;
@@ -543,9 +589,19 @@
/* Offset is in bits, count is in bits */
+ FieldFlags = AML_FIELD_ACCESS_BYTE;
BitOffset = Offset;
BitCount = (UINT32) LengthDesc->Integer.Value;
- FieldFlags = AML_FIELD_ACCESS_BYTE;
+
+ /* Must have a valid (>0) bit count */
+
+ if (BitCount == 0)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Attempt to CreateField of length zero"));
+ Status = AE_AML_OPERAND_VALUE;
+ goto Cleanup;
+ }
break;
case AML_CREATE_BIT_FIELD_OP:
@@ -595,8 +651,8 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown field creation opcode %02x\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown field creation opcode %02x",
AmlOpcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
@@ -607,19 +663,20 @@
if ((BitOffset + BitCount) >
(8 * (UINT32) BufferDesc->Buffer.Length))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field [%4.4s] size %d exceeds Buffer [%4.4s] size %d (bits)\n",
- AcpiUtGetNodeName (ResultDesc),
- BitOffset + BitCount,
- AcpiUtGetNodeName (BufferDesc->Buffer.Node),
- 8 * (UINT32) BufferDesc->Buffer.Length));
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] at %d exceeds Buffer [%4.4s] size %d (bits)",
+ AcpiUtGetNodeName (ResultDesc),
+ BitOffset + BitCount,
+ AcpiUtGetNodeName (BufferDesc->Buffer.Node),
+ 8 * (UINT32) BufferDesc->Buffer.Length));
Status = AE_AML_BUFFER_LIMIT;
goto Cleanup;
}
/*
* Initialize areas of the field object that are common to all fields
- * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK), UPDATE_RULE = 0 (UPDATE_PRESERVE)
+ * For FieldFlags, use LOCK_RULE = 0 (NO_LOCK),
+ * UPDATE_RULE = 0 (UPDATE_PRESERVE)
*/
Status = AcpiExPrepCommonFieldObject (ObjDesc, FieldFlags, 0,
BitOffset, BitCount);
@@ -632,8 +689,8 @@
/* Reference count for BufferDesc inherits ObjDesc count */
- BufferDesc->Common.ReferenceCount = (UINT16) (BufferDesc->Common.ReferenceCount +
- ObjDesc->Common.ReferenceCount);
+ BufferDesc->Common.ReferenceCount = (UINT16)
+ (BufferDesc->Common.ReferenceCount + ObjDesc->Common.ReferenceCount);
Cleanup:
@@ -665,7 +722,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsEvalBufferFieldOperands
*
@@ -677,7 +734,7 @@
* DESCRIPTION: Get BufferField Buffer and Index
* Called from AcpiDsExecEndOp during BufferField parse tree walk
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsEvalBufferFieldOperands (
@@ -690,7 +747,7 @@
ACPI_PARSE_OBJECT *NextOp;
- ACPI_FUNCTION_TRACE_PTR ("DsEvalBufferFieldOperands", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsEvalBufferFieldOperands, Op);
/*
@@ -728,7 +785,7 @@
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "(%s) bad operand(s) (%X)\n",
+ ACPI_ERROR ((AE_INFO, "(%s) bad operand(s) (%X)",
AcpiPsGetOpcodeName (Op->Common.AmlOpcode), Status));
return_ACPI_STATUS (Status);
@@ -757,7 +814,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsEvalRegionOperands
*
@@ -769,7 +826,7 @@
* DESCRIPTION: Get region address and length
* Called from AcpiDsExecEndOp during OpRegion parse tree walk
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsEvalRegionOperands (
@@ -783,11 +840,12 @@
ACPI_PARSE_OBJECT *NextOp;
- ACPI_FUNCTION_TRACE_PTR ("DsEvalRegionOperands", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsEvalRegionOperands, Op);
/*
- * This is where we evaluate the address and length fields of the OpRegion declaration
+ * This is where we evaluate the address and length fields of the
+ * OpRegion declaration
*/
Node = Op->Common.Node;
@@ -809,7 +867,8 @@
/* Resolve the length and address operands to numbers */
- Status = AcpiExResolveOperands (Op->Common.AmlOpcode, ACPI_WALK_OPERANDS, WalkState);
+ Status = AcpiExResolveOperands (Op->Common.AmlOpcode,
+ ACPI_WALK_OPERANDS, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -840,7 +899,8 @@
*/
OperandDesc = WalkState->Operands[WalkState->NumOperands - 2];
- ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) OperandDesc->Integer.Value;
+ ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS)
+ OperandDesc->Integer.Value;
AcpiUtRemoveReference (OperandDesc);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "RgnObj %p Addr %8.8X%8.8X Len %X\n",
@@ -856,7 +916,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsEvalDataObjectOperands
*
@@ -866,11 +926,10 @@
*
* RETURN: Status
*
- * DESCRIPTION: Get the operands and complete the following data objec types:
- * Buffer
- * Package
+ * DESCRIPTION: Get the operands and complete the following data object types:
+ * Buffer, Package.
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsEvalDataObjectOperands (
@@ -883,11 +942,17 @@
UINT32 Length;
- ACPI_FUNCTION_TRACE ("DsEvalDataObjectOperands");
+ ACPI_FUNCTION_TRACE (DsEvalDataObjectOperands);
/* The first operand (for all of these data objects) is the length */
+ /*
+ * Set proper index into operand stack for AcpiDsObjStackPush
+ * invoked inside AcpiDsCreateOperand.
+ */
+ WalkState->OperandIndex = WalkState->NumOperands;
+
Status = AcpiDsCreateOperand (WalkState, Op->Common.Value.Arg, 1);
if (ACPI_FAILURE (Status))
{
@@ -940,7 +1005,7 @@
if (ACPI_SUCCESS (Status))
{
/*
- * Return the object in the WalkState, unless the parent is a package --
+ * Return the object in the WalkState, unless the parent is a package -
* in this case, the return object will be stored in the parse tree
* for the package.
*/
@@ -980,7 +1045,7 @@
ACPI_GENERIC_STATE *ControlState;
- ACPI_FUNCTION_NAME ("DsExecBeginControlOp");
+ ACPI_FUNCTION_NAME (DsExecBeginControlOp);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op=%p Opcode=%2.2X State=%p\n", Op,
@@ -1063,7 +1128,7 @@
ACPI_GENERIC_STATE *ControlState;
- ACPI_FUNCTION_NAME ("DsExecEndControlOp");
+ ACPI_FUNCTION_NAME (DsExecEndControlOp);
switch (Op->Common.AmlOpcode)
@@ -1104,7 +1169,8 @@
Status = AE_CTRL_PENDING;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[WHILE_OP] termination! Op=%p\n", Op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "[WHILE_OP] termination! Op=%p\n",Op));
/* Pop this control state and free it */
@@ -1127,6 +1193,10 @@
*/
if (Op->Common.Value.Arg)
{
+ /* Since we have a real Return(), delete any implicit return */
+
+ AcpiDsClearImplicitReturn (WalkState);
+
/* Return statement has an immediate operand */
Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
@@ -1153,9 +1223,12 @@
*/
WalkState->ReturnDesc = WalkState->Operands[0];
}
- else if ((WalkState->Results) &&
- (WalkState->Results->Results.NumResults > 0))
+ else if (WalkState->ResultCount)
{
+ /* Since we have a real Return(), delete any implicit return */
+
+ AcpiDsClearImplicitReturn (WalkState);
+
/*
* The return value has come from a previous calculation.
*
@@ -1259,7 +1332,7 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown control opcode=%X Op=%p\n",
+ ACPI_ERROR ((AE_INFO, "Unknown control opcode=%X Op=%p",
Op->Common.AmlOpcode, Op));
Status = AE_AML_BAD_OPCODE;
Index: nsutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsutils.c -L sys/contrib/dev/acpica/nsutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsutils.c
+++ sys/contrib/dev/acpica/nsutils.c
@@ -2,7 +2,7 @@
*
* Module Name: nsutils - Utilities for accessing ACPI namespace, accessing
* parents and siblings and Scope manipulation
- * $Revision: 136 $
+ * $Revision: 1.155 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,18 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsutils")
+/* Local prototypes */
+
+static BOOLEAN
+AcpiNsValidPathSeparator (
+ char Sep);
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+ACPI_NAME
+AcpiNsFindParentName (
+ ACPI_NAMESPACE_NODE *NodeToSearch);
+#endif
+
/*******************************************************************************
*
@@ -132,8 +144,8 @@
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- * Message - Error message to use on failure
+ * InternalName - Name or path of the namespace node
+ * LookupStatus - Exception code from NS lookup
*
* RETURN: None
*
@@ -145,23 +157,22 @@
AcpiNsReportError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *InternalName,
ACPI_STATUS LookupStatus)
{
ACPI_STATUS Status;
+ UINT32 BadName;
char *Name = NULL;
- AcpiOsPrintf ("%8s-%04d: *** Error: Looking up ",
- ModuleName, LineNumber);
+ AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
if (LookupStatus == AE_BAD_CHARACTER)
{
/* There is a non-ascii character in the name */
- AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)\n",
- *(ACPI_CAST_PTR (UINT32, InternalName)));
+ ACPI_MOVE_32_TO_32 (&BadName, InternalName);
+ AcpiOsPrintf ("[0x%4.4X] (NON-ASCII)", BadName);
}
else
{
@@ -183,11 +194,11 @@
if (Name)
{
- ACPI_MEM_FREE (Name);
+ ACPI_FREE (Name);
}
}
- AcpiOsPrintf (" in namespace, %s\n",
+ AcpiOsPrintf (" Namespace lookup failure, %s\n",
AcpiFormatException (LookupStatus));
}
@@ -198,8 +209,10 @@
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
* Message - Error message to use on failure
+ * PrefixNode - Prefix relative to the path
+ * Path - Path to the node (optional)
+ * MethodStatus - Execution status
*
* RETURN: None
*
@@ -211,7 +224,6 @@
AcpiNsReportMethodError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *Message,
ACPI_NAMESPACE_NODE *PrefixNode,
char *Path,
@@ -221,18 +233,18 @@
ACPI_NAMESPACE_NODE *Node = PrefixNode;
+ AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
+
if (Path)
{
- Status = AcpiNsGetNodeByPath (Path, PrefixNode,
- ACPI_NS_NO_UPSEARCH, &Node);
+ Status = AcpiNsGetNode (PrefixNode, Path, ACPI_NS_NO_UPSEARCH,
+ &Node);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("ReportMethodError: Could not get node\n");
- return;
+ AcpiOsPrintf ("[Could not get node by pathname]");
}
}
- AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber);
AcpiNsPrintNodePathname (Node, Message);
AcpiOsPrintf (", %s\n", AcpiFormatException (MethodStatus));
}
@@ -242,8 +254,8 @@
*
* FUNCTION: AcpiNsPrintNodePathname
*
- * PARAMETERS: Node - Object
- * Msg - Prefix message
+ * PARAMETERS: Node - Object
+ * Message - Prefix message
*
* DESCRIPTION: Print an object's full namespace pathname
* Manages allocation/freeing of a pathname buffer
@@ -253,7 +265,7 @@
void
AcpiNsPrintNodePathname (
ACPI_NAMESPACE_NODE *Node,
- char *Msg)
+ char *Message)
{
ACPI_BUFFER Buffer;
ACPI_STATUS Status;
@@ -272,13 +284,13 @@
Status = AcpiNsHandleToPathname (Node, &Buffer);
if (ACPI_SUCCESS (Status))
{
- if (Msg)
+ if (Message)
{
- AcpiOsPrintf ("%s ", Msg);
+ AcpiOsPrintf ("%s ", Message);
}
AcpiOsPrintf ("[%s] (Node %p)", (char *) Buffer.Pointer, Node);
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
}
}
@@ -308,7 +320,7 @@
*
* FUNCTION: AcpiNsValidPathSeparator
*
- * PARAMETERS: Sep - Character to be checked
+ * PARAMETERS: Sep - Character to be checked
*
* RETURN: TRUE if a valid path separator
*
@@ -316,7 +328,7 @@
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
AcpiNsValidPathSeparator (
char Sep)
{
@@ -329,26 +341,28 @@
*
* FUNCTION: AcpiNsGetType
*
- * PARAMETERS: Handle - Parent Node to be examined
+ * PARAMETERS: Node - Parent Node to be examined
*
* RETURN: Type field from Node whose handle is passed
*
+ * DESCRIPTION: Return the type of a Namespace node
+ *
******************************************************************************/
ACPI_OBJECT_TYPE
AcpiNsGetType (
ACPI_NAMESPACE_NODE *Node)
{
- ACPI_FUNCTION_TRACE ("NsGetType");
+ ACPI_FUNCTION_TRACE (NsGetType);
if (!Node)
{
- ACPI_REPORT_WARNING (("NsGetType: Null Node input pointer\n"));
- return_VALUE (ACPI_TYPE_ANY);
+ ACPI_WARNING ((AE_INFO, "Null Node parameter"));
+ return_UINT32 (ACPI_TYPE_ANY);
}
- return_VALUE ((ACPI_OBJECT_TYPE) Node->Type);
+ return_UINT32 ((ACPI_OBJECT_TYPE) Node->Type);
}
@@ -356,29 +370,31 @@
*
* FUNCTION: AcpiNsLocal
*
- * PARAMETERS: Type - A namespace object type
+ * PARAMETERS: Type - A namespace object type
*
* RETURN: LOCAL if names must be found locally in objects of the
* passed type, 0 if enclosing scopes should be searched
*
+ * DESCRIPTION: Returns scope rule for the given object type.
+ *
******************************************************************************/
UINT32
AcpiNsLocal (
ACPI_OBJECT_TYPE Type)
{
- ACPI_FUNCTION_TRACE ("NsLocal");
+ ACPI_FUNCTION_TRACE (NsLocal);
if (!AcpiUtValidObjectType (Type))
{
/* Type code out of range */
- ACPI_REPORT_WARNING (("NsLocal: Invalid Object Type\n"));
- return_VALUE (ACPI_NS_NORMAL);
+ ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type));
+ return_UINT32 (ACPI_NS_NORMAL);
}
- return_VALUE ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
+ return_UINT32 ((UINT32) AcpiGbl_NsProperties[Type] & ACPI_NS_LOCAL);
}
@@ -389,7 +405,7 @@
* PARAMETERS: Info - Info struct initialized with the
* external name pointer.
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Calculate the length of the internal (AML) namestring
* corresponding to the external (ASL) namestring.
@@ -484,7 +500,7 @@
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("NsBuildInternalName");
+ ACPI_FUNCTION_TRACE (NsBuildInternalName);
/* Setup the correct prefixes, counts, and pointers */
@@ -621,7 +637,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsInternalizeName");
+ ACPI_FUNCTION_TRACE (NsInternalizeName);
if ((!ExternalName) ||
@@ -638,7 +654,7 @@
/* We need a segment to store the internal name */
- InternalName = ACPI_MEM_CALLOCATE (Info.Length);
+ InternalName = ACPI_ALLOCATE_ZEROED (Info.Length);
if (!InternalName)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -650,7 +666,7 @@
Status = AcpiNsBuildInternalName (&Info);
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (InternalName);
+ ACPI_FREE (InternalName);
return_ACPI_STATUS (Status);
}
@@ -663,14 +679,16 @@
*
* FUNCTION: AcpiNsExternalizeName
*
- * PARAMETERS: *InternalName - Internal representation of name
- * **ConvertedName - Where to return the resulting
- * external representation of name
+ * PARAMETERS: InternalNameLength - Lenth of the internal name below
+ * InternalName - Internal representation of name
+ * ConvertedNameLength - Where the length is returned
+ * ConvertedName - Where the resulting external name
+ * is returned
*
* RETURN: Status
*
* DESCRIPTION: Convert internal name (e.g. 5c 2f 02 5f 50 52 5f 43 50 55 30)
- * to its external form (e.g. "\_PR_.CPU0")
+ * to its external (printable) form (e.g. "\_PR_.CPU0")
*
******************************************************************************/
@@ -689,7 +707,7 @@
ACPI_NATIVE_UINT j = 0;
- ACPI_FUNCTION_TRACE ("NsExternalizeName");
+ ACPI_FUNCTION_TRACE (NsExternalizeName);
if (!InternalNameLength ||
@@ -789,14 +807,14 @@
*/
if (RequiredLength > InternalNameLength)
{
- ACPI_REPORT_ERROR (("NsExternalizeName: Invalid internal name\n"));
+ ACPI_ERROR ((AE_INFO, "Invalid internal name"));
return_ACPI_STATUS (AE_BAD_PATHNAME);
}
/*
* Build ConvertedName
*/
- *ConvertedName = ACPI_MEM_CALLOCATE (RequiredLength);
+ *ConvertedName = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!(*ConvertedName))
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -844,8 +862,9 @@
*
* DESCRIPTION: Convert a namespace handle to a real Node
*
- * Note: Real integer handles allow for more verification
- * and keep all pointers within this subsystem.
+ * Note: Real integer handles would allow for more verification
+ * and keep all pointers within this subsystem - however this introduces
+ * more (and perhaps unnecessary) overhead.
*
******************************************************************************/
@@ -858,14 +877,9 @@
/*
- * Simple implementation.
+ * Simple implementation
*/
- if (!Handle)
- {
- return (NULL);
- }
-
- if (Handle == ACPI_ROOT_OBJECT)
+ if ((!Handle) || (Handle == ACPI_ROOT_OBJECT))
{
return (AcpiGbl_RootNode);
}
@@ -877,7 +891,7 @@
return (NULL);
}
- return ((ACPI_NAMESPACE_NODE *) Handle);
+ return (ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Handle));
}
@@ -905,7 +919,7 @@
return ((ACPI_HANDLE) Node);
-/* ---------------------------------------------------
+/* Example future implementation ---------------------
if (!Node)
{
@@ -931,17 +945,18 @@
*
* RETURN: none
*
- * DESCRIPTION: free memory allocated for table storage.
+ * DESCRIPTION: free memory allocated for namespace and ACPI table storage.
*
******************************************************************************/
void
-AcpiNsTerminate (void)
+AcpiNsTerminate (
+ void)
{
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("NsTerminate");
+ ACPI_FUNCTION_TRACE (NsTerminate);
/*
@@ -960,13 +975,6 @@
}
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Namespace freed\n"));
-
- /*
- * 2) Now we can delete the ACPI tables
- */
- AcpiTbDeleteAllTables ();
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
-
return_VOID;
}
@@ -986,29 +994,29 @@
AcpiNsOpensScope (
ACPI_OBJECT_TYPE Type)
{
- ACPI_FUNCTION_TRACE_STR ("NsOpensScope", AcpiUtGetTypeName (Type));
+ ACPI_FUNCTION_TRACE_STR (NsOpensScope, AcpiUtGetTypeName (Type));
if (!AcpiUtValidObjectType (Type))
{
/* type code out of range */
- ACPI_REPORT_WARNING (("NsOpensScope: Invalid Object Type %X\n", Type));
- return_VALUE (ACPI_NS_NORMAL);
+ ACPI_WARNING ((AE_INFO, "Invalid Object Type %X", Type));
+ return_UINT32 (ACPI_NS_NORMAL);
}
- return_VALUE (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
+ return_UINT32 (((UINT32) AcpiGbl_NsProperties[Type]) & ACPI_NS_NEWSCOPE);
}
/*******************************************************************************
*
- * FUNCTION: AcpiNsGetNodeByPath
+ * FUNCTION: AcpiNsGetNode
*
* PARAMETERS: *Pathname - Name to be found, in external (ASL) format. The
* \ (backslash) and ^ (carat) prefixes, and the
* . (period) to separate segments are supported.
- * StartNode - Root of subtree to be searched, or NS_ALL for the
+ * PrefixNode - Root of subtree to be searched, or NS_ALL for the
* root of the name space. If Name is fully
* qualified (first INT8 is '\'), the passed value
* of Scope will not be accessed.
@@ -1024,29 +1032,36 @@
******************************************************************************/
ACPI_STATUS
-AcpiNsGetNodeByPath (
+AcpiNsGetNode (
+ ACPI_NAMESPACE_NODE *PrefixNode,
char *Pathname,
- ACPI_NAMESPACE_NODE *StartNode,
UINT32 Flags,
ACPI_NAMESPACE_NODE **ReturnNode)
{
ACPI_GENERIC_STATE ScopeInfo;
ACPI_STATUS Status;
- char *InternalPath = NULL;
+ char *InternalPath;
- ACPI_FUNCTION_TRACE_PTR ("NsGetNodeByPath", Pathname);
+ ACPI_FUNCTION_TRACE_PTR (NsGetNode, Pathname);
- if (Pathname)
+ if (!Pathname)
{
- /* Convert path to internal representation */
-
- Status = AcpiNsInternalizeName (Pathname, &InternalPath);
- if (ACPI_FAILURE (Status))
+ *ReturnNode = PrefixNode;
+ if (!PrefixNode)
{
- return_ACPI_STATUS (Status);
+ *ReturnNode = AcpiGbl_RootNode;
}
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Convert path to internal representation */
+
+ Status = AcpiNsInternalizeName (Pathname, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
}
/* Must lock namespace during lookup */
@@ -1059,85 +1074,29 @@
/* Setup lookup scope (search starting point) */
- ScopeInfo.Scope.Node = StartNode;
+ ScopeInfo.Scope.Node = PrefixNode;
/* Lookup the name in the namespace */
- Status = AcpiNsLookup (&ScopeInfo, InternalPath,
- ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- (Flags | ACPI_NS_DONT_OPEN_SCOPE),
- NULL, ReturnNode);
+ Status = AcpiNsLookup (&ScopeInfo, InternalPath, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, (Flags | ACPI_NS_DONT_OPEN_SCOPE),
+ NULL, ReturnNode);
if (ACPI_FAILURE (Status))
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "%s, %s\n",
- InternalPath, AcpiFormatException (Status)));
+ Pathname, AcpiFormatException (Status)));
}
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
Cleanup:
- /* Cleanup */
- if (InternalPath)
- {
- ACPI_MEM_FREE (InternalPath);
- }
+ ACPI_FREE (InternalPath);
return_ACPI_STATUS (Status);
}
/*******************************************************************************
*
- * FUNCTION: AcpiNsFindParentName
- *
- * PARAMETERS: *ChildNode - Named Obj whose name is to be found
- *
- * RETURN: The ACPI name
- *
- * DESCRIPTION: Search for the given obj in its parent scope and return the
- * name segment, or "????" if the parent name can't be found
- * (which "should not happen").
- *
- ******************************************************************************/
-
-ACPI_NAME
-AcpiNsFindParentName (
- ACPI_NAMESPACE_NODE *ChildNode)
-{
- ACPI_NAMESPACE_NODE *ParentNode;
-
-
- ACPI_FUNCTION_TRACE ("NsFindParentName");
-
-
- if (ChildNode)
- {
- /* Valid entry. Get the parent Node */
-
- ParentNode = AcpiNsGetParentNode (ChildNode);
- if (ParentNode)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Parent of %p [%4.4s] is %p [%4.4s]\n",
- ChildNode, AcpiUtGetNodeName (ChildNode),
- ParentNode, AcpiUtGetNodeName (ParentNode)));
-
- if (ParentNode->Name.Integer)
- {
- return_VALUE ((ACPI_NAME) ParentNode->Name.Integer);
- }
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Unable to find parent of %p (%4.4s)\n",
- ChildNode, AcpiUtGetNodeName (ChildNode)));
- }
-
- return_VALUE (ACPI_UNKNOWN_NAME);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiNsGetParentNode
*
* PARAMETERS: Node - Current table entry
@@ -1148,7 +1107,6 @@
*
******************************************************************************/
-
ACPI_NAMESPACE_NODE *
AcpiNsGetParentNode (
ACPI_NAMESPACE_NODE *Node)
@@ -1171,7 +1129,6 @@
Node = Node->Peer;
}
-
return (Node->Peer);
}
@@ -1190,7 +1147,6 @@
*
******************************************************************************/
-
ACPI_NAMESPACE_NODE *
AcpiNsGetNextValidNode (
ACPI_NAMESPACE_NODE *Node)
@@ -1209,3 +1165,56 @@
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsFindParentName
+ *
+ * PARAMETERS: *ChildNode - Named Obj whose name is to be found
+ *
+ * RETURN: The ACPI name
+ *
+ * DESCRIPTION: Search for the given obj in its parent scope and return the
+ * name segment, or "????" if the parent name can't be found
+ * (which "should not happen").
+ *
+ ******************************************************************************/
+
+ACPI_NAME
+AcpiNsFindParentName (
+ ACPI_NAMESPACE_NODE *ChildNode)
+{
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ ACPI_FUNCTION_TRACE (NsFindParentName);
+
+
+ if (ChildNode)
+ {
+ /* Valid entry. Get the parent Node */
+
+ ParentNode = AcpiNsGetParentNode (ChildNode);
+ if (ParentNode)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Parent of %p [%4.4s] is %p [%4.4s]\n",
+ ChildNode, AcpiUtGetNodeName (ChildNode),
+ ParentNode, AcpiUtGetNodeName (ParentNode)));
+
+ if (ParentNode->Name.Integer)
+ {
+ return_VALUE ((ACPI_NAME) ParentNode->Name.Integer);
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Unable to find parent of %p (%4.4s)\n",
+ ChildNode, AcpiUtGetNodeName (ChildNode)));
+ }
+
+ return_VALUE (ACPI_UNKNOWN_NAME);
+}
+#endif
+
+
Index: evregion.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evregion.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evregion.c -L sys/contrib/dev/acpica/evregion.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evregion.c
+++ sys/contrib/dev/acpica/evregion.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evregion - ACPI AddressSpace (OpRegion) handler dispatch
- * $Revision: 152 $
+ * $Revision: 1.168 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,11 +127,29 @@
#define ACPI_NUM_DEFAULT_SPACES 4
-static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] = {
- ACPI_ADR_SPACE_SYSTEM_MEMORY,
- ACPI_ADR_SPACE_SYSTEM_IO,
- ACPI_ADR_SPACE_PCI_CONFIG,
- ACPI_ADR_SPACE_DATA_TABLE};
+static UINT8 AcpiGbl_DefaultAddressSpaces[ACPI_NUM_DEFAULT_SPACES] =
+{
+ ACPI_ADR_SPACE_SYSTEM_MEMORY,
+ ACPI_ADR_SPACE_SYSTEM_IO,
+ ACPI_ADR_SPACE_PCI_CONFIG,
+ ACPI_ADR_SPACE_DATA_TABLE
+};
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiEvRegRun (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiEvInstallHandler (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
/*******************************************************************************
@@ -154,7 +172,7 @@
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("EvInstallRegionHandlers");
+ ACPI_FUNCTION_TRACE (EvInstallRegionHandlers);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -184,8 +202,8 @@
for (i = 0; i < ACPI_NUM_DEFAULT_SPACES; i++)
{
Status = AcpiEvInstallSpaceHandler (AcpiGbl_RootNode,
- AcpiGbl_DefaultAddressSpaces[i],
- ACPI_DEFAULT_HANDLER, NULL, NULL);
+ AcpiGbl_DefaultAddressSpaces[i],
+ ACPI_DEFAULT_HANDLER, NULL, NULL);
switch (Status)
{
case AE_OK:
@@ -230,7 +248,7 @@
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_TRACE ("EvInitializeOpRegions");
+ ACPI_FUNCTION_TRACE (EvInitializeOpRegions);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -248,7 +266,7 @@
* _REG will have already been run.
*/
Status = AcpiEvExecuteRegMethods (AcpiGbl_RootNode,
- AcpiGbl_DefaultAddressSpaces[i]);
+ AcpiGbl_DefaultAddressSpaces[i]);
}
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
@@ -260,8 +278,8 @@
*
* FUNCTION: AcpiEvExecuteRegMethod
*
- * PARAMETERS: RegionObj - Object structure
- * Function - Passed to _REG: On (1) or Off (0)
+ * PARAMETERS: RegionObj - Region object
+ * Function - Passed to _REG: On (1) or Off (0)
*
* RETURN: Status
*
@@ -274,13 +292,13 @@
ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function)
{
- ACPI_PARAMETER_INFO Info;
- ACPI_OPERAND_OBJECT *Params[3];
+ ACPI_EVALUATE_INFO *Info;
+ ACPI_OPERAND_OBJECT *Args[3];
ACPI_OPERAND_OBJECT *RegionObj2;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvExecuteRegMethod");
+ ACPI_FUNCTION_TRACE (EvExecuteRegMethod);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -294,50 +312,63 @@
return_ACPI_STATUS (AE_OK);
}
+ /* Allocate and initialize the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->PrefixNode = RegionObj2->Extra.Method_REG;
+ Info->Pathname = NULL;
+ Info->Parameters = Args;
+ Info->ParameterType = ACPI_PARAM_ARGS;
+ Info->Flags = ACPI_IGNORE_RETURN_VALUE;
+
/*
* The _REG method has two arguments:
*
- * Arg0, Integer: Operation region space ID
- * Same value as RegionObj->Region.SpaceId
- * Arg1, Integer: connection status
- * 1 for connecting the handler,
- * 0 for disconnecting the handler
- * Passed as a parameter
+ * Arg0 - Integer:
+ * Operation region space ID Same value as RegionObj->Region.SpaceId
+ *
+ * Arg1 - Integer:
+ * connection status 1 for connecting the handler, 0 for disconnecting
+ * the handler (Passed as a parameter)
*/
- Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!Params[0])
+ Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!Args[0])
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup1;
}
- Params[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
- if (!Params[1])
+ Args[1] = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
+ if (!Args[1])
{
Status = AE_NO_MEMORY;
- goto Cleanup;
+ goto Cleanup2;
}
/* Setup the parameter objects */
- Params[0]->Integer.Value = RegionObj->Region.SpaceId;
- Params[1]->Integer.Value = Function;
- Params[2] = NULL;
-
- Info.Node = RegionObj2->Extra.Method_REG;
- Info.Parameters = Params;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ Args[0]->Integer.Value = RegionObj->Region.SpaceId;
+ Args[1]->Integer.Value = Function;
+ Args[2] = NULL;
/* Execute the method, no return value */
- ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
- ACPI_TYPE_METHOD, Info.Node, NULL));
- Status = AcpiNsEvaluateByHandle (&Info);
+ ACPI_DEBUG_EXEC (
+ AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Info->PrefixNode, NULL));
- AcpiUtRemoveReference (Params[1]);
+ Status = AcpiNsEvaluate (Info);
+ AcpiUtRemoveReference (Args[1]);
-Cleanup:
- AcpiUtRemoveReference (Params[0]);
+Cleanup2:
+ AcpiUtRemoveReference (Args[0]);
+Cleanup1:
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
@@ -350,7 +381,8 @@
* Function - Read or Write operation
* Address - Where in the space to read or write
* BitWidth - Field width in bits (8, 16, 32, or 64)
- * Value - Pointer to in or out value
+ * Value - Pointer to in or out value, must be
+ * full 64-bit ACPI_INTEGER
*
* RETURN: Status
*
@@ -365,10 +397,9 @@
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
- void *Value)
+ ACPI_INTEGER *Value)
{
ACPI_STATUS Status;
- ACPI_STATUS Status2;
ACPI_ADR_SPACE_HANDLER Handler;
ACPI_ADR_SPACE_SETUP RegionSetup;
ACPI_OPERAND_OBJECT *HandlerDesc;
@@ -376,7 +407,7 @@
void *RegionContext = NULL;
- ACPI_FUNCTION_TRACE ("EvAddressSpaceDispatch");
+ ACPI_FUNCTION_TRACE (EvAddressSpaceDispatch);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -390,8 +421,8 @@
HandlerDesc = RegionObj->Region.Handler;
if (!HandlerDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No handler for Region [%4.4s] (%p) [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "No handler for Region [%4.4s] (%p) [%s]",
AcpiUtGetNodeName (RegionObj->Region.Node),
RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
@@ -412,34 +443,32 @@
{
/* No initialization routine, exit with error */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No init routine for region(%p) [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "No init routine for region(%p) [%s]",
RegionObj, AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
return_ACPI_STATUS (AE_NOT_EXIST);
}
/*
- * We must exit the interpreter because the region setup will potentially
- * execute control methods (e.g., _REG method for this region)
+ * We must exit the interpreter because the region
+ * setup will potentially execute control methods
+ * (e.g., _REG method for this region)
*/
- AcpiExExitInterpreter ();
+ AcpiExRelinquishInterpreter ();
Status = RegionSetup (RegionObj, ACPI_REGION_ACTIVATE,
- HandlerDesc->AddressSpace.Context, &RegionContext);
+ HandlerDesc->AddressSpace.Context, &RegionContext);
/* Re-enter the interpreter */
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
+ AcpiExReacquireInterpreter ();
/* Check for failure of the Region Setup */
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region Init: %s [%s]\n",
- AcpiFormatException (Status),
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "During region initialization: [%s]",
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
return_ACPI_STATUS (Status);
}
@@ -455,7 +484,7 @@
{
/* The handler for this region was already installed */
- ACPI_MEM_FREE (RegionContext);
+ ACPI_FREE (RegionContext);
}
else
{
@@ -478,40 +507,36 @@
ACPI_FORMAT_UINT64 (Address),
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
- if (!(HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
* For handlers other than the default (supplied) handlers, we must
* exit the interpreter because the handler *might* block -- we don't
* know what it will do, so we can't hold the lock on the intepreter.
*/
- AcpiExExitInterpreter();
+ AcpiExRelinquishInterpreter();
}
/* Call the handler */
Status = Handler (Function, Address, BitWidth, Value,
- HandlerDesc->AddressSpace.Context,
- RegionObj2->Extra.RegionContext);
+ HandlerDesc->AddressSpace.Context, RegionObj2->Extra.RegionContext);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Handler for [%s] returned %s\n",
- AcpiUtGetRegionName (RegionObj->Region.SpaceId),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]",
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
}
- if (!(HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
+ if (!(HandlerDesc->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED))
{
/*
* We just returned from a non-default handler, we must re-enter the
* interpreter
*/
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status2))
- {
- return_ACPI_STATUS (Status2);
- }
+ AcpiExReacquireInterpreter ();
}
return_ACPI_STATUS (Status);
@@ -546,7 +571,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvDetachRegion");
+ ACPI_FUNCTION_TRACE (EvDetachRegion);
RegionObj2 = AcpiNsGetSecondaryObject (RegionObj);
@@ -600,8 +625,7 @@
Status = AcpiEvExecuteRegMethod (RegionObj, 0);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region _REG, [%s]\n",
- AcpiFormatException (Status),
+ ACPI_EXCEPTION ((AE_INFO, Status, "from region _REG, [%s]",
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
}
@@ -614,32 +638,36 @@
}
}
- /* Call the setup handler with the deactivate notification */
+ /*
+ * If the region has been activated, call the setup handler
+ * with the deactivate notification
+ */
+ if (RegionObj->Region.Flags & AOPOBJ_SETUP_COMPLETE)
+ {
+ RegionSetup = HandlerObj->AddressSpace.Setup;
+ Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
+ HandlerObj->AddressSpace.Context, RegionContext);
- RegionSetup = HandlerObj->AddressSpace.Setup;
- Status = RegionSetup (RegionObj, ACPI_REGION_DEACTIVATE,
- HandlerObj->AddressSpace.Context, RegionContext);
+ /* Init routine may fail, Just ignore errors */
- /* Init routine may fail, Just ignore errors */
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "from region handler - deactivate, [%s]",
+ AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ }
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%s from region init, [%s]\n",
- AcpiFormatException (Status),
- AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
+ RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
}
- RegionObj->Region.Flags &= ~(AOPOBJ_SETUP_COMPLETE);
-
/*
* Remove handler reference in the region
*
- * NOTE: this doesn't mean that the region goes away
- * The region is just inaccessible as indicated to
- * the _REG method
+ * NOTE: this doesn't mean that the region goes away, the region
+ * is just inaccessible as indicated to the _REG method
*
- * If the region is on the handler's list
- * this better be the region's handler
+ * If the region is on the handler's list, this must be the
+ * region's handler
*/
RegionObj->Region.Handler = NULL;
AcpiUtRemoveReference (HandlerObj);
@@ -685,7 +713,7 @@
BOOLEAN AcpiNsIsLocked)
{
- ACPI_FUNCTION_TRACE ("EvAttachRegion");
+ ACPI_FUNCTION_TRACE (EvAttachRegion);
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
@@ -730,7 +758,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiEvInstallHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
@@ -744,7 +772,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("EvInstallHandler");
+ ACPI_FUNCTION_NAME (EvInstallHandler);
HandlerObj = (ACPI_OPERAND_OBJECT *) Context;
@@ -881,10 +909,10 @@
ACPI_OPERAND_OBJECT *HandlerObj;
ACPI_STATUS Status;
ACPI_OBJECT_TYPE Type;
- UINT16 Flags = 0;
+ UINT8 Flags = 0;
- ACPI_FUNCTION_TRACE ("EvInstallSpaceHandler");
+ ACPI_FUNCTION_TRACE (EvInstallSpaceHandler);
/*
@@ -973,7 +1001,8 @@
{
/*
* It is (relatively) OK to attempt to install the SAME
- * handler twice. This can easily happen with PCI_Config space.
+ * handler twice. This can easily happen
+ * with PCI_Config space.
*/
Status = AE_SAME_HANDLER;
goto UnlockAndExit;
@@ -1054,17 +1083,17 @@
/* Init handler obj */
- HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
- HandlerObj->AddressSpace.Hflags = Flags;
- HandlerObj->AddressSpace.RegionList = NULL;
- HandlerObj->AddressSpace.Node = Node;
- HandlerObj->AddressSpace.Handler = Handler;
- HandlerObj->AddressSpace.Context = Context;
- HandlerObj->AddressSpace.Setup = Setup;
+ HandlerObj->AddressSpace.SpaceId = (UINT8) SpaceId;
+ HandlerObj->AddressSpace.HandlerFlags = Flags;
+ HandlerObj->AddressSpace.RegionList = NULL;
+ HandlerObj->AddressSpace.Node = Node;
+ HandlerObj->AddressSpace.Handler = Handler;
+ HandlerObj->AddressSpace.Context = Context;
+ HandlerObj->AddressSpace.Setup = Setup;
/* Install at head of Device.AddressSpace list */
- HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
+ HandlerObj->AddressSpace.Next = ObjDesc->Device.Handler;
/*
* The Device object is the first reference on the HandlerObj.
@@ -1085,8 +1114,8 @@
* of the branch
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
- HandlerObj, NULL);
+ ACPI_NS_WALK_UNLOCK, AcpiEvInstallHandler,
+ HandlerObj, NULL);
UnlockAndExit:
return_ACPI_STATUS (Status);
@@ -1115,7 +1144,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvExecuteRegMethods");
+ ACPI_FUNCTION_TRACE (EvExecuteRegMethods);
/*
@@ -1126,8 +1155,8 @@
* can run any _REG methods)
*/
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, Node, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
- &SpaceId, NULL);
+ ACPI_NS_WALK_UNLOCK, AcpiEvRegRun,
+ &SpaceId, NULL);
return_ACPI_STATUS (Status);
}
@@ -1143,7 +1172,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiEvRegRun (
ACPI_HANDLE ObjHandle,
UINT32 Level,
Index: dmnames.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmnames.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmnames.c -L sys/contrib/dev/acpica/dmnames.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmnames.c
+++ sys/contrib/dev/acpica/dmnames.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmnames - AML disassembler, names, namestrings, pathnames
- * $Revision: 7 $
+ * $Revision: 1.17 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,61 +127,14 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmnames")
+/* Local prototypes */
-/*******************************************************************************
- *
- * FUNCTION: AcpiDmValidateName
- *
- * PARAMETERS: Name - 4 character ACPI name
- *
- * RETURN: None
- *
- * DESCRIPTION: Lookup the name
- *
- ******************************************************************************/
-
+#ifdef ACPI_OBSOLETE_FUNCTIONS
void
-AcpiDmValidateName (
- char *Name,
- ACPI_PARSE_OBJECT *Op)
-{
-
-#if 0
- if ((!Name) ||
- (!Op->Common.Parent))
- {
- return;
- }
-
- if (!Op->Common.Node)
- {
- AcpiOsPrintf (" /**** Name not found or not accessible from this scope ****/ ");
- }
-
- ACPI_PARSE_OBJECT *TargetOp;
-
-
- if ((!Name) ||
- (!Op->Common.Parent))
- {
- return;
- }
-
- TargetOp = AcpiPsFind (Op, Name, 0, 0);
- if (!TargetOp)
- {
- /*
- * Didn't find the name in the parse tree. This may be
- * a problem, or it may simply be one of the predefined names
- * (such as _OS_). Rather than worry about looking up all
- * the predefined names, just display the name as given
- */
- AcpiOsPrintf (" /**** Name not found or not accessible from this scope ****/ ");
- }
+AcpiDmDisplayPath (
+ ACPI_PARSE_OBJECT *Op);
#endif
-}
-
/*******************************************************************************
*
@@ -201,21 +154,33 @@
{
UINT32 i;
UINT32 Length;
- char *End = Name + ACPI_NAME_SIZE;
+ char NewName[4];
+
+
+ /* Ensure that the name is printable, even if we have to fix it */
+ *(UINT32 *) NewName = AcpiUtRepairName (Name);
- for (i = 0; i < ACPI_NAME_SIZE; i++)
+ /* Remove all trailing underscores from the name */
+
+ Length = ACPI_NAME_SIZE;
+ for (i = (ACPI_NAME_SIZE - 1); i != 0; i--)
{
- if (Name[i] != '_')
+ if (NewName[i] == '_')
{
- End = &Name[i];
+ Length--;
+ }
+ else
+ {
+ break;
}
}
- Length = (UINT32)(End - Name) + 1;
+ /* Dump the name, up to the start of the trailing underscores */
+
for (i = 0; i < Length; i++)
{
- AcpiOsPrintf ("%c", Name[i]);
+ AcpiOsPrintf ("%c", NewName[i]);
}
return (Length);
@@ -261,8 +226,9 @@
{
/* Node not defined in this scope, look it up */
- Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+ WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
@@ -291,7 +257,7 @@
}
AcpiOsPrintf (" (Path %s)", (char *) Buffer.Pointer);
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
Exit:
@@ -310,7 +276,7 @@
*
* RETURN: None
*
- * DESCRIPTION: Decode an ACPI namestring. Handles prefix characters
+ * DESCRIPTION: Decode and dump an ACPI namestring. Handles prefix characters
*
******************************************************************************/
@@ -375,6 +341,7 @@
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AcpiDmDisplayPath
@@ -494,6 +461,61 @@
}
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmValidateName
+ *
+ * PARAMETERS: Name - 4 character ACPI name
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Lookup the name
+ *
+ ******************************************************************************/
+
+void
+AcpiDmValidateName (
+ char *Name,
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if ((!Name) ||
+ (!Op->Common.Parent))
+ {
+ return;
+ }
+
+ if (!Op->Common.Node)
+ {
+ AcpiOsPrintf (
+ " /**** Name not found or not accessible from this scope ****/ ");
+ }
+
+ ACPI_PARSE_OBJECT *TargetOp;
+
+
+ if ((!Name) ||
+ (!Op->Common.Parent))
+ {
+ return;
+ }
+
+ TargetOp = AcpiPsFind (Op, Name, 0, 0);
+ if (!TargetOp)
+ {
+ /*
+ * Didn't find the name in the parse tree. This may be
+ * a problem, or it may simply be one of the predefined names
+ * (such as _OS_). Rather than worry about looking up all
+ * the predefined names, just display the name as given
+ */
+ AcpiOsPrintf (
+ " /**** Name not found or not accessible from this scope ****/ ");
+ }
+}
+#endif
+
#endif
Index: acexcep.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acexcep.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acexcep.h -L sys/contrib/dev/acpica/acexcep.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acexcep.h
+++ sys/contrib/dev/acpica/acexcep.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acexcep.h - Exception codes returned by the ACPI subsystem
- * $Revision: 72 $
+ * $Revision: 1.79 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,6 @@
/*
* Exceptions returned by external ACPI interfaces
*/
-
#define AE_CODE_ENVIRONMENTAL 0x0000
#define AE_CODE_PROGRAMMER 0x1000
#define AE_CODE_ACPI_TABLES 0x2000
@@ -169,8 +168,10 @@
#define AE_ABORT_METHOD (ACPI_STATUS) (0x001C | AE_CODE_ENVIRONMENTAL)
#define AE_SAME_HANDLER (ACPI_STATUS) (0x001D | AE_CODE_ENVIRONMENTAL)
#define AE_WAKE_ONLY_GPE (ACPI_STATUS) (0x001E | AE_CODE_ENVIRONMENTAL)
+#define AE_OWNER_ID_LIMIT (ACPI_STATUS) (0x001F | AE_CODE_ENVIRONMENTAL)
+
+#define AE_CODE_ENV_MAX 0x001F
-#define AE_CODE_ENV_MAX 0x001E
/*
* Programmer exceptions
@@ -238,8 +239,10 @@
#define AE_AML_BAD_RESOURCE_VALUE (ACPI_STATUS) (0x001F | AE_CODE_AML)
#define AE_AML_CIRCULAR_REFERENCE (ACPI_STATUS) (0x0020 | AE_CODE_AML)
#define AE_AML_BAD_RESOURCE_LENGTH (ACPI_STATUS) (0x0021 | AE_CODE_AML)
+#define AE_AML_ILLEGAL_ADDRESS (ACPI_STATUS) (0x0022 | AE_CODE_AML)
+
+#define AE_CODE_AML_MAX 0x0022
-#define AE_CODE_AML_MAX 0x0021
/*
* Internal exceptions used for control
@@ -255,12 +258,15 @@
#define AE_CTRL_BREAK (ACPI_STATUS) (0x0009 | AE_CODE_CONTROL)
#define AE_CTRL_CONTINUE (ACPI_STATUS) (0x000A | AE_CODE_CONTROL)
#define AE_CTRL_SKIP (ACPI_STATUS) (0x000B | AE_CODE_CONTROL)
+#define AE_CTRL_PARSE_CONTINUE (ACPI_STATUS) (0x000C | AE_CODE_CONTROL)
+#define AE_CTRL_PARSE_PENDING (ACPI_STATUS) (0x000D | AE_CODE_CONTROL)
-#define AE_CODE_CTRL_MAX 0x000B
+#define AE_CODE_CTRL_MAX 0x000D
#ifdef DEFINE_ACPI_GLOBALS
+
/*
* String versions of the exception codes above
* These strings must match the corresponding defines exactly
@@ -297,7 +303,8 @@
"AE_LOGICAL_ADDRESS",
"AE_ABORT_METHOD",
"AE_SAME_HANDLER",
- "AE_WAKE_ONLY_GPE"
+ "AE_WAKE_ONLY_GPE",
+ "AE_OWNER_ID_LIMIT"
};
char const *AcpiGbl_ExceptionNames_Pgm[] =
@@ -357,7 +364,8 @@
"AE_AML_NO_RESOURCE_END_TAG",
"AE_AML_BAD_RESOURCE_VALUE",
"AE_AML_CIRCULAR_REFERENCE",
- "AE_AML_BAD_RESOURCE_LENGTH"
+ "AE_AML_BAD_RESOURCE_LENGTH",
+ "AE_AML_ILLEGAL_ADDRESS"
};
char const *AcpiGbl_ExceptionNames_Ctrl[] =
@@ -372,10 +380,11 @@
"AE_CTRL_TRANSFER",
"AE_CTRL_BREAK",
"AE_CTRL_CONTINUE",
- "AE_CTRL_SKIP"
+ "AE_CTRL_SKIP",
+ "AE_CTRL_PARSE_CONTINUE",
+ "AE_CTRL_PARSE_PENDING"
};
#endif /* ACPI GLOBALS */
-
#endif /* __ACEXCEP_H__ */
Index: tbxfroot.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/tbxfroot.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/tbxfroot.c -L sys/contrib/dev/acpica/tbxfroot.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/tbxfroot.c
+++ sys/contrib/dev/acpica/tbxfroot.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: tbxfroot - Find the root ACPI table (RSDT)
- * $Revision: 79 $
+ * $Revision: 1.105 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,352 +123,194 @@
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbxfroot")
+/* Local prototypes */
+
+static UINT8 *
+AcpiTbScanMemoryForRsdp (
+ UINT8 *StartAddress,
+ UINT32 Length);
+
+static ACPI_STATUS
+AcpiTbValidateRsdp (
+ ACPI_TABLE_RSDP *Rsdp);
+
/*******************************************************************************
*
- * FUNCTION: AcpiTbFindTable
+ * FUNCTION: AcpiTbValidateRsdp
*
- * PARAMETERS: Signature - String with ACPI table signature
- * OemId - String with the table OEM ID
- * OemTableId - String with the OEM Table ID.
+ * PARAMETERS: Rsdp - Pointer to unvalidated RSDP
*
* RETURN: Status
*
- * DESCRIPTION: Find an ACPI table (in the RSDT/XSDT) that matches the
- * Signature, OEM ID and OEM Table ID.
+ * DESCRIPTION: Validate the RSDP (ptr)
*
******************************************************************************/
-ACPI_STATUS
-AcpiTbFindTable (
- char *Signature,
- char *OemId,
- char *OemTableId,
- ACPI_TABLE_HEADER **TablePtr)
+static ACPI_STATUS
+AcpiTbValidateRsdp (
+ ACPI_TABLE_RSDP *Rsdp)
{
- ACPI_STATUS Status;
- ACPI_TABLE_HEADER *Table;
+ ACPI_FUNCTION_ENTRY ();
- ACPI_FUNCTION_TRACE ("TbFindTable");
-
-
- /* Validate string lengths */
-
- if ((ACPI_STRLEN (Signature) > ACPI_NAME_SIZE) ||
- (ACPI_STRLEN (OemId) > sizeof (Table->OemId)) ||
- (ACPI_STRLEN (OemTableId) > sizeof (Table->OemTableId)))
+ /*
+ * The signature and checksum must both be correct
+ *
+ * Note: Sometimes there exists more than one RSDP in memory; the valid
+ * RSDP has a valid checksum, all others have an invalid checksum.
+ */
+ if (ACPI_STRNCMP ((char *) Rsdp, ACPI_SIG_RSDP, sizeof (ACPI_SIG_RSDP)-1) != 0)
{
- return_ACPI_STATUS (AE_AML_STRING_LIMIT);
+ /* Nope, BAD Signature */
+
+ return (AE_BAD_SIGNATURE);
}
- if (!ACPI_STRNCMP (Signature, DSDT_SIG, ACPI_NAME_SIZE))
- {
- /*
- * The DSDT pointer is contained in the FADT, not the RSDT.
- * This code should suffice, because the only code that would perform
- * a "find" on the DSDT is the DataTableRegion() AML opcode -- in
- * which case, the DSDT is guaranteed to be already loaded.
- * If this becomes insufficient, the FADT will have to be found first.
- */
- if (!AcpiGbl_DSDT)
- {
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
+ /* Check the standard checksum */
- Table = AcpiGbl_DSDT;
- }
- else
+ if (AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
{
- /* Find the table */
-
- Status = AcpiGetFirmwareTable (Signature, 1,
- ACPI_LOGICAL_ADDRESSING, &Table);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ return (AE_BAD_CHECKSUM);
}
- /* Check OemId and OemTableId */
+ /* Check extended checksum if table version >= 2 */
- if ((OemId[0] && ACPI_STRCMP (OemId, Table->OemId)) ||
- (OemTableId[0] && ACPI_STRCMP (OemTableId, Table->OemTableId)))
+ if ((Rsdp->Revision >= 2) &&
+ (AcpiTbChecksum ((UINT8 *) Rsdp, ACPI_RSDP_XCHECKSUM_LENGTH) != 0))
{
- return_ACPI_STATUS (AE_AML_NAME_NOT_FOUND);
+ return (AE_BAD_CHECKSUM);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "Found table [%4.4s]\n", Table->Signature));
- *TablePtr = Table;
- return_ACPI_STATUS (AE_OK);
+ return (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiGetFirmwareTable
+ * FUNCTION: AcpiTbFindRsdp
*
- * PARAMETERS: Signature - Any ACPI table signature
- * Instance - the non zero instance of the table, allows
- * support for multiple tables of the same type
- * Flags - Physical/Virtual support
- * TablePointer - Where a buffer containing the table is
- * returned
+ * PARAMETERS: TableAddress - Where the table pointer is returned
*
- * RETURN: Status
+ * RETURN: Status, RSDP physical address
+ *
+ * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
+ * pointer structure. If it is found, set *RSDP to point to it.
*
- * DESCRIPTION: This function is called to get an ACPI table. A buffer is
- * allocated for the table and returned in TablePointer.
- * This table will be a complete table including the header.
+ * NOTE1: The RSDP must be either in the first 1K of the Extended
+ * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
+ * Only a 32-bit physical address is necessary.
+ *
+ * NOTE2: This function is always available, regardless of the
+ * initialization state of the rest of ACPI.
*
******************************************************************************/
ACPI_STATUS
-AcpiGetFirmwareTable (
- ACPI_STRING Signature,
- UINT32 Instance,
- UINT32 Flags,
- ACPI_TABLE_HEADER **TablePointer)
+AcpiFindRootPointer (
+ ACPI_NATIVE_UINT *TableAddress)
{
- ACPI_STATUS Status;
- ACPI_POINTER Address;
- ACPI_TABLE_HEADER *Header = NULL;
- ACPI_TABLE_DESC *TableInfo = NULL;
- ACPI_TABLE_DESC *RsdtInfo;
- UINT32 TableCount;
- UINT32 i;
- UINT32 j;
+ UINT8 *TablePtr;
+ UINT8 *MemRover;
+ UINT32 PhysicalAddress;
- ACPI_FUNCTION_TRACE ("AcpiGetFirmwareTable");
+ ACPI_FUNCTION_TRACE (AcpiFindRootPointer);
- /*
- * Ensure that at least the table manager is initialized. We don't
- * require that the entire ACPI subsystem is up for this interface.
- * If we have a buffer, we must have a length too
- */
- if ((Instance == 0) ||
- (!Signature) ||
- (!TablePointer))
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* 1a) Get the location of the Extended BIOS Data Area (EBDA) */
- /* Ensure that we have a RSDP */
-
- if (!AcpiGbl_RSDP)
+ TablePtr = AcpiOsMapMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION,
+ ACPI_EBDA_PTR_LENGTH);
+ if (!TablePtr)
{
- /* Get the RSDP */
-
- Status = AcpiOsGetRootPointer (Flags, &Address);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "RSDP not found\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Map and validate the RSDP */
-
- if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
- {
- Status = AcpiOsMapMemory (Address.Pointer.Physical, sizeof (RSDP_DESCRIPTOR),
- (void *) &AcpiGbl_RSDP);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
- else
- {
- AcpiGbl_RSDP = Address.Pointer.Logical;
- }
-
- /* The signature and checksum must both be correct */
-
- if (ACPI_STRNCMP ((char *) AcpiGbl_RSDP, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
- {
- /* Nope, BAD Signature */
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X for length %X",
+ ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
- return_ACPI_STATUS (AE_BAD_SIGNATURE);
- }
-
- if (AcpiTbChecksum (AcpiGbl_RSDP, ACPI_RSDP_CHECKSUM_LENGTH) != 0)
- {
- /* Nope, BAD Checksum */
-
- return_ACPI_STATUS (AE_BAD_CHECKSUM);
- }
- }
-
- /* Get the RSDT address via the RSDP */
-
- AcpiTbGetRsdtAddress (&Address);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "RSDP located at %p, RSDT physical=%8.8X%8.8X \n",
- AcpiGbl_RSDP,
- ACPI_FORMAT_UINT64 (Address.Pointer.Value)));
-
- /* Insert ProcessorMode flags */
-
- Address.PointerType |= Flags;
-
- /* Get and validate the RSDT */
-
- RsdtInfo = ACPI_MEM_CALLOCATE (sizeof (ACPI_TABLE_DESC));
- if (!RsdtInfo)
- {
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiTbGetTable (&Address, RsdtInfo);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
+ ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr);
- Status = AcpiTbValidateRsdt (RsdtInfo->Pointer);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
+ /* Convert segment part to physical address */
- /* Allocate a scratch table header and table descriptor */
+ PhysicalAddress <<= 4;
+ AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH);
- Header = ACPI_MEM_ALLOCATE (sizeof (ACPI_TABLE_HEADER));
- if (!Header)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
+ /* EBDA present? */
- TableInfo = ACPI_MEM_ALLOCATE (sizeof (ACPI_TABLE_DESC));
- if (!TableInfo)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- /* Get the number of table pointers within the RSDT */
-
- TableCount = AcpiTbGetTableCount (AcpiGbl_RSDP, RsdtInfo->Pointer);
- Address.PointerType = AcpiGbl_TableFlags | Flags;
-
- /*
- * Search the RSDT/XSDT for the correct instance of the
- * requested table
- */
- for (i = 0, j = 0; i < TableCount; i++)
+ if (PhysicalAddress > 0x400)
{
- /* Get the next table pointer, handle RSDT vs. XSDT */
-
- if (AcpiGbl_RSDP->Revision < 2)
- {
- Address.Pointer.Value = (ACPI_CAST_PTR (
- RSDT_DESCRIPTOR, RsdtInfo->Pointer))->TableOffsetEntry[i];
- }
- else
+ /*
+ * 1b) Search EBDA paragraphs (EBDA is required to be a
+ * minimum of 1K length)
+ */
+ TablePtr = AcpiOsMapMemory (
+ (ACPI_NATIVE_UINT) PhysicalAddress,
+ ACPI_EBDA_WINDOW_SIZE);
+ if (!TablePtr)
{
- Address.Pointer.Value = ACPI_GET_ADDRESS ((ACPI_CAST_PTR (
- XSDT_DESCRIPTOR, RsdtInfo->Pointer))->TableOffsetEntry[i]);
- }
-
- /* Get the table header */
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X for length %X",
+ PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
- Status = AcpiTbGetTableHeader (&Address, Header);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Compare table signatures and table instance */
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
- if (!ACPI_STRNCMP (Header->Signature, Signature, ACPI_NAME_SIZE))
+ if (MemRover)
{
- /* An instance of the table was found */
+ /* Return the physical address */
- j++;
- if (j >= Instance)
- {
- /* Found the correct instance, get the entire table */
-
- Status = AcpiTbGetTableBody (&Address, Header, TableInfo);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- *TablePointer = TableInfo->Pointer;
- goto Cleanup;
- }
+ PhysicalAddress += (UINT32) ACPI_PTR_DIFF (MemRover, TablePtr);
+
+ *TableAddress = PhysicalAddress;
+ return_ACPI_STATUS (AE_OK);
}
}
- /* Did not find the table */
-
- Status = AE_NOT_EXIST;
-
-
-Cleanup:
- AcpiOsUnmapMemory (RsdtInfo->Pointer, (ACPI_SIZE) RsdtInfo->Pointer->Length);
- ACPI_MEM_FREE (RsdtInfo);
+ /*
+ * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
+ */
+ TablePtr = AcpiOsMapMemory (
+ (ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE,
+ ACPI_HI_RSDP_WINDOW_SIZE);
+
+ if (!TablePtr)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X for length %X",
+ ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
- if (Header)
- {
- ACPI_MEM_FREE (Header);
- }
- if (TableInfo)
- {
- ACPI_MEM_FREE (TableInfo);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- return_ACPI_STATUS (Status);
-}
-
-
-/* TBD: Move to a new file */
-
-#if ACPI_MACHINE_WIDTH != 16
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiFindRootPointer
- *
- * PARAMETERS: **RsdpAddress - Where to place the RSDP address
- * Flags - Logical/Physical addressing
- *
- * RETURN: Status, Physical address of the RSDP
- *
- * DESCRIPTION: Find the RSDP
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiFindRootPointer (
- UINT32 Flags,
- ACPI_POINTER *RsdpAddress)
-{
- ACPI_TABLE_DESC TableInfo;
- ACPI_STATUS Status;
-
- ACPI_FUNCTION_TRACE ("AcpiFindRootPointer");
+ MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
+ AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
+ if (MemRover)
+ {
+ /* Return the physical address */
- /* Get the RSDP */
+ PhysicalAddress = (UINT32)
+ (ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr));
- Status = AcpiTbFindRsdp (&TableInfo, Flags);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "RSDP structure not found, %s Flags=%X\n",
- AcpiFormatException (Status), Flags));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
+ *TableAddress = PhysicalAddress;
+ return_ACPI_STATUS (AE_OK);
}
- RsdpAddress->PointerType = ACPI_PHYSICAL_POINTER;
- RsdpAddress->Pointer.Physical = TableInfo.PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
+ /* A valid RSDP was not found */
+
+ ACPI_ERROR ((AE_INFO, "A valid RSDP was not found"));
+ return_ACPI_STATUS (AE_NOT_FOUND);
}
+ACPI_EXPORT_SYMBOL (AcpiFindRootPointer)
+
/*******************************************************************************
*
@@ -483,17 +325,17 @@
*
******************************************************************************/
-UINT8 *
+static UINT8 *
AcpiTbScanMemoryForRsdp (
UINT8 *StartAddress,
UINT32 Length)
{
+ ACPI_STATUS Status;
UINT8 *MemRover;
UINT8 *EndAddress;
- UINT8 Checksum;
- ACPI_FUNCTION_TRACE ("TbScanMemoryForRsdp");
+ ACPI_FUNCTION_TRACE (TbScanMemoryForRsdp);
EndAddress = StartAddress + Length;
@@ -503,215 +345,26 @@
for (MemRover = StartAddress; MemRover < EndAddress;
MemRover += ACPI_RSDP_SCAN_STEP)
{
- /* The signature and checksum must both be correct */
-
- if (ACPI_STRNCMP ((char *) MemRover, RSDP_SIG, sizeof (RSDP_SIG)-1) != 0)
- {
- /* No signature match, keep looking */
-
- continue;
- }
-
- /* Signature matches, check the appropriate checksum */
-
- if (((RSDP_DESCRIPTOR *) MemRover)->Revision < 2)
- {
- /* ACPI version 1.0 */
-
- Checksum = AcpiTbChecksum (MemRover, ACPI_RSDP_CHECKSUM_LENGTH);
- }
- else
- {
- /* Post ACPI 1.0, use ExtendedChecksum */
+ /* The RSDP signature and checksum must both be correct */
- Checksum = AcpiTbChecksum (MemRover, ACPI_RSDP_XCHECKSUM_LENGTH);
- }
-
- if (Checksum == 0)
+ Status = AcpiTbValidateRsdp (ACPI_CAST_PTR (ACPI_TABLE_RSDP, MemRover));
+ if (ACPI_SUCCESS (Status))
{
- /* Checksum valid, we have found a valid RSDP */
+ /* Sig and checksum valid, we have found a real RSDP */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"RSDP located at physical address %p\n", MemRover));
return_PTR (MemRover);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Found an RSDP at physical address %p, but it has a bad checksum\n",
- MemRover));
+ /* No sig match or bad checksum, keep searching */
}
/* Searched entire block, no RSDP was found */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Searched entire block, no valid RSDP was found.\n"));
+ "Searched entire block from %p, valid RSDP was not found\n",
+ StartAddress));
return_PTR (NULL);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiTbFindRsdp
- *
- * PARAMETERS: *TableInfo - Where the table info is returned
- * Flags - Current memory mode (logical vs.
- * physical addressing)
- *
- * RETURN: Status, RSDP physical address
- *
- * DESCRIPTION: Search lower 1Mbyte of memory for the root system descriptor
- * pointer structure. If it is found, set *RSDP to point to it.
- *
- * NOTE1: The RSDP must be either in the first 1K of the Extended
- * BIOS Data Area or between E0000 and FFFFF (From ACPI Spec.)
- * Only a 32-bit physical address is necessary.
- *
- * NOTE2: This function is always available, regardless of the
- * initialization state of the rest of ACPI.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiTbFindRsdp (
- ACPI_TABLE_DESC *TableInfo,
- UINT32 Flags)
-{
- UINT8 *TablePtr;
- UINT8 *MemRover;
- UINT32 PhysicalAddress;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("TbFindRsdp");
-
-
- /*
- * Scan supports either 1) Logical addressing or 2) Physical addressing
- */
- if ((Flags & ACPI_MEMORY_MODE) == ACPI_LOGICAL_ADDRESSING)
- {
- /*
- * 1a) Get the location of the EBDA
- */
- Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_EBDA_PTR_LOCATION,
- ACPI_EBDA_PTR_LENGTH,
- (void *) &TablePtr);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n",
- ACPI_EBDA_PTR_LOCATION, ACPI_EBDA_PTR_LENGTH));
- return_ACPI_STATUS (Status);
- }
-
- ACPI_MOVE_16_TO_32 (&PhysicalAddress, TablePtr);
- PhysicalAddress <<= 4; /* Convert segment to physical address */
- AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_PTR_LENGTH);
-
- /* EBDA present? */
-
- if (PhysicalAddress > 0x400)
- {
- /*
- * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of 1K length)
- */
- Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) PhysicalAddress,
- ACPI_EBDA_WINDOW_SIZE,
- (void *) &TablePtr);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n",
- PhysicalAddress, ACPI_EBDA_WINDOW_SIZE));
- return_ACPI_STATUS (Status);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_EBDA_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, ACPI_EBDA_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- PhysicalAddress += ACPI_PTR_DIFF (MemRover, TablePtr);
-
- TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
- */
- Status = AcpiOsMapMemory ((ACPI_PHYSICAL_ADDRESS) ACPI_HI_RSDP_WINDOW_BASE,
- ACPI_HI_RSDP_WINDOW_SIZE,
- (void *) &TablePtr);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X for length %X\n",
- ACPI_HI_RSDP_WINDOW_BASE, ACPI_HI_RSDP_WINDOW_SIZE));
- return_ACPI_STATUS (Status);
- }
-
- MemRover = AcpiTbScanMemoryForRsdp (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
- AcpiOsUnmapMemory (TablePtr, ACPI_HI_RSDP_WINDOW_SIZE);
-
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- PhysicalAddress = ACPI_HI_RSDP_WINDOW_BASE + ACPI_PTR_DIFF (MemRover, TablePtr);
-
- TableInfo->PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) PhysicalAddress;
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /*
- * Physical addressing
- */
- else
- {
- /*
- * 1a) Get the location of the EBDA
- */
- ACPI_MOVE_16_TO_32 (&PhysicalAddress, ACPI_EBDA_PTR_LOCATION);
- PhysicalAddress <<= 4; /* Convert segment to physical address */
-
- /* EBDA present? */
-
- if (PhysicalAddress > 0x400)
- {
- /*
- * 1b) Search EBDA paragraphs (EBDA is required to be a minimum of 1K length)
- */
- MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (PhysicalAddress),
- ACPI_EBDA_WINDOW_SIZE);
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /*
- * 2) Search upper memory: 16-byte boundaries in E0000h-FFFFFh
- */
- MemRover = AcpiTbScanMemoryForRsdp (ACPI_PHYSADDR_TO_PTR (ACPI_HI_RSDP_WINDOW_BASE),
- ACPI_HI_RSDP_WINDOW_SIZE);
- if (MemRover)
- {
- /* Found it, return the physical address */
-
- TableInfo->PhysicalAddress = ACPI_TO_INTEGER (MemRover);
- return_ACPI_STATUS (AE_OK);
- }
- }
-
- /* RSDP signature was not found */
-
- return_ACPI_STATUS (AE_NOT_FOUND);
-}
-
-#endif
-
Index: exoparg6.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exoparg6.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exoparg6.c -L sys/contrib/dev/acpica/exoparg6.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exoparg6.c
+++ sys/contrib/dev/acpica/exoparg6.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg6 - AML execution - opcodes with 6 arguments
- * $Revision: 13 $
+ * $Revision: 1.29 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -150,87 +150,139 @@
* fully resolved operands.
!*/
+/* Local prototypes */
+
+static BOOLEAN
+AcpiExDoMatch (
+ UINT32 MatchOp,
+ ACPI_OPERAND_OBJECT *PackageObj,
+ ACPI_OPERAND_OBJECT *MatchObj);
+
/*******************************************************************************
*
* FUNCTION: AcpiExDoMatch
*
* PARAMETERS: MatchOp - The AML match operand
- * PackageValue - Value from the target package
- * MatchValue - Value to be matched
+ * PackageObj - Object from the target package
+ * MatchObj - Object to be matched
*
* RETURN: TRUE if the match is successful, FALSE otherwise
*
- * DESCRIPTION: Implements the low-level match for the ASL Match operator
+ * DESCRIPTION: Implements the low-level match for the ASL Match operator.
+ * Package elements will be implicitly converted to the type of
+ * the match object (Integer/Buffer/String).
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
AcpiExDoMatch (
UINT32 MatchOp,
- ACPI_INTEGER PackageValue,
- ACPI_INTEGER MatchValue)
+ ACPI_OPERAND_OBJECT *PackageObj,
+ ACPI_OPERAND_OBJECT *MatchObj)
{
+ BOOLEAN LogicalResult = TRUE;
+ ACPI_STATUS Status;
+
+ /*
+ * Note: Since the PackageObj/MatchObj ordering is opposite to that of
+ * the standard logical operators, we have to reverse them when we call
+ * DoLogicalOp in order to make the implicit conversion rules work
+ * correctly. However, this means we have to flip the entire equation
+ * also. A bit ugly perhaps, but overall, better than fussing the
+ * parameters around at runtime, over and over again.
+ *
+ * Below, P[i] refers to the package element, M refers to the Match object.
+ */
switch (MatchOp)
{
- case MATCH_MTR: /* always true */
+ case MATCH_MTR:
- break;
+ /* Always true */
+ break;
- case MATCH_MEQ: /* true if equal */
+ case MATCH_MEQ:
- if (PackageValue != MatchValue)
+ /*
+ * True if equal: (P[i] == M)
+ * Change to: (M == P[i])
+ */
+ Status = AcpiExDoLogicalOp (AML_LEQUAL_OP, MatchObj, PackageObj,
+ &LogicalResult);
+ if (ACPI_FAILURE (Status))
{
return (FALSE);
}
break;
+ case MATCH_MLE:
- case MATCH_MLE: /* true if less than or equal */
-
- if (PackageValue > MatchValue)
+ /*
+ * True if less than or equal: (P[i] <= M) (P[i] NotGreater than M)
+ * Change to: (M >= P[i]) (M NotLess than P[i])
+ */
+ Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
+ &LogicalResult);
+ if (ACPI_FAILURE (Status))
{
return (FALSE);
}
+ LogicalResult = (BOOLEAN) !LogicalResult;
break;
+ case MATCH_MLT:
- case MATCH_MLT: /* true if less than */
-
- if (PackageValue >= MatchValue)
+ /*
+ * True if less than: (P[i] < M)
+ * Change to: (M > P[i])
+ */
+ Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
+ &LogicalResult);
+ if (ACPI_FAILURE (Status))
{
return (FALSE);
}
break;
+ case MATCH_MGE:
- case MATCH_MGE: /* true if greater than or equal */
-
- if (PackageValue < MatchValue)
+ /*
+ * True if greater than or equal: (P[i] >= M) (P[i] NotLess than M)
+ * Change to: (M <= P[i]) (M NotGreater than P[i])
+ */
+ Status = AcpiExDoLogicalOp (AML_LGREATER_OP, MatchObj, PackageObj,
+ &LogicalResult);
+ if (ACPI_FAILURE (Status))
{
return (FALSE);
}
+ LogicalResult = (BOOLEAN)!LogicalResult;
break;
+ case MATCH_MGT:
- case MATCH_MGT: /* true if greater than */
-
- if (PackageValue <= MatchValue)
+ /*
+ * True if greater than: (P[i] > M)
+ * Change to: (M < P[i])
+ */
+ Status = AcpiExDoLogicalOp (AML_LLESS_OP, MatchObj, PackageObj,
+ &LogicalResult);
+ if (ACPI_FAILURE (Status))
{
return (FALSE);
}
break;
+ default:
- default: /* undefined */
+ /* Undefined */
return (FALSE);
}
-
- return TRUE;
+ return LogicalResult;
}
@@ -253,39 +305,46 @@
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
ACPI_STATUS Status = AE_OK;
- UINT32 Index;
+ ACPI_INTEGER Index;
ACPI_OPERAND_OBJECT *ThisElement;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_6A_0T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_6A_0T_1R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
{
case AML_MATCH_OP:
/*
- * Match (SearchPackage[0], MatchOp1[1], MatchObject1[2],
- * MatchOp2[3], MatchObject2[4], StartIndex[5])
+ * Match (SearchPkg[0], MatchOp1[1], MatchObj1[2],
+ * MatchOp2[3], MatchObj2[4], StartIndex[5])
*/
- /* Validate match comparison sub-opcodes */
+ /* Validate both Match Term Operators (MTR, MEQ, etc.) */
if ((Operand[1]->Integer.Value > MAX_MATCH_OPERATOR) ||
(Operand[3]->Integer.Value > MAX_MATCH_OPERATOR))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "operation encoding out of range\n"));
+ ACPI_ERROR ((AE_INFO, "Match operator out of range"));
Status = AE_AML_OPERAND_VALUE;
goto Cleanup;
}
- Index = (UINT32) Operand[5]->Integer.Value;
- if (Index >= (UINT32) Operand[0]->Package.Count)
+ /* Get the package StartIndex, validate against the package length */
+
+ Index = Operand[5]->Integer.Value;
+ if (Index >= Operand[0]->Package.Count)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Index beyond package end\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Index (%X%8.8X) beyond package end (%X)",
+ ACPI_FORMAT_UINT64 (Index), Operand[0]->Package.Count));
Status = AE_AML_PACKAGE_LIMIT;
goto Cleanup;
}
+ /* Create an integer for the return value */
+
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
@@ -299,40 +358,42 @@
ReturnDesc->Integer.Value = ACPI_INTEGER_MAX;
/*
- * Examine each element until a match is found. Within the loop,
+ * Examine each element until a match is found. Both match conditions
+ * must be satisfied for a match to occur. Within the loop,
* "continue" signifies that the current element does not match
* and the next should be examined.
*
* Upon finding a match, the loop will terminate via "break" at
- * the bottom. If it terminates "normally", MatchValue will be -1
- * (its initial value) indicating that no match was found. When
- * returned as a Number, this will produce the Ones value as specified.
+ * the bottom. If it terminates "normally", MatchValue will be
+ * ACPI_INTEGER_MAX (Ones) (its initial value) indicating that no
+ * match was found.
*/
for ( ; Index < Operand[0]->Package.Count; Index++)
{
+ /* Get the current package element */
+
ThisElement = Operand[0]->Package.Elements[Index];
- /*
- * Treat any NULL or non-numeric elements as non-matching.
- */
- if (!ThisElement ||
- ACPI_GET_OBJECT_TYPE (ThisElement) != ACPI_TYPE_INTEGER)
+ /* Treat any uninitialized (NULL) elements as non-matching */
+
+ if (!ThisElement)
{
continue;
}
/*
- * "continue" (proceed to next iteration of enclosing
- * "for" loop) signifies a non-match.
+ * Both match conditions must be satisfied. Execution of a continue
+ * (proceed to next iteration of enclosing for loop) signifies a
+ * non-match.
*/
if (!AcpiExDoMatch ((UINT32) Operand[1]->Integer.Value,
- ThisElement->Integer.Value, Operand[2]->Integer.Value))
+ ThisElement, Operand[2]))
{
continue;
}
if (!AcpiExDoMatch ((UINT32) Operand[3]->Integer.Value,
- ThisElement->Integer.Value, Operand[4]->Integer.Value))
+ ThisElement, Operand[4]))
{
continue;
}
@@ -342,7 +403,6 @@
ReturnDesc->Integer.Value = Index;
break;
}
-
break;
@@ -354,16 +414,13 @@
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
- WalkState->ResultObj = ReturnDesc;
-
-
Cleanup:
/* Delete return object on error */
@@ -373,5 +430,12 @@
AcpiUtRemoveReference (ReturnDesc);
}
+ /* Save return object on success */
+
+ else
+ {
+ WalkState->ResultObj = ReturnDesc;
+ }
+
return_ACPI_STATUS (Status);
}
Index: utcopy.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utcopy.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utcopy.c -L sys/contrib/dev/acpica/utcopy.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utcopy.c
+++ sys/contrib/dev/acpica/utcopy.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utcopy - Internal to external object translation utilities
- * $Revision: 115 $
+ * $Revision: 1.130 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,21 +123,69 @@
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utcopy")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiUtCopyIsimpleToEsimple (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ ACPI_OBJECT *ExternalObject,
+ UINT8 *DataSpace,
+ ACPI_SIZE *BufferSpaceUsed);
+
+static ACPI_STATUS
+AcpiUtCopyIelementToIelement (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context);
+
+static ACPI_STATUS
+AcpiUtCopyIpackageToEpackage (
+ ACPI_OPERAND_OBJECT *InternalObject,
+ UINT8 *Buffer,
+ ACPI_SIZE *SpaceUsed);
+
+static ACPI_STATUS
+AcpiUtCopyEsimpleToIsimple(
+ ACPI_OBJECT *UserObj,
+ ACPI_OPERAND_OBJECT **ReturnObj);
+
+static ACPI_STATUS
+AcpiUtCopySimpleObject (
+ ACPI_OPERAND_OBJECT *SourceDesc,
+ ACPI_OPERAND_OBJECT *DestDesc);
+
+static ACPI_STATUS
+AcpiUtCopyIelementToEelement (
+ UINT8 ObjectType,
+ ACPI_OPERAND_OBJECT *SourceObject,
+ ACPI_GENERIC_STATE *State,
+ void *Context);
+
+static ACPI_STATUS
+AcpiUtCopyIpackageToIpackage (
+ ACPI_OPERAND_OBJECT *SourceObj,
+ ACPI_OPERAND_OBJECT *DestObj,
+ ACPI_WALK_STATE *WalkState);
+
/*******************************************************************************
*
* FUNCTION: AcpiUtCopyIsimpleToEsimple
*
- * PARAMETERS: *InternalObject - Pointer to the object we are examining
- * *Buffer - Where the object is returned
- * *SpaceUsed - Where the data length is returned
+ * PARAMETERS: InternalObject - Source object to be copied
+ * ExternalObject - Where to return the copied object
+ * DataSpace - Where object data is returned (such as
+ * buffer and string data)
+ * BufferSpaceUsed - Length of DataSpace that was used
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to place a simple object in a user
- * buffer.
+ * DESCRIPTION: This function is called to copy a simple internal object to
+ * an external object.
*
- * The buffer is assumed to have sufficient space for the object.
+ * The DataSpace buffer is assumed to have sufficient space for
+ * the object.
*
******************************************************************************/
@@ -151,7 +199,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("UtCopyIsimpleToEsimple");
+ ACPI_FUNCTION_TRACE (UtCopyIsimpleToEsimple);
*BufferSpaceUsed = 0;
@@ -183,10 +231,12 @@
ExternalObject->String.Pointer = (char *) DataSpace;
ExternalObject->String.Length = InternalObject->String.Length;
- *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD ((ACPI_SIZE) InternalObject->String.Length + 1);
+ *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
+ (ACPI_SIZE) InternalObject->String.Length + 1);
- ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->String.Pointer,
- (ACPI_SIZE) InternalObject->String.Length + 1);
+ ACPI_MEMCPY ((void *) DataSpace,
+ (void *) InternalObject->String.Pointer,
+ (ACPI_SIZE) InternalObject->String.Length + 1);
break;
@@ -194,10 +244,12 @@
ExternalObject->Buffer.Pointer = DataSpace;
ExternalObject->Buffer.Length = InternalObject->Buffer.Length;
- *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (InternalObject->String.Length);
+ *BufferSpaceUsed = ACPI_ROUND_UP_TO_NATIVE_WORD (
+ InternalObject->String.Length);
- ACPI_MEMCPY ((void *) DataSpace, (void *) InternalObject->Buffer.Pointer,
- InternalObject->Buffer.Length);
+ ACPI_MEMCPY ((void *) DataSpace,
+ (void *) InternalObject->Buffer.Pointer,
+ InternalObject->Buffer.Length);
break;
@@ -271,7 +323,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtCopyIelementToEelement (
UINT8 ObjectType,
ACPI_OPERAND_OBJECT *SourceObject,
@@ -290,7 +342,7 @@
ThisIndex = State->Pkg.Index;
TargetObject = (ACPI_OBJECT *)
- &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];
+ &((ACPI_OBJECT *)(State->Pkg.DestObject))->Package.Elements[ThisIndex];
switch (ObjectType)
{
@@ -315,7 +367,8 @@
*/
TargetObject->Type = ACPI_TYPE_PACKAGE;
TargetObject->Package.Count = SourceObject->Package.Count;
- TargetObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace);
+ TargetObject->Package.Elements =
+ ACPI_CAST_PTR (ACPI_OBJECT, Info->FreeSpace);
/*
* Pass the new package object back to the package walk routine
@@ -327,7 +380,8 @@
* update the buffer length counter
*/
ObjectSpace = ACPI_ROUND_UP_TO_NATIVE_WORD (
- (ACPI_SIZE) TargetObject->Package.Count * sizeof (ACPI_OBJECT));
+ (ACPI_SIZE) TargetObject->Package.Count *
+ sizeof (ACPI_OBJECT));
break;
@@ -345,9 +399,9 @@
*
* FUNCTION: AcpiUtCopyIpackageToEpackage
*
- * PARAMETERS: *InternalObject - Pointer to the object we are returning
- * *Buffer - Where the object is returned
- * *SpaceUsed - Where the object length is returned
+ * PARAMETERS: InternalObject - Pointer to the object we are returning
+ * Buffer - Where the object is returned
+ * SpaceUsed - Where the object length is returned
*
* RETURN: Status
*
@@ -371,7 +425,7 @@
ACPI_PKG_INFO Info;
- ACPI_FUNCTION_TRACE ("UtCopyIpackageToEpackage");
+ ACPI_FUNCTION_TRACE (UtCopyIpackageToEpackage);
/*
@@ -383,13 +437,15 @@
* Free space begins right after the first package
*/
Info.Length = ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
- Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
+ Info.FreeSpace = Buffer + ACPI_ROUND_UP_TO_NATIVE_WORD (
+ sizeof (ACPI_OBJECT));
Info.ObjectSpace = 0;
Info.NumPackages = 1;
ExternalObject->Type = ACPI_GET_OBJECT_TYPE (InternalObject);
ExternalObject->Package.Count = InternalObject->Package.Count;
- ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT, Info.FreeSpace);
+ ExternalObject->Package.Elements = ACPI_CAST_PTR (ACPI_OBJECT,
+ Info.FreeSpace);
/*
* Leave room for an array of ACPI_OBJECTS in the buffer
@@ -401,7 +457,7 @@
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT));
Status = AcpiUtWalkPackageTree (InternalObject, ExternalObject,
- AcpiUtCopyIelementToEelement, &Info);
+ AcpiUtCopyIelementToEelement, &Info);
*SpaceUsed = Info.Length;
return_ACPI_STATUS (Status);
@@ -412,8 +468,8 @@
*
* FUNCTION: AcpiUtCopyIobjectToEobject
*
- * PARAMETERS: *InternalObject - The internal object to be converted
- * *BufferPtr - Where the object is returned
+ * PARAMETERS: InternalObject - The internal object to be converted
+ * BufferPtr - Where the object is returned
*
* RETURN: Status
*
@@ -430,7 +486,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtCopyIobjectToEobject");
+ ACPI_FUNCTION_TRACE (UtCopyIobjectToEobject);
if (ACPI_GET_OBJECT_TYPE (InternalObject) == ACPI_TYPE_PACKAGE)
@@ -448,10 +504,10 @@
* Build a simple object (no nested objects)
*/
Status = AcpiUtCopyIsimpleToEsimple (InternalObject,
- (ACPI_OBJECT *) RetBuffer->Pointer,
- ((UINT8 *) RetBuffer->Pointer +
+ ACPI_CAST_PTR (ACPI_OBJECT, RetBuffer->Pointer),
+ ACPI_ADD_PTR (UINT8, RetBuffer->Pointer,
ACPI_ROUND_UP_TO_NATIVE_WORD (sizeof (ACPI_OBJECT))),
- &RetBuffer->Length);
+ &RetBuffer->Length);
/*
* build simple does not include the object size in the length
* so we add it in here
@@ -467,8 +523,8 @@
*
* FUNCTION: AcpiUtCopyEsimpleToIsimple
*
- * PARAMETERS: *ExternalObject - The external object to be converted
- * *InternalObject - Where the internal object is returned
+ * PARAMETERS: ExternalObject - The external object to be converted
+ * RetInternalObject - Where the internal object is returned
*
* RETURN: Status
*
@@ -479,7 +535,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtCopyEsimpleToIsimple (
ACPI_OBJECT *ExternalObject,
ACPI_OPERAND_OBJECT **RetInternalObject)
@@ -487,7 +543,7 @@
ACPI_OPERAND_OBJECT *InternalObject;
- ACPI_FUNCTION_TRACE ("UtCopyEsimpleToIsimple");
+ ACPI_FUNCTION_TRACE (UtCopyEsimpleToIsimple);
/*
@@ -499,7 +555,8 @@
case ACPI_TYPE_BUFFER:
case ACPI_TYPE_INTEGER:
- InternalObject = AcpiUtCreateInternalObject ((UINT8) ExternalObject->Type);
+ InternalObject = AcpiUtCreateInternalObject (
+ (UINT8) ExternalObject->Type);
if (!InternalObject)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -520,7 +577,7 @@
case ACPI_TYPE_STRING:
InternalObject->String.Pointer =
- ACPI_MEM_CALLOCATE ((ACPI_SIZE) ExternalObject->String.Length + 1);
+ ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) ExternalObject->String.Length + 1);
if (!InternalObject->String.Pointer)
{
goto ErrorExit;
@@ -537,7 +594,7 @@
case ACPI_TYPE_BUFFER:
InternalObject->Buffer.Pointer =
- ACPI_MEM_CALLOCATE (ExternalObject->Buffer.Length);
+ ACPI_ALLOCATE_ZEROED (ExternalObject->Buffer.Length);
if (!InternalObject->Buffer.Pointer)
{
goto ErrorExit;
@@ -572,7 +629,6 @@
#ifdef ACPI_FUTURE_IMPLEMENTATION
-
/* Code to convert packages that are parameters to control methods */
/*******************************************************************************
@@ -609,7 +665,7 @@
ACPI_OBJECT *ThisExternalObj;
- ACPI_FUNCTION_TRACE ("UtCopyEpackageToIpackage");
+ ACPI_FUNCTION_TRACE (UtCopyEpackageToIpackage);
/*
@@ -662,7 +718,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("UtCopyEobjectToIobject");
+ ACPI_FUNCTION_TRACE (UtCopyEobjectToIobject);
if (ExternalObject->Type == ACPI_TYPE_PACKAGE)
@@ -670,8 +726,8 @@
/*
* Packages as external input to control methods are not supported,
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Packages as parameters not implemented!\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Packages as parameters not implemented!"));
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
@@ -702,7 +758,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtCopySimpleObject (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *DestDesc)
@@ -726,66 +782,78 @@
DestDesc->Common.ReferenceCount = ReferenceCount;
DestDesc->Common.NextObject = NextObject;
+ /* New object is not static, regardless of source */
+
+ DestDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
+
/* Handle the objects with extra data */
switch (ACPI_GET_OBJECT_TYPE (DestDesc))
{
case ACPI_TYPE_BUFFER:
-
- DestDesc->Buffer.Node = NULL;
- DestDesc->Common.Flags = SourceDesc->Common.Flags;
-
/*
* Allocate and copy the actual buffer if and only if:
* 1) There is a valid buffer pointer
- * 2) The buffer is not static (not in an ACPI table) (in this case,
- * the actual pointer was already copied above)
+ * 2) The buffer has a length > 0
*/
if ((SourceDesc->Buffer.Pointer) &&
- (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ (SourceDesc->Buffer.Length))
{
- DestDesc->Buffer.Pointer = NULL;
-
- /* Create an actual buffer only if length > 0 */
-
- if (SourceDesc->Buffer.Length)
+ DestDesc->Buffer.Pointer =
+ ACPI_ALLOCATE (SourceDesc->Buffer.Length);
+ if (!DestDesc->Buffer.Pointer)
{
- DestDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (SourceDesc->Buffer.Length);
- if (!DestDesc->Buffer.Pointer)
- {
- return (AE_NO_MEMORY);
- }
+ return (AE_NO_MEMORY);
+ }
- /* Copy the actual buffer data */
+ /* Copy the actual buffer data */
- ACPI_MEMCPY (DestDesc->Buffer.Pointer, SourceDesc->Buffer.Pointer,
- SourceDesc->Buffer.Length);
- }
+ ACPI_MEMCPY (DestDesc->Buffer.Pointer,
+ SourceDesc->Buffer.Pointer,
+ SourceDesc->Buffer.Length);
}
break;
case ACPI_TYPE_STRING:
-
/*
* Allocate and copy the actual string if and only if:
* 1) There is a valid string pointer
- * 2) The string is not static (not in an ACPI table) (in this case,
- * the actual pointer was already copied above)
+ * (Pointer to a NULL string is allowed)
*/
- if ((SourceDesc->String.Pointer) &&
- (!(SourceDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
+ if (SourceDesc->String.Pointer)
{
- DestDesc->String.Pointer = ACPI_MEM_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1);
+ DestDesc->String.Pointer =
+ ACPI_ALLOCATE ((ACPI_SIZE) SourceDesc->String.Length + 1);
if (!DestDesc->String.Pointer)
{
return (AE_NO_MEMORY);
}
+ /* Copy the actual string data */
+
ACPI_MEMCPY (DestDesc->String.Pointer, SourceDesc->String.Pointer,
(ACPI_SIZE) SourceDesc->String.Length + 1);
}
break;
+ case ACPI_TYPE_LOCAL_REFERENCE:
+ /*
+ * We copied the reference object, so we now must add a reference
+ * to the object pointed to by the reference
+ */
+ AcpiUtAddReference (SourceDesc->Reference.Object);
+ break;
+
+ case ACPI_TYPE_REGION:
+ /*
+ * We copied the Region Handler, so we now must add a reference
+ */
+ if (DestDesc->Region.Handler)
+ {
+ AcpiUtAddReference (DestDesc->Region.Handler);
+ }
+ break;
+
default:
/* Nothing to do for other simple objects */
break;
@@ -807,7 +875,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtCopyIelementToIelement (
UINT8 ObjectType,
ACPI_OPERAND_OBJECT *SourceObject,
@@ -880,9 +948,8 @@
/*
* Create the object array
*/
- TargetObject->Package.Elements =
- ACPI_MEM_CALLOCATE (((ACPI_SIZE) SourceObject->Package.Count + 1) *
- sizeof (void *));
+ TargetObject->Package.Elements = ACPI_ALLOCATE_ZEROED (
+ ((ACPI_SIZE) SourceObject->Package.Count + 1) * sizeof (void *));
if (!TargetObject->Package.Elements)
{
Status = AE_NO_MEMORY;
@@ -927,7 +994,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiUtCopyIpackageToIpackage (
ACPI_OPERAND_OBJECT *SourceObj,
ACPI_OPERAND_OBJECT *DestObj,
@@ -936,7 +1003,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("UtCopyIpackageToIpackage");
+ ACPI_FUNCTION_TRACE (UtCopyIpackageToIpackage);
DestObj->Common.Type = ACPI_GET_OBJECT_TYPE (SourceObj);
@@ -946,13 +1013,12 @@
/*
* Create the object array and walk the source package tree
*/
- DestObj->Package.Elements = ACPI_MEM_CALLOCATE (
+ DestObj->Package.Elements = ACPI_ALLOCATE_ZEROED (
((ACPI_SIZE) SourceObj->Package.Count + 1) *
sizeof (void *));
if (!DestObj->Package.Elements)
{
- ACPI_REPORT_ERROR (
- ("AmlBuildCopyInternalPackageObject: Package allocation failure\n"));
+ ACPI_ERROR ((AE_INFO, "Package allocation failure"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -961,7 +1027,7 @@
* This handles nested packages of arbitrary depth.
*/
Status = AcpiUtWalkPackageTree (SourceObj, DestObj,
- AcpiUtCopyIelementToIelement, WalkState);
+ AcpiUtCopyIelementToIelement, WalkState);
if (ACPI_FAILURE (Status))
{
/* On failure, delete the destination package object */
@@ -996,7 +1062,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("UtCopyIobjectToIobject");
+ ACPI_FUNCTION_TRACE (UtCopyIobjectToIobject);
/* Create the top level object */
Index: dbutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbutils.c -L sys/contrib/dev/acpica/dbutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbutils.c
+++ sys/contrib/dev/acpica/dbutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbutils - AML debugger utilities
- * $Revision: 68 $
+ * $Revision: 1.83 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,11 +116,8 @@
#include <contrib/dev/acpica/acpi.h>
-#include <contrib/dev/acpica/acparser.h>
-#include <contrib/dev/acpica/amlcode.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acdebug.h>
-#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acdisasm.h>
@@ -129,6 +126,20 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbutils")
+/* Local prototypes */
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+ACPI_STATUS
+AcpiDbSecondPassParse (
+ ACPI_PARSE_OBJECT *Root);
+
+void
+AcpiDbDumpBuffer (
+ UINT32 Address);
+#endif
+
+static char *Converter = "0123456789ABCDEF";
+
/*******************************************************************************
*
@@ -178,7 +189,7 @@
*
* RETURN: None
*
- * DESCRIPTION: Set the current destination for debugger output. Alos sets
+ * DESCRIPTION: Set the current destination for debugger output. Also sets
* the debug output level accordingly.
*
******************************************************************************/
@@ -203,32 +214,7 @@
/*******************************************************************************
*
- * FUNCTION: AcpiDbDumpBuffer
- *
- * PARAMETERS: Address - Pointer to the buffer
- *
- * RETURN: None
- *
- * DESCRIPTION: Print a portion of a buffer
- *
- ******************************************************************************/
-
-void
-AcpiDbDumpBuffer (
- UINT32 Address)
-{
-
- AcpiOsPrintf ("\nLocation %X:\n", Address);
-
- AcpiDbgLevel |= ACPI_LV_TABLES;
- AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY,
- ACPI_UINT32_MAX);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDbDumpObject
+ * FUNCTION: AcpiDbDumpExternalObject
*
* PARAMETERS: ObjDesc - External ACPI object to dump
* Level - Nesting level.
@@ -240,7 +226,7 @@
******************************************************************************/
void
-AcpiDbDumpObject (
+AcpiDbDumpExternalObject (
ACPI_OBJECT *ObjDesc,
UINT32 Level)
{
@@ -262,7 +248,7 @@
{
case ACPI_TYPE_ANY:
- AcpiOsPrintf ("[Object Reference] = ", ObjDesc->Reference.Handle);
+ AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle);
AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
break;
@@ -276,7 +262,7 @@
case ACPI_TYPE_STRING:
- AcpiOsPrintf ("[String] Value: ");
+ AcpiOsPrintf ("[String] Length %.2X = ", ObjDesc->String.Length);
for (i = 0; i < ObjDesc->String.Length; i++)
{
AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
@@ -290,7 +276,7 @@
AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
if (ObjDesc->Buffer.Length)
{
- AcpiUtDumpBuffer ((UINT8 *) ObjDesc->Buffer.Pointer,
+ AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
}
else
@@ -302,19 +288,19 @@
case ACPI_TYPE_PACKAGE:
- AcpiOsPrintf ("[Package] Contains %d Elements: \n",
+ AcpiOsPrintf ("[Package] Contains %d Elements:\n",
ObjDesc->Package.Count);
for (i = 0; i < ObjDesc->Package.Count; i++)
{
- AcpiDbDumpObject (&ObjDesc->Package.Elements[i], Level+1);
+ AcpiDbDumpExternalObject (&ObjDesc->Package.Elements[i], Level+1);
}
break;
case ACPI_TYPE_LOCAL_REFERENCE:
- AcpiOsPrintf ("[Object Reference] = ", ObjDesc->Reference.Handle);
+ AcpiOsPrintf ("[Object Reference] = %p", ObjDesc->Reference.Handle);
AcpiDmDisplayInternalObject (ObjDesc->Reference.Handle, NULL);
break;
@@ -333,7 +319,7 @@
default:
- AcpiOsPrintf ("[Unknown Type] %X \n", ObjDesc->Type);
+ AcpiOsPrintf ("[Unknown Type] %X\n", ObjDesc->Type);
break;
}
}
@@ -356,13 +342,12 @@
char *Name)
{
-
if (!Name)
{
return;
}
- ACPI_STRUPR (Name);
+ AcpiUtStrupr (Name);
/* Convert a leading forward slash to a backslash */
@@ -395,6 +380,100 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiDbLocalNsLookup
+ *
+ * PARAMETERS: Name - Name to lookup
+ *
+ * RETURN: Pointer to a namespace node, null on failure
+ *
+ * DESCRIPTION: Lookup a name in the ACPI namespace
+ *
+ * Note: Currently begins search from the root. Could be enhanced to use
+ * the current prefix (scope) node as the search beginning point.
+ *
+ ******************************************************************************/
+
+ACPI_NAMESPACE_NODE *
+AcpiDbLocalNsLookup (
+ char *Name)
+{
+ char *InternalPath;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node = NULL;
+
+
+ AcpiDbPrepNamestring (Name);
+
+ /* Build an internal namestring */
+
+ Status = AcpiNsInternalizeName (Name, &InternalPath);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Invalid namestring: %s\n", Name);
+ return (NULL);
+ }
+
+ /*
+ * Lookup the name.
+ * (Uses root node as the search starting point)
+ */
+ Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not locate name: %s, %s\n",
+ Name, AcpiFormatException (Status));
+ }
+
+ ACPI_FREE (InternalPath);
+ return (Node);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbUInt32ToHexString
+ *
+ * PARAMETERS: Value - The value to be converted to string
+ * Buffer - Buffer for result (not less than 11 bytes)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert the unsigned 32-bit value to the hexadecimal image
+ *
+ * NOTE: It is the caller's responsibility to ensure that the length of buffer
+ * is sufficient.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbUInt32ToHexString (
+ UINT32 Value,
+ char *Buffer)
+{
+ UINT8 i;
+
+
+ if (Value == 0)
+ {
+ ACPI_STRCPY (Buffer, "0");
+ return;
+ }
+
+ ACPI_STRCPY (Buffer, "0x");
+ Buffer[10] = '\0';
+
+ for (i = 9; i > 1; i--)
+ {
+ Buffer[i] = Converter [Value & 0x0F];
+ Value = Value >> 4;
+ }
+}
+
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbSecondPassParse
*
* PARAMETERS: Root - Root of the parse tree
@@ -443,7 +522,8 @@
WalkState->ParserState.Aml =
WalkState->ParserState.AmlStart = Method->Named.Data;
WalkState->ParserState.AmlEnd =
- WalkState->ParserState.PkgEnd = Method->Named.Data + Method->Named.Length;
+ WalkState->ParserState.PkgEnd = Method->Named.Data +
+ Method->Named.Length;
WalkState->ParserState.StartScope = Op;
WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
@@ -488,55 +568,28 @@
/*******************************************************************************
*
- * FUNCTION: AcpiDbLocalNsLookup
- *
- * PARAMETERS: Name - Name to lookup
+ * FUNCTION: AcpiDbDumpBuffer
*
- * RETURN: Pointer to a namespace node
+ * PARAMETERS: Address - Pointer to the buffer
*
- * DESCRIPTION: Lookup a name in the ACPI namespace
+ * RETURN: None
*
- * Note: Currently begins search from the root. Could be enhanced to use
- * the current prefix (scope) node as the search beginning point.
+ * DESCRIPTION: Print a portion of a buffer
*
******************************************************************************/
-ACPI_NAMESPACE_NODE *
-AcpiDbLocalNsLookup (
- char *Name)
+void
+AcpiDbDumpBuffer (
+ UINT32 Address)
{
- char *InternalPath;
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node = NULL;
-
-
- AcpiDbPrepNamestring (Name);
-
- /* Build an internal namestring */
-
- Status = AcpiNsInternalizeName (Name, &InternalPath);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Invalid namestring: %s\n", Name);
- return (NULL);
- }
- /*
- * Lookup the name.
- * (Uses root node as the search starting point)
- */
- Status = AcpiNsLookup (NULL, InternalPath, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsPrintf ("Could not locate name: %s %s\n",
- Name, AcpiFormatException (Status));
- }
+ AcpiOsPrintf ("\nLocation %X:\n", Address);
- ACPI_MEM_FREE (InternalPath);
- return (Node);
+ AcpiDbgLevel |= ACPI_LV_TABLES;
+ AcpiUtDumpBuffer (ACPI_TO_POINTER (Address), 64, DB_BYTE_DISPLAY,
+ ACPI_UINT32_MAX);
}
-
+#endif
#endif /* ACPI_DEBUGGER */
Index: acoutput.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acoutput.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acoutput.h -L sys/contrib/dev/acpica/acoutput.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acoutput.h
+++ sys/contrib/dev/acpica/acoutput.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acoutput.h -- debug output
- * $Revision: 95 $
+ * $Revision: 1.101 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -209,17 +209,22 @@
/*
* Debug level macros that are used in the DEBUG_PRINT macros
*/
-#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,__LINE__,&_DebugInfo
+#define ACPI_DEBUG_LEVEL(dl) (UINT32) dl,ACPI_DEBUG_PARAMETERS
/* Exception level -- used in the global "DebugLevel" */
-#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
-#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
#define ACPI_DB_INIT ACPI_DEBUG_LEVEL (ACPI_LV_INIT)
#define ACPI_DB_DEBUG_OBJECT ACPI_DEBUG_LEVEL (ACPI_LV_DEBUG_OBJECT)
#define ACPI_DB_INFO ACPI_DEBUG_LEVEL (ACPI_LV_INFO)
#define ACPI_DB_ALL_EXCEPTIONS ACPI_DEBUG_LEVEL (ACPI_LV_ALL_EXCEPTIONS)
+/*
+ * These two levels are essentially obsolete, all instances in the
+ * ACPICA core code have been replaced by ACPI_ERROR and ACPI_WARNING
+ * (Kept here because some drivers may still use them)
+ */
+#define ACPI_DB_ERROR ACPI_DEBUG_LEVEL (ACPI_LV_ERROR)
+#define ACPI_DB_WARN ACPI_DEBUG_LEVEL (ACPI_LV_WARN)
/* Trace level -- also used in the global "DebugLevel" */
Index: utinit.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utinit.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utinit.c -L sys/contrib/dev/acpica/utinit.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utinit.c
+++ sys/contrib/dev/acpica/utinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utinit - Common ACPI subsystem initialization
- * $Revision: 118 $
+ * $Revision: 1.135 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,126 +120,15 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acevents.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utinit")
+/* Local prototypes */
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtFadtRegisterError
- *
- * PARAMETERS: *RegisterName - Pointer to string identifying register
- * Value - Actual register contents value
- * AcpiTestSpecSection - TDS section containing assertion
- * AcpiAssertion - Assertion number being tested
- *
- * RETURN: AE_BAD_VALUE
- *
- * DESCRIPTION: Display failure message and link failure to TDS assertion
- *
- ******************************************************************************/
-
-static void
-AcpiUtFadtRegisterError (
- char *RegisterName,
- UINT32 Value,
- ACPI_SIZE Offset)
-{
-
- ACPI_REPORT_WARNING (
- ("Invalid FADT value %s=%X at offset %X FADT=%p\n",
- RegisterName, Value, (UINT32) Offset, AcpiGbl_FADT));
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiUtValidateFadt
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Validate various ACPI registers in the FADT
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtValidateFadt (
- void)
-{
-
- /*
- * Verify Fixed ACPI Description Table fields,
- * but don't abort on any problems, just display error
- */
- if (AcpiGbl_FADT->Pm1EvtLen < 4)
- {
- AcpiUtFadtRegisterError ("PM1_EVT_LEN",
- (UINT32) AcpiGbl_FADT->Pm1EvtLen,
- ACPI_FADT_OFFSET (Pm1EvtLen));
- }
-
- if (!AcpiGbl_FADT->Pm1CntLen)
- {
- AcpiUtFadtRegisterError ("PM1_CNT_LEN", 0,
- ACPI_FADT_OFFSET (Pm1CntLen));
- }
-
- if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address))
- {
- AcpiUtFadtRegisterError ("X_PM1a_EVT_BLK", 0,
- ACPI_FADT_OFFSET (XPm1aEvtBlk.Address));
- }
-
- if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1aCntBlk.Address))
- {
- AcpiUtFadtRegisterError ("X_PM1a_CNT_BLK", 0,
- ACPI_FADT_OFFSET (XPm1aCntBlk.Address));
- }
-
- if (!ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPmTmrBlk.Address))
- {
- AcpiUtFadtRegisterError ("X_PM_TMR_BLK", 0,
- ACPI_FADT_OFFSET (XPmTmrBlk.Address));
- }
-
- if ((ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address) &&
- !AcpiGbl_FADT->Pm2CntLen))
- {
- AcpiUtFadtRegisterError ("PM2_CNT_LEN",
- (UINT32) AcpiGbl_FADT->Pm2CntLen,
- ACPI_FADT_OFFSET (Pm2CntLen));
- }
-
- if (AcpiGbl_FADT->PmTmLen < 4)
- {
- AcpiUtFadtRegisterError ("PM_TM_LEN",
- (UINT32) AcpiGbl_FADT->PmTmLen,
- ACPI_FADT_OFFSET (PmTmLen));
- }
-
- /* Length of GPE blocks must be a multiple of 2 */
-
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address) &&
- (AcpiGbl_FADT->Gpe0BlkLen & 1))
- {
- AcpiUtFadtRegisterError ("(x)GPE0_BLK_LEN",
- (UINT32) AcpiGbl_FADT->Gpe0BlkLen,
- ACPI_FADT_OFFSET (Gpe0BlkLen));
- }
-
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address) &&
- (AcpiGbl_FADT->Gpe1BlkLen & 1))
- {
- AcpiUtFadtRegisterError ("(x)GPE1_BLK_LEN",
- (UINT32) AcpiGbl_FADT->Gpe1BlkLen,
- ACPI_FADT_OFFSET (Gpe1BlkLen));
- }
-
- return (AE_OK);
-}
+static void AcpiUtTerminate (
+ void);
/******************************************************************************
@@ -250,12 +139,13 @@
*
* RETURN: none
*
- * DESCRIPTION: free global memory
+ * DESCRIPTION: Free global memory
*
******************************************************************************/
-void
-AcpiUtTerminate (void)
+static void
+AcpiUtTerminate (
+ void)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_BLOCK_INFO *NextGpeBlock;
@@ -263,10 +153,7 @@
ACPI_GPE_XRUPT_INFO *NextGpeXruptInfo;
- ACPI_FUNCTION_TRACE ("UtTerminate");
-
-
- /* Free global tables, etc. */
+ ACPI_FUNCTION_TRACE (UtTerminate);
/* Free global GPE blocks and related info structures */
@@ -278,14 +165,14 @@
while (GpeBlock)
{
NextGpeBlock = GpeBlock->Next;
- ACPI_MEM_FREE (GpeBlock->EventInfo);
- ACPI_MEM_FREE (GpeBlock->RegisterInfo);
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock->EventInfo);
+ ACPI_FREE (GpeBlock->RegisterInfo);
+ ACPI_FREE (GpeBlock);
GpeBlock = NextGpeBlock;
}
NextGpeXruptInfo = GpeXruptInfo->Next;
- ACPI_MEM_FREE (GpeXruptInfo);
+ ACPI_FREE (GpeXruptInfo);
GpeXruptInfo = NextGpeXruptInfo;
}
@@ -307,23 +194,27 @@
******************************************************************************/
void
-AcpiUtSubsystemShutdown (void)
+AcpiUtSubsystemShutdown (
+ void)
{
- ACPI_FUNCTION_TRACE ("UtSubsystemShutdown");
+ ACPI_FUNCTION_TRACE (UtSubsystemShutdown);
/* Just exit if subsystem is already shutdown */
if (AcpiGbl_Shutdown)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "ACPI Subsystem is already terminated\n"));
+ ACPI_ERROR ((AE_INFO,
+ "ACPI Subsystem is already terminated"));
return_VOID;
}
/* Subsystem appears active, go ahead and shut it down */
AcpiGbl_Shutdown = TRUE;
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Shutting down ACPI Subsystem...\n"));
+ AcpiGbl_StartupFlags = 0;
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Shutting down ACPI Subsystem\n"));
/* Close the AcpiEvent Handling */
@@ -333,20 +224,17 @@
AcpiNsTerminate ();
+ /* Delete the ACPI tables */
+
+ AcpiTbTerminate ();
+
/* Close the globals */
AcpiUtTerminate ();
/* Purge the local caches */
- (void) AcpiPurgeCachedObjects ();
-
- /* Debug only - display leftover memory allocation, if any */
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL);
-#endif
-
+ (void) AcpiUtDeleteCaches ();
return_VOID;
}
Index: actbl.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/actbl.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/actbl.h -L sys/contrib/dev/acpica/actbl.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/actbl.h
+++ sys/contrib/dev/acpica/actbl.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Name: actbl.h - Table data structures defined in ACPI specification
- * $Revision: 66 $
+ * Name: actbl.h - Basic ACPI Table Definitions
+ * $Revision: 1.84 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,323 +117,279 @@
#ifndef __ACTBL_H__
#define __ACTBL_H__
-
/*
- * Values for description table header signatures
+ * Values for description table header signatures. Useful because they make
+ * it more difficult to inadvertently type in the wrong signature.
*/
-#define RSDP_NAME "RSDP"
-#define RSDP_SIG "RSD PTR " /* RSDT Pointer signature */
-#define APIC_SIG "APIC" /* Multiple APIC Description Table */
-#define DSDT_SIG "DSDT" /* Differentiated System Description Table */
-#define FADT_SIG "FACP" /* Fixed ACPI Description Table */
-#define FACS_SIG "FACS" /* Firmware ACPI Control Structure */
-#define PSDT_SIG "PSDT" /* Persistent System Description Table */
-#define RSDT_SIG "RSDT" /* Root System Description Table */
-#define XSDT_SIG "XSDT" /* Extended System Description Table */
-#define SSDT_SIG "SSDT" /* Secondary System Description Table */
-#define SBST_SIG "SBST" /* Smart Battery Specification Table */
-#define SPIC_SIG "SPIC" /* IOSAPIC table */
-#define BOOT_SIG "BOOT" /* Boot table */
-
-
-#define GL_OWNED 0x02 /* Ownership of global lock is bit 1 */
+#define ACPI_SIG_DSDT "DSDT" /* Differentiated System Description Table */
+#define ACPI_SIG_FADT "FACP" /* Fixed ACPI Description Table */
+#define ACPI_SIG_FACS "FACS" /* Firmware ACPI Control Structure */
+#define ACPI_SIG_PSDT "PSDT" /* Persistent System Description Table */
+#define ACPI_SIG_RSDP "RSD PTR " /* Root System Description Pointer */
+#define ACPI_SIG_RSDT "RSDT" /* Root System Description Table */
+#define ACPI_SIG_XSDT "XSDT" /* Extended System Description Table */
+#define ACPI_SIG_SSDT "SSDT" /* Secondary System Description Table */
+#define ACPI_RSDP_NAME "RSDP" /* Short name for RSDP, not signature */
/*
- * Common table types. The base code can remain
- * constant if the underlying tables are changed
+ * All tables and structures must be byte-packed to match the ACPI
+ * specification, since the tables are provided by the system BIOS
*/
-#define RSDT_DESCRIPTOR RSDT_DESCRIPTOR_REV2
-#define XSDT_DESCRIPTOR XSDT_DESCRIPTOR_REV2
-#define FACS_DESCRIPTOR FACS_DESCRIPTOR_REV2
-#define FADT_DESCRIPTOR FADT_DESCRIPTOR_REV2
-
-
#pragma pack(1)
+
/*
- * ACPI Version-independent tables
+ * These are the ACPI tables that are directly consumed by the subsystem.
+ *
+ * The RSDP and FACS do not use the common ACPI table header. All other ACPI
+ * tables use the header.
*
- * NOTE: The tables that are specific to ACPI versions (1.0, 2.0, etc.)
- * are in separate files.
+ * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
+ * This is the only type that is even remotely portable. Anything else is not
+ * portable, so do not use any other bitfield types.
*/
-typedef struct rsdp_descriptor /* Root System Descriptor Pointer */
-{
- char Signature [8]; /* ACPI signature, contains "RSD PTR " */
- UINT8 Checksum; /* To make sum of struct == 0 */
- char OemId [6]; /* OEM identification */
- UINT8 Revision; /* Must be 0 for 1.0, 2 for 2.0 */
- UINT32 RsdtPhysicalAddress; /* 32-bit physical address of RSDT */
- UINT32 Length; /* XSDT Length in bytes including hdr */
- UINT64 XsdtPhysicalAddress; /* 64-bit physical address of XSDT */
- UINT8 ExtendedChecksum; /* Checksum of entire table */
- char Reserved [3]; /* Reserved field must be 0 */
-
-} RSDP_DESCRIPTOR;
-
-typedef struct acpi_common_facs /* Common FACS for internal use */
-{
- UINT32 *GlobalLock;
- UINT64 *FirmwareWakingVector;
- UINT8 VectorWidth;
-
-} ACPI_COMMON_FACS;
-
-
-#define ACPI_TABLE_HEADER_DEF /* ACPI common table header */ \
- char Signature [4]; /* ACPI signature (4 ASCII characters) */\
- UINT32 Length; /* Length of table, in bytes, including header */\
- UINT8 Revision; /* ACPI Specification minor version # */\
- UINT8 Checksum; /* To make sum of entire table == 0 */\
- char OemId [6]; /* OEM identification */\
- char OemTableId [8]; /* OEM table identification */\
- UINT32 OemRevision; /* OEM revision number */\
- char AslCompilerId [4]; /* ASL compiler vendor ID */\
- UINT32 AslCompilerRevision; /* ASL compiler revision number */
-
-
-typedef struct acpi_table_header /* ACPI common table header */
-{
- ACPI_TABLE_HEADER_DEF
+/*******************************************************************************
+ *
+ * ACPI Table Header. This common header is used by all tables except the
+ * RSDP and FACS. The define is used for direct inclusion of header into
+ * other ACPI tables
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_header
+{
+ char Signature[ACPI_NAME_SIZE]; /* ASCII table signature */
+ UINT32 Length; /* Length of table in bytes, including this header */
+ UINT8 Revision; /* ACPI Specification minor version # */
+ UINT8 Checksum; /* To make sum of entire table == 0 */
+ char OemId[ACPI_OEM_ID_SIZE]; /* ASCII OEM identification */
+ char OemTableId[ACPI_OEM_TABLE_ID_SIZE]; /* ASCII OEM table identification */
+ UINT32 OemRevision; /* OEM revision number */
+ char AslCompilerId[ACPI_NAME_SIZE]; /* ASCII ASL compiler vendor ID */
+ UINT32 AslCompilerRevision; /* ASL compiler version */
} ACPI_TABLE_HEADER;
/*
- * MADT values and structures
- */
-
-/* Values for MADT PCATCompat */
-
-#define DUAL_PIC 0
-#define MULTIPLE_APIC 1
-
-
-/* Master MADT */
-
-typedef struct multiple_apic_table
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 LocalApicAddress; /* Physical address of local APIC */
- UINT32_BIT PCATCompat : 1; /* A one indicates system also has dual 8259s */
- UINT32_BIT Reserved1 : 31;
-
-} MULTIPLE_APIC_TABLE;
-
-
-/* Values for Type in APIC_HEADER_DEF */
-
-#define APIC_PROCESSOR 0
-#define APIC_IO 1
-#define APIC_XRUPT_OVERRIDE 2
-#define APIC_NMI 3
-#define APIC_LOCAL_NMI 4
-#define APIC_ADDRESS_OVERRIDE 5
-#define APIC_IO_SAPIC 6
-#define APIC_LOCAL_SAPIC 7
-#define APIC_XRUPT_SOURCE 8
-#define APIC_RESERVED 9 /* 9 and greater are reserved */
-
-/*
- * MADT sub-structures (Follow MULTIPLE_APIC_DESCRIPTION_TABLE)
+ * GAS - Generic Address Structure (ACPI 2.0+)
+ *
+ * Note: Since this structure is used in the ACPI tables, it is byte aligned.
+ * If misalignment is not supported, access to the Address field must be
+ * performed with care.
*/
-#define APIC_HEADER_DEF /* Common APIC sub-structure header */\
- UINT8 Type; \
- UINT8 Length;
-
-typedef struct apic_header
+typedef struct acpi_generic_address
{
- APIC_HEADER_DEF
-
-} APIC_HEADER;
-
-/* Values for MPS INTI flags */
-
-#define POLARITY_CONFORMS 0
-#define POLARITY_ACTIVE_HIGH 1
-#define POLARITY_RESERVED 2
-#define POLARITY_ACTIVE_LOW 3
-
-#define TRIGGER_CONFORMS 0
-#define TRIGGER_EDGE 1
-#define TRIGGER_RESERVED 2
-#define TRIGGER_LEVEL 3
-
-/* Common flag definitions */
-
-#define MPS_INTI_FLAGS \
- UINT16_BIT Polarity : 2; /* Polarity of APIC I/O input signals */\
- UINT16_BIT TriggerMode : 2; /* Trigger mode of APIC input signals */\
- UINT16_BIT Reserved1 : 12; /* Reserved, must be zero */
-
-#define LOCAL_APIC_FLAGS \
- UINT32_BIT ProcessorEnabled: 1; /* Processor is usable if set */\
- UINT32_BIT Reserved2 : 31; /* Reserved, must be zero */
-
-/* Sub-structures for MADT */
-
-typedef struct madt_processor_apic
-{
- APIC_HEADER_DEF
- UINT8 ProcessorId; /* ACPI processor id */
- UINT8 LocalApicId; /* Processor's local APIC id */
- LOCAL_APIC_FLAGS
-
-} MADT_PROCESSOR_APIC;
-
-typedef struct madt_io_apic
-{
- APIC_HEADER_DEF
- UINT8 IoApicId; /* I/O APIC ID */
- UINT8 Reserved; /* Reserved - must be zero */
- UINT32 Address; /* APIC physical address */
- UINT32 Interrupt; /* Global system interrupt where INTI
- * lines start */
-} MADT_IO_APIC;
-
-typedef struct madt_interrupt_override
-{
- APIC_HEADER_DEF
- UINT8 Bus; /* 0 - ISA */
- UINT8 Source; /* Interrupt source (IRQ) */
- UINT32 Interrupt; /* Global system interrupt */
- MPS_INTI_FLAGS
-
-} MADT_INTERRUPT_OVERRIDE;
-
-typedef struct madt_nmi_source
-{
- APIC_HEADER_DEF
- MPS_INTI_FLAGS
- UINT32 Interrupt; /* Global system interrupt */
-
-} MADT_NMI_SOURCE;
-
-typedef struct madt_local_apic_nmi
-{
- APIC_HEADER_DEF
- UINT8 ProcessorId; /* ACPI processor id */
- MPS_INTI_FLAGS
- UINT8 Lint; /* LINTn to which NMI is connected */
-
-} MADT_LOCAL_APIC_NMI;
-
-typedef struct madt_address_override
-{
- APIC_HEADER_DEF
- UINT16 Reserved; /* Reserved - must be zero */
- UINT64 Address; /* APIC physical address */
-
-} MADT_ADDRESS_OVERRIDE;
-
-typedef struct madt_io_sapic
-{
- APIC_HEADER_DEF
- UINT8 IoSapicId; /* I/O SAPIC ID */
- UINT8 Reserved; /* Reserved - must be zero */
- UINT32 InterruptBase; /* Glocal interrupt for SAPIC start */
- UINT64 Address; /* SAPIC physical address */
-
-} MADT_IO_SAPIC;
-
-typedef struct madt_local_sapic
-{
- APIC_HEADER_DEF
- UINT8 ProcessorId; /* ACPI processor id */
- UINT8 LocalSapicId; /* SAPIC ID */
- UINT8 LocalSapicEid; /* SAPIC EID */
- UINT8 Reserved [3]; /* Reserved - must be zero */
- LOCAL_APIC_FLAGS
-
-} MADT_LOCAL_SAPIC;
-
-typedef struct madt_interrupt_source
-{
- APIC_HEADER_DEF
- MPS_INTI_FLAGS
- UINT8 InterruptType; /* 1=PMI, 2=INIT, 3=corrected */
- UINT8 ProcessorId; /* Processor ID */
- UINT8 ProcessorEid; /* Processor EID */
- UINT8 IoSapicVector; /* Vector value for PMI interrupts */
- UINT32 Interrupt; /* Global system interrupt */
- UINT32 Reserved; /* Reserved - must be zero */
-
-} MADT_INTERRUPT_SOURCE;
+ UINT8 SpaceId; /* Address space where struct or register exists */
+ UINT8 BitWidth; /* Size in bits of given register */
+ UINT8 BitOffset; /* Bit offset within the register */
+ UINT8 AccessWidth; /* Minimum Access size (ACPI 3.0) */
+ UINT64 Address; /* 64-bit address of struct or register */
+
+} ACPI_GENERIC_ADDRESS;
+
+
+/*******************************************************************************
+ *
+ * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_rsdp
+{
+ char Signature[8]; /* ACPI signature, contains "RSD PTR " */
+ UINT8 Checksum; /* ACPI 1.0 checksum */
+ char OemId[ACPI_OEM_ID_SIZE]; /* OEM identification */
+ UINT8 Revision; /* Must be (0) for ACPI 1.0 or (2) for ACPI 2.0+ */
+ UINT32 RsdtPhysicalAddress; /* 32-bit physical address of the RSDT */
+ UINT32 Length; /* Table length in bytes, including header (ACPI 2.0+) */
+ UINT64 XsdtPhysicalAddress; /* 64-bit physical address of the XSDT (ACPI 2.0+) */
+ UINT8 ExtendedChecksum; /* Checksum of entire table (ACPI 2.0+) */
+ UINT8 Reserved[3]; /* Reserved, must be zero */
+
+} ACPI_TABLE_RSDP;
+
+#define ACPI_RSDP_REV0_SIZE 20 /* Size of original ACPI 1.0 RSDP */
+
+
+/*******************************************************************************
+ *
+ * RSDT/XSDT - Root System Description Tables
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_rsdt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
+
+} ACPI_TABLE_RSDT;
+
+typedef struct acpi_table_xsdt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 TableOffsetEntry[1]; /* Array of pointers to ACPI tables */
+
+} ACPI_TABLE_XSDT;
+
+
+/*******************************************************************************
+ *
+ * FACS - Firmware ACPI Control Structure (FACS)
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_facs
+{
+ char Signature[4]; /* ASCII table signature */
+ UINT32 Length; /* Length of structure, in bytes */
+ UINT32 HardwareSignature; /* Hardware configuration signature */
+ UINT32 FirmwareWakingVector; /* 32-bit physical address of the Firmware Waking Vector */
+ UINT32 GlobalLock; /* Global Lock for shared hardware resources */
+ UINT32 Flags;
+ UINT64 XFirmwareWakingVector; /* 64-bit version of the Firmware Waking Vector (ACPI 2.0+) */
+ UINT8 Version; /* Version of this table (ACPI 2.0+) */
+ UINT8 Reserved[31]; /* Reserved, must be zero */
+
+} ACPI_TABLE_FACS;
+
+/* Flag macros */
+
+#define ACPI_FACS_S4_BIOS_PRESENT (1) /* 00: S4BIOS support is present */
+
+/* Global lock flags */
+
+#define ACPI_GLOCK_PENDING 0x01 /* 00: Pending global lock ownership */
+#define ACPI_GLOCK_OWNED 0x02 /* 01: Global lock is owned */
+
+
+/*******************************************************************************
+ *
+ * FADT - Fixed ACPI Description Table (Signature "FACP")
+ *
+ ******************************************************************************/
+
+/* Fields common to all versions of the FADT */
+
+typedef struct acpi_table_fadt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Facs; /* 32-bit physical address of FACS */
+ UINT32 Dsdt; /* 32-bit physical address of DSDT */
+ UINT8 Model; /* System Interrupt Model (ACPI 1.0) - not used in ACPI 2.0+ */
+ UINT8 PreferredProfile; /* Conveys preferred power management profile to OSPM. */
+ UINT16 SciInterrupt; /* System vector of SCI interrupt */
+ UINT32 SmiCommand; /* 32-bit Port address of SMI command port */
+ UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
+ UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
+ UINT8 S4BiosRequest; /* Value to write to SMI CMD to enter S4BIOS state */
+ UINT8 PstateControl; /* Processor performance state control*/
+ UINT32 Pm1aEventBlock; /* 32-bit Port address of Power Mgt 1a Event Reg Blk */
+ UINT32 Pm1bEventBlock; /* 32-bit Port address of Power Mgt 1b Event Reg Blk */
+ UINT32 Pm1aControlBlock; /* 32-bit Port address of Power Mgt 1a Control Reg Blk */
+ UINT32 Pm1bControlBlock; /* 32-bit Port address of Power Mgt 1b Control Reg Blk */
+ UINT32 Pm2ControlBlock; /* 32-bit Port address of Power Mgt 2 Control Reg Blk */
+ UINT32 PmTimerBlock; /* 32-bit Port address of Power Mgt Timer Ctrl Reg Blk */
+ UINT32 Gpe0Block; /* 32-bit Port address of General Purpose Event 0 Reg Blk */
+ UINT32 Gpe1Block; /* 32-bit Port address of General Purpose Event 1 Reg Blk */
+ UINT8 Pm1EventLength; /* Byte Length of ports at Pm1xEventBlock */
+ UINT8 Pm1ControlLength; /* Byte Length of ports at Pm1xControlBlock */
+ UINT8 Pm2ControlLength; /* Byte Length of ports at Pm2ControlBlock */
+ UINT8 PmTimerLength; /* Byte Length of ports at PmTimerBlock */
+ UINT8 Gpe0BlockLength; /* Byte Length of ports at Gpe0Block */
+ UINT8 Gpe1BlockLength; /* Byte Length of ports at Gpe1Block */
+ UINT8 Gpe1Base; /* Offset in GPE number space where GPE1 events start */
+ UINT8 CstControl; /* Support for the _CST object and C States change notification */
+ UINT16 C2Latency; /* Worst case HW latency to enter/exit C2 state */
+ UINT16 C3Latency; /* Worst case HW latency to enter/exit C3 state */
+ UINT16 FlushSize; /* Processor's memory cache line width, in bytes */
+ UINT16 FlushStride; /* Number of flush strides that need to be read */
+ UINT8 DutyOffset; /* Processor duty cycle index in processor's P_CNT reg*/
+ UINT8 DutyWidth; /* Processor duty cycle value bit width in P_CNT register.*/
+ UINT8 DayAlarm; /* Index to day-of-month alarm in RTC CMOS RAM */
+ UINT8 MonthAlarm; /* Index to month-of-year alarm in RTC CMOS RAM */
+ UINT8 Century; /* Index to century in RTC CMOS RAM */
+ UINT16 BootFlags; /* IA-PC Boot Architecture Flags. See Table 5-10 for description */
+ UINT8 Reserved; /* Reserved, must be zero */
+ UINT32 Flags; /* Miscellaneous flag bits (see below for individual flags) */
+ ACPI_GENERIC_ADDRESS ResetRegister; /* 64-bit address of the Reset register */
+ UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system */
+ UINT8 Reserved4[3]; /* Reserved, must be zero */
+ UINT64 XFacs; /* 64-bit physical address of FACS */
+ UINT64 XDsdt; /* 64-bit physical address of DSDT */
+ ACPI_GENERIC_ADDRESS XPm1aEventBlock; /* 64-bit Extended Power Mgt 1a Event Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1bEventBlock; /* 64-bit Extended Power Mgt 1b Event Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1aControlBlock; /* 64-bit Extended Power Mgt 1a Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm1bControlBlock; /* 64-bit Extended Power Mgt 1b Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPm2ControlBlock; /* 64-bit Extended Power Mgt 2 Control Reg Blk address */
+ ACPI_GENERIC_ADDRESS XPmTimerBlock; /* 64-bit Extended Power Mgt Timer Ctrl Reg Blk address */
+ ACPI_GENERIC_ADDRESS XGpe0Block; /* 64-bit Extended General Purpose Event 0 Reg Blk address */
+ ACPI_GENERIC_ADDRESS XGpe1Block; /* 64-bit Extended General Purpose Event 1 Reg Blk address */
+
+} ACPI_TABLE_FADT;
+
+
+/* FADT flags */
+
+#define ACPI_FADT_WBINVD (1) /* 00: The wbinvd instruction works properly */
+#define ACPI_FADT_WBINVD_FLUSH (1<<1) /* 01: The wbinvd flushes but does not invalidate */
+#define ACPI_FADT_C1_SUPPORTED (1<<2) /* 02: All processors support C1 state */
+#define ACPI_FADT_C2_MP_SUPPORTED (1<<3) /* 03: C2 state works on MP system */
+#define ACPI_FADT_POWER_BUTTON (1<<4) /* 04: Power button is handled as a generic feature */
+#define ACPI_FADT_SLEEP_BUTTON (1<<5) /* 05: Sleep button is handled as a generic feature, or not present */
+#define ACPI_FADT_FIXED_RTC (1<<6) /* 06: RTC wakeup stat not in fixed register space */
+#define ACPI_FADT_S4_RTC_WAKE (1<<7) /* 07: RTC wakeup stat not possible from S4 */
+#define ACPI_FADT_32BIT_TIMER (1<<8) /* 08: tmr_val is 32 bits 0=24-bits */
+#define ACPI_FADT_DOCKING_SUPPORTED (1<<9) /* 09: Docking supported */
+#define ACPI_FADT_RESET_REGISTER (1<<10) /* 10: System reset via the FADT RESET_REG supported */
+#define ACPI_FADT_SEALED_CASE (1<<11) /* 11: No internal expansion capabilities and case is sealed */
+#define ACPI_FADT_HEADLESS (1<<12) /* 12: No local video capabilities or local input devices */
+#define ACPI_FADT_SLEEP_TYPE (1<<13) /* 13: Must execute native instruction after writing SLP_TYPx register */
+#define ACPI_FADT_PCI_EXPRESS_WAKE (1<<14) /* 14: System supports PCIEXP_WAKE (STS/EN) bits (ACPI 3.0) */
+#define ACPI_FADT_PLATFORM_CLOCK (1<<15) /* 15: OSPM should use platform-provided timer (ACPI 3.0) */
+#define ACPI_FADT_S4_RTC_VALID (1<<16) /* 16: Contents of RTC_STS valid after S4 wake (ACPI 3.0) */
+#define ACPI_FADT_REMOTE_POWER_ON (1<<17) /* 17: System is compatible with remote power on (ACPI 3.0) */
+#define ACPI_FADT_APIC_CLUSTER (1<<18) /* 18: All local APICs must use cluster model (ACPI 3.0) */
+#define ACPI_FADT_APIC_PHYSICAL (1<<19) /* 19: All local xAPICs must use physical dest mode (ACPI 3.0) */
/*
- * Smart Battery
+ * FADT Prefered Power Management Profiles
*/
-typedef struct smart_battery_table
+enum AcpiPreferedPmProfiles
{
- ACPI_TABLE_HEADER_DEF
- UINT32 WarningLevel;
- UINT32 LowLevel;
- UINT32 CriticalLevel;
-
-} SMART_BATTERY_TABLE;
-
-
-#pragma pack()
+ PM_UNSPECIFIED = 0,
+ PM_DESKTOP = 1,
+ PM_MOBILE = 2,
+ PM_WORKSTATION = 3,
+ PM_ENTERPRISE_SERVER = 4,
+ PM_SOHO_SERVER = 5,
+ PM_APPLIANCE_PC = 6
+};
-/*
- * ACPI Table information. We save the table address, length,
- * and type of memory allocation (mapped or allocated) for each
- * table for 1) when we exit, and 2) if a new table is installed
- */
-#define ACPI_MEM_NOT_ALLOCATED 0
-#define ACPI_MEM_ALLOCATED 1
-#define ACPI_MEM_MAPPED 2
+/* FADT Boot Arch Flags */
-/* Definitions for the Flags bitfield member of ACPI_TABLE_SUPPORT */
+#define BAF_LEGACY_DEVICES 0x0001
+#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
-#define ACPI_TABLE_SINGLE 0x00
-#define ACPI_TABLE_MULTIPLE 0x01
-#define ACPI_TABLE_EXECUTABLE 0x02
+#define FADT2_REVISION_ID 3
+#define FADT2_MINUS_REVISION_ID 2
-#define ACPI_TABLE_ROOT 0x00
-#define ACPI_TABLE_PRIMARY 0x10
-#define ACPI_TABLE_SECONDARY 0x20
-#define ACPI_TABLE_ALL 0x30
-#define ACPI_TABLE_TYPE_MASK 0x30
-/* Data about each known table type */
-
-typedef struct acpi_table_support
-{
- char *Name;
- char *Signature;
- void **GlobalPtr;
- UINT8 SigLength;
- UINT8 Flags;
-
-} ACPI_TABLE_SUPPORT;
-
-
-/*
- * Get the ACPI version-specific tables
- */
-#include <contrib/dev/acpica/actbl1.h> /* Acpi 1.0 table definitions */
-#include <contrib/dev/acpica/actbl2.h> /* Acpi 2.0 table definitions */
+/* Reset to default packing */
+#pragma pack()
-#pragma pack(1)
/*
- * High performance timer
+ * Get the remaining ACPI tables
*/
-typedef struct hpet_table
-{
- ACPI_TABLE_HEADER_DEF
- UINT32 HardwareId;
- ACPI_GENERIC_ADDRESS BaseAddress;
- UINT8 HpetNumber;
- UINT16 ClockTick;
- UINT8 Attributes;
+#include <contrib/dev/acpica/actbl1.h>
-} HPET_TABLE;
+/* Macros used to generate offsets to specific table fields */
-#pragma pack()
+#define ACPI_FADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FADT, f)
#endif /* __ACTBL_H__ */
Index: dbexec.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbexec.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbexec.c -L sys/contrib/dev/acpica/dbexec.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbexec.c
+++ sys/contrib/dev/acpica/dbexec.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbexec - debugger control method execution
- * $Revision: 62 $
+ * $Revision: 1.81 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,6 +127,32 @@
static ACPI_DB_METHOD_INFO AcpiGbl_DbMethodInfo;
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDbExecuteMethod (
+ ACPI_DB_METHOD_INFO *Info,
+ ACPI_BUFFER *ReturnObj);
+
+static void
+AcpiDbExecuteSetup (
+ ACPI_DB_METHOD_INFO *Info);
+
+static UINT32
+AcpiDbGetOutstandingAllocations (
+ void);
+
+static void ACPI_SYSTEM_XFACE
+AcpiDbMethodThread (
+ void *Context);
+
+static ACPI_STATUS
+AcpiDbExecutionWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
@@ -141,7 +167,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbExecuteMethod (
ACPI_DB_METHOD_INFO *Info,
ACPI_BUFFER *ReturnObj)
@@ -163,37 +189,38 @@
{
for (i = 0; Info->Args[i] && i < ACPI_METHOD_NUM_ARGS; i++)
{
- Params[i].Type = ACPI_TYPE_INTEGER;
- Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16);
+ Params[i].Type = ACPI_TYPE_INTEGER;
+ Params[i].Integer.Value = ACPI_STRTOUL (Info->Args[i], NULL, 16);
}
- ParamObjects.Pointer = Params;
- ParamObjects.Count = i;
+ ParamObjects.Pointer = Params;
+ ParamObjects.Count = i;
}
else
{
/* Setup default parameters */
- Params[0].Type = ACPI_TYPE_INTEGER;
- Params[0].Integer.Value = 0x01020304;
+ Params[0].Type = ACPI_TYPE_INTEGER;
+ Params[0].Integer.Value = 0x01020304;
- Params[1].Type = ACPI_TYPE_STRING;
- Params[1].String.Length = 12;
- Params[1].String.Pointer = "AML Debugger";
+ Params[1].Type = ACPI_TYPE_STRING;
+ Params[1].String.Length = 12;
+ Params[1].String.Pointer = "AML Debugger";
- ParamObjects.Pointer = Params;
- ParamObjects.Count = 2;
+ ParamObjects.Pointer = Params;
+ ParamObjects.Count = 2;
}
/* Prepare for a return object of arbitrary size */
- ReturnObj->Pointer = AcpiGbl_DbBuffer;
- ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj->Pointer = AcpiGbl_DbBuffer;
+ ReturnObj->Length = ACPI_DEBUG_BUFFER_SIZE;
/* Do the actual method execution */
AcpiGbl_MethodExecuting = TRUE;
- Status = AcpiEvaluateObject (NULL, Info->Pathname, &ParamObjects, ReturnObj);
+ Status = AcpiEvaluateObject (NULL,
+ Info->Pathname, &ParamObjects, ReturnObj);
AcpiGbl_CmSingleStep = FALSE;
AcpiGbl_MethodExecuting = FALSE;
@@ -208,13 +235,13 @@
*
* PARAMETERS: Info - Valid method info
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Setup info segment prior to method execution
*
******************************************************************************/
-void
+static void
AcpiDbExecuteSetup (
ACPI_DB_METHOD_INFO *Info)
{
@@ -249,6 +276,16 @@
}
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+UINT32
+AcpiDbGetCacheInfo (
+ ACPI_MEMORY_LIST *Cache)
+{
+
+ return (Cache->TotalAllocated - Cache->TotalFreed - Cache->CurrentDepth);
+}
+#endif
+
/*******************************************************************************
*
* FUNCTION: AcpiDbGetOutstandingAllocations
@@ -263,22 +300,18 @@
*
******************************************************************************/
-UINT32
+static UINT32
AcpiDbGetOutstandingAllocations (
void)
{
UINT32 Outstanding = 0;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- UINT32 i;
-
- for (i = ACPI_MEM_LIST_FIRST_CACHE_LIST; i < ACPI_NUM_MEM_LISTS; i++)
- {
- Outstanding += (AcpiGbl_MemoryLists[i].TotalAllocated -
- AcpiGbl_MemoryLists[i].TotalFreed -
- AcpiGbl_MemoryLists[i].CacheDepth);
- }
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_StateCache);
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeCache);
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_PsNodeExtCache);
+ Outstanding += AcpiDbGetCacheInfo (AcpiGbl_OperandCache);
#endif
return (Outstanding);
@@ -298,7 +331,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbExecutionWalk (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -345,7 +378,7 @@
* Args - Parameters to the method
* Flags - single step/no single step
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Execute a control method. Name is relative to the current
* scope.
@@ -360,6 +393,7 @@
{
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
+ char *NameString;
#ifdef ACPI_DEBUG_OUTPUT
@@ -374,13 +408,23 @@
if (*Name == '*')
{
- (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbExecutionWalk, NULL, NULL);
+ (void) AcpiWalkNamespace (ACPI_TYPE_METHOD, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, AcpiDbExecutionWalk, NULL, NULL);
return;
}
else
{
- AcpiGbl_DbMethodInfo.Name = Name;
+ NameString = ACPI_ALLOCATE (ACPI_STRLEN (Name) + 1);
+ if (!NameString)
+ {
+ return;
+ }
+
+ ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+
+ ACPI_STRCPY (NameString, Name);
+ AcpiUtStrupr (NameString);
+ AcpiGbl_DbMethodInfo.Name = NameString;
AcpiGbl_DbMethodInfo.Args = Args;
AcpiGbl_DbMethodInfo.Flags = Flags;
@@ -389,13 +433,14 @@
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
Status = AcpiDbExecuteMethod (&AcpiGbl_DbMethodInfo, &ReturnObj);
+ ACPI_FREE (NameString);
}
/*
* Allow any handlers in separate threads to complete.
* (Such as Notify handlers invoked from AML executed above).
*/
- AcpiOsSleep (10);
+ AcpiOsSleep ((ACPI_INTEGER) 10);
#ifdef ACPI_DEBUG_OUTPUT
@@ -418,7 +463,6 @@
AcpiOsPrintf ("Execution of %s failed with status %s\n",
AcpiGbl_DbMethodInfo.Pathname, AcpiFormatException (Status));
}
-
else
{
/* Display a return object, if any */
@@ -428,7 +472,7 @@
AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer,
(UINT32) ReturnObj.Length);
- AcpiDbDumpObject (ReturnObj.Pointer, 1);
+ AcpiDbDumpExternalObject (ReturnObj.Pointer, 1);
}
else
{
@@ -454,25 +498,30 @@
*
******************************************************************************/
-void ACPI_SYSTEM_XFACE
+static void ACPI_SYSTEM_XFACE
AcpiDbMethodThread (
void *Context)
{
ACPI_STATUS Status;
ACPI_DB_METHOD_INFO *Info = Context;
UINT32 i;
+ UINT8 Allow;
ACPI_BUFFER ReturnObj;
- for (i = 0; i < Info->NumLoops; i++)
+ if (Info->InitArgs)
{
-#if 0
- if (i == 0xEFDC)
- {
- AcpiDbgLevel = 0x00FFFFFF;
- }
-#endif
+ AcpiDbUInt32ToHexString (Info->NumCreated, Info->IndexOfThreadStr);
+ AcpiDbUInt32ToHexString (AcpiOsGetThreadId (), Info->IdOfThreadStr);
+ }
+ if (Info->Threads && (Info->NumCreated < Info->NumThreads))
+ {
+ Info->Threads[Info->NumCreated++] = AcpiOsGetThreadId();
+ }
+
+ for (i = 0; i < Info->NumLoops; i++)
+ {
Status = AcpiDbExecuteMethod (Info, &ReturnObj);
if (ACPI_FAILURE (Status))
{
@@ -484,27 +533,43 @@
}
}
+#if 0
if ((i % 100) == 0)
{
- AcpiOsPrintf ("%d executions\n", i);
+ AcpiOsPrintf ("%d executions, Thread 0x%x\n", i, AcpiOsGetThreadId ());
}
-#if 0
if (ReturnObj.Length)
{
AcpiOsPrintf ("Execution of %s returned object %p Buflen %X\n",
Info->Pathname, ReturnObj.Pointer, (UINT32) ReturnObj.Length);
- AcpiDbDumpObject (ReturnObj.Pointer, 1);
+ AcpiDbDumpExternalObject (ReturnObj.Pointer, 1);
}
#endif
}
/* Signal our completion */
- Status = AcpiOsSignalSemaphore (Info->ThreadGate, 1);
- if (ACPI_FAILURE (Status))
+ Allow = 0;
+ AcpiOsWaitSemaphore (Info->ThreadCompleteGate, 1, ACPI_WAIT_FOREVER);
+ Info->NumCompleted++;
+
+ if (Info->NumCompleted == Info->NumThreads)
+ {
+ /* Do signal for main thread once only */
+ Allow = 1;
+ }
+
+ AcpiOsSignalSemaphore (Info->ThreadCompleteGate, 1);
+
+ if (Allow)
{
- AcpiOsPrintf ("Could not signal debugger semaphore\n");
+ Status = AcpiOsSignalSemaphore (Info->MainThreadGate, 1);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not signal debugger thread sync semaphore, %s\n",
+ AcpiFormatException (Status));
+ }
}
}
@@ -533,8 +598,9 @@
UINT32 NumThreads;
UINT32 NumLoops;
UINT32 i;
- ACPI_HANDLE ThreadGate;
-
+ UINT32 Size;
+ ACPI_MUTEX MainThreadGate;
+ ACPI_MUTEX ThreadCompleteGate;
/* Get the arguments */
@@ -543,36 +609,81 @@
if (!NumThreads || !NumLoops)
{
- AcpiOsPrintf ("Bad argument: Threads %X, Loops %X\n", NumThreads, NumLoops);
+ AcpiOsPrintf ("Bad argument: Threads %X, Loops %X\n",
+ NumThreads, NumLoops);
return;
}
- /* Create the synchronization semaphore */
+ /*
+ * Create the semaphore for synchronization of
+ * the created threads with the main thread.
+ */
+ Status = AcpiOsCreateSemaphore (1, 0, &MainThreadGate);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not create semaphore for synchronization with the main thread, %s\n",
+ AcpiFormatException (Status));
+ return;
+ }
- Status = AcpiOsCreateSemaphore (1, 0, &ThreadGate);
+ /*
+ * Create the semaphore for synchronization
+ * between the created threads.
+ */
+ Status = AcpiOsCreateSemaphore (1, 1, &ThreadCompleteGate);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not create semaphore, %s\n", AcpiFormatException (Status));
+ AcpiOsPrintf ("Could not create semaphore for synchronization between the created threads, %s\n",
+ AcpiFormatException (Status));
+ (void) AcpiOsDeleteSemaphore (MainThreadGate);
return;
}
+ ACPI_MEMSET (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
+
+ /* Array to store IDs of threads */
+
+ AcpiGbl_DbMethodInfo.NumThreads = NumThreads;
+ Size = 4 * AcpiGbl_DbMethodInfo.NumThreads;
+ AcpiGbl_DbMethodInfo.Threads = (UINT32 *) AcpiOsAllocate (Size);
+ if (AcpiGbl_DbMethodInfo.Threads == NULL)
+ {
+ AcpiOsPrintf ("No memory for thread IDs array\n");
+ (void) AcpiOsDeleteSemaphore (MainThreadGate);
+ (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
+ return;
+ }
+ ACPI_MEMSET (AcpiGbl_DbMethodInfo.Threads, 0, Size);
+
/* Setup the context to be passed to each thread */
AcpiGbl_DbMethodInfo.Name = MethodNameArg;
- AcpiGbl_DbMethodInfo.Args = NULL;
AcpiGbl_DbMethodInfo.Flags = 0;
AcpiGbl_DbMethodInfo.NumLoops = NumLoops;
- AcpiGbl_DbMethodInfo.ThreadGate = ThreadGate;
+ AcpiGbl_DbMethodInfo.MainThreadGate = MainThreadGate;
+ AcpiGbl_DbMethodInfo.ThreadCompleteGate = ThreadCompleteGate;
+
+ /* Init arguments to be passed to method */
+
+ AcpiGbl_DbMethodInfo.InitArgs = 1;
+ AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments;
+ AcpiGbl_DbMethodInfo.Arguments[0] = AcpiGbl_DbMethodInfo.NumThreadsStr;
+ AcpiGbl_DbMethodInfo.Arguments[1] = AcpiGbl_DbMethodInfo.IdOfThreadStr;
+ AcpiGbl_DbMethodInfo.Arguments[2] = AcpiGbl_DbMethodInfo.IndexOfThreadStr;
+ AcpiGbl_DbMethodInfo.Arguments[3] = NULL;
+ AcpiDbUInt32ToHexString (NumThreads, AcpiGbl_DbMethodInfo.NumThreadsStr);
AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
/* Create the threads */
- AcpiOsPrintf ("Creating %X threads to execute %X times each\n", NumThreads, NumLoops);
+ AcpiOsPrintf ("Creating %X threads to execute %X times each\n",
+ NumThreads, NumLoops);
for (i = 0; i < (NumThreads); i++)
{
- Status = AcpiOsQueueForExecution (OSD_PRIORITY_MED, AcpiDbMethodThread, &AcpiGbl_DbMethodInfo);
+ Status = AcpiOsExecute (OSL_DEBUGGER_THREAD, AcpiDbMethodThread,
+ &AcpiGbl_DbMethodInfo);
if (ACPI_FAILURE (Status))
{
break;
@@ -581,22 +692,20 @@
/* Wait for all threads to complete */
- i = NumThreads;
- while (i) /* Brain damage for OSD implementations that only support wait of 1 unit */
- {
- Status = AcpiOsWaitSemaphore (ThreadGate, 1, ACPI_WAIT_FOREVER);
- i--;
- }
-
- /* Cleanup and exit */
-
- (void) AcpiOsDeleteSemaphore (ThreadGate);
+ AcpiOsWaitSemaphore (MainThreadGate, 1, ACPI_WAIT_FOREVER);
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
AcpiOsPrintf ("All threads (%X) have completed\n", NumThreads);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
-}
+ /* Cleanup and exit */
+
+ (void) AcpiOsDeleteSemaphore (MainThreadGate);
+ (void) AcpiOsDeleteSemaphore (ThreadCompleteGate);
+
+ AcpiOsFree (AcpiGbl_DbMethodInfo.Threads);
+ AcpiGbl_DbMethodInfo.Threads = NULL;
+}
#endif /* ACPI_DEBUGGER */
Index: acconfig.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acconfig.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acconfig.h -L sys/contrib/dev/acpica/acconfig.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acconfig.h
+++ sys/contrib/dev/acpica/acconfig.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acconfig.h - Global configuration constants
- * $Revision: 169 $
+ * $Revision: 1.234 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -135,9 +135,9 @@
*
*/
-/* Version string */
+/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20041119
+#define ACPI_CA_VERSION 0x20070320
/*
* OS name, used for the _OS object. The _OS object is essentially obsolete,
@@ -151,14 +151,14 @@
/* Maximum objects in the various object caches */
-#define ACPI_MAX_STATE_CACHE_DEPTH 64 /* State objects */
+#define ACPI_MAX_STATE_CACHE_DEPTH 96 /* State objects */
#define ACPI_MAX_PARSE_CACHE_DEPTH 96 /* Parse tree objects */
-#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 64 /* Parse tree objects */
-#define ACPI_MAX_OBJECT_CACHE_DEPTH 64 /* Interpreter operand objects */
-#define ACPI_MAX_WALK_CACHE_DEPTH 4 /* Objects for parse tree walks */
+#define ACPI_MAX_EXTPARSE_CACHE_DEPTH 96 /* Parse tree objects */
+#define ACPI_MAX_OBJECT_CACHE_DEPTH 96 /* Interpreter operand objects */
+#define ACPI_MAX_NAMESPACE_CACHE_DEPTH 96 /* Namespace objects */
/*
- * Should the subystem abort the loading of an ACPI table if the
+ * Should the subsystem abort the loading of an ACPI table if the
* table checksum is incorrect?
*/
#define ACPI_CHECKSUM_ABORT FALSE
@@ -172,25 +172,28 @@
/* Version of ACPI supported */
-#define ACPI_CA_SUPPORT_LEVEL 2
-
-/* String size constants */
-
-#define ACPI_MAX_STRING_LENGTH 512
-#define ACPI_PATHNAME_MAX 256 /* A full namespace pathname */
+#define ACPI_CA_SUPPORT_LEVEL 3
/* Maximum count for a semaphore object */
#define ACPI_MAX_SEMAPHORE_COUNT 256
-/* Max reference count (for debug only) */
+/* Maximum object reference count (detects object deletion issues) */
-#define ACPI_MAX_REFERENCE_COUNT 0x400
+#define ACPI_MAX_REFERENCE_COUNT 0x800
/* Size of cached memory mapping for system memory operation region */
#define ACPI_SYSMEM_REGION_WINDOW_SIZE 4096
+/* OwnerId tracking. 8 entries allows for 255 OwnerIds */
+
+#define ACPI_NUM_OWNERID_MASKS 8
+
+/* Size of the root table array is increased by this increment */
+
+#define ACPI_ROOT_TABLE_SIZE_INCREMENT 4
+
/******************************************************************************
*
@@ -203,23 +206,19 @@
#define ACPI_MAX_GPE_BLOCKS 2
#define ACPI_GPE_REGISTER_WIDTH 8
-/*
- * Method info (in WALK_STATE), containing local variables and argumetns
- */
+/* Method info (in WALK_STATE), containing local variables and argumetns */
+
#define ACPI_METHOD_NUM_LOCALS 8
#define ACPI_METHOD_MAX_LOCAL 7
#define ACPI_METHOD_NUM_ARGS 7
#define ACPI_METHOD_MAX_ARG 6
-/* Maximum length of resulting string when converting from a buffer */
-
-#define ACPI_MAX_STRING_CONVERSION 200
-
-/* Length of _HID, _UID, and _CID values */
+/* Length of _HID, _UID, _CID, and UUID values */
#define ACPI_DEVICE_ID_LENGTH 0x09
#define ACPI_MAX_CID_LENGTH 48
+#define ACPI_UUID_LENGTH 16
/*
* Operand Stack (in WALK_STATE), Must be large enough to contain METHOD_MAX_ARG
@@ -227,12 +226,28 @@
#define ACPI_OBJ_NUM_OPERANDS 8
#define ACPI_OBJ_MAX_OPERAND 7
+/* Number of elements in the Result Stack frame, can be an arbitrary value */
+
+#define ACPI_RESULTS_FRAME_OBJ_NUM 8
+
+/*
+ * Maximal number of elements the Result Stack can contain,
+ * it may be an arbitray value not exceeding the types of
+ * ResultSize and ResultCount (now UINT8).
+ */
+#define ACPI_RESULTS_OBJ_NUM_MAX 255
+
/* Names within the namespace are 4 bytes long */
#define ACPI_NAME_SIZE 4
#define ACPI_PATH_SEGMENT_LENGTH 5 /* 4 chars for name + 1 char for separator */
#define ACPI_PATH_SEPARATOR '.'
+/* Sizes for ACPI table headers */
+
+#define ACPI_OEM_ID_SIZE 6
+#define ACPI_OEM_TABLE_ID_SIZE 8
+
/* Constants used in searching for the RSDP in low memory */
#define ACPI_EBDA_PTR_LOCATION 0x0000040E /* Physical Address */
@@ -253,12 +268,7 @@
/* Array sizes. Used for range checking also */
-#define ACPI_NUM_ACCESS_TYPES 6
-#define ACPI_NUM_UPDATE_RULES 3
-#define ACPI_NUM_LOCK_RULES 2
-#define ACPI_NUM_MATCH_OPS 6
-#define ACPI_NUM_OPCODES 256
-#define ACPI_NUM_FIELD_NAMES 2
+#define ACPI_MAX_MATCH_OPCODE 5
/* RSDP checksums */
@@ -269,10 +279,6 @@
#define ACPI_SMBUS_BUFFER_SIZE 34
-/* Number of strings associated with the _OSI reserved method */
-
-#define ACPI_NUM_OSI_STRINGS 9
-
/******************************************************************************
*
Index: acparser.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acparser.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acparser.h -L sys/contrib/dev/acpica/acparser.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acparser.h
+++ sys/contrib/dev/acpica/acparser.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: acparser.h - AML Parser subcomponent prototypes and defines
- * $Revision: 67 $
+ * $Revision: 1.83 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,7 +121,7 @@
#define OP_HAS_RETURN_VALUE 1
-/* variable # arguments */
+/* Variable number of arguments. This field must be 32 bits */
#define ACPI_VAR_ARGS ACPI_UINT32_MAX
@@ -136,17 +136,7 @@
#define ACPI_PARSE_MODE_MASK 0x0030
#define ACPI_PARSE_DEFERRED_OP 0x0100
-
-/* Parser external interfaces */
-
-ACPI_STATUS
-AcpiPsxLoadTable (
- UINT8 *PcodeAddr,
- UINT32 PcodeLength);
-
-ACPI_STATUS
-AcpiPsxExecute (
- ACPI_PARAMETER_INFO *Info);
+#define ACPI_PARSE_DISASSEMBLE 0x0200
/******************************************************************************
@@ -156,16 +146,21 @@
*****************************************************************************/
-/* psargs - Parse AML opcode arguments */
+/*
+ * psxface - Parser external interfaces
+ */
+ACPI_STATUS
+AcpiPsExecuteMethod (
+ ACPI_EVALUATE_INFO *Info);
+
+/*
+ * psargs - Parse AML opcode arguments
+ */
UINT8 *
AcpiPsGetNextPackageEnd (
ACPI_PARSE_STATE *ParserState);
-UINT32
-AcpiPsGetNextPackageLength (
- ACPI_PARSE_STATE *ParserState);
-
char *
AcpiPsGetNextNamestring (
ACPI_PARSE_STATE *ParserState);
@@ -183,10 +178,6 @@
ACPI_PARSE_OBJECT *Arg,
BOOLEAN MethodCall);
-ACPI_PARSE_OBJECT *
-AcpiPsGetNextField (
- ACPI_PARSE_STATE *ParserState);
-
ACPI_STATUS
AcpiPsGetNextArg (
ACPI_WALK_STATE *WalkState,
@@ -195,8 +186,9 @@
ACPI_PARSE_OBJECT **ReturnArg);
-/* psfind */
-
+/*
+ * psfind
+ */
ACPI_PARSE_OBJECT *
AcpiPsFindName (
ACPI_PARSE_OBJECT *Scope,
@@ -208,8 +200,9 @@
ACPI_PARSE_OBJECT *Op);
-/* psopcode - AML Opcode information */
-
+/*
+ * psopcode - AML Opcode information
+ */
const ACPI_OPCODE_INFO *
AcpiPsGetOpcodeInfo (
UINT16 Opcode);
@@ -218,14 +211,27 @@
AcpiPsGetOpcodeName (
UINT16 Opcode);
+UINT8
+AcpiPsGetArgumentCount (
+ UINT32 OpType);
-/* psparse - top level parsing routines */
+
+/*
+ * psparse - top level parsing routines
+ */
+ACPI_STATUS
+AcpiPsParseAml (
+ ACPI_WALK_STATE *WalkState);
UINT32
AcpiPsGetOpcodeSize (
UINT32 Opcode);
-void
+UINT16
+AcpiPsPeekOpcode (
+ ACPI_PARSE_STATE *state);
+
+ACPI_STATUS
AcpiPsCompleteThisOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op);
@@ -236,39 +242,18 @@
ACPI_PARSE_OBJECT *Op,
ACPI_STATUS CallbackStatus);
-ACPI_STATUS
-AcpiPsFindObject (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT **OutOp);
-
-void
-AcpiPsDeleteParseTree (
- ACPI_PARSE_OBJECT *root);
+/*
+ * psloop - main parse loop
+ */
ACPI_STATUS
AcpiPsParseLoop (
ACPI_WALK_STATE *WalkState);
-ACPI_STATUS
-AcpiPsParseAml (
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiPsParseTable (
- UINT8 *aml,
- UINT32 amlSize,
- ACPI_PARSE_DOWNWARDS DescendingCallback,
- ACPI_PARSE_UPWARDS AscendingCallback,
- ACPI_PARSE_OBJECT **RootObject);
-
-UINT16
-AcpiPsPeekOpcode (
- ACPI_PARSE_STATE *state);
-
-
-/* psscope - Scope stack management routines */
-
+/*
+ * psscope - Scope stack management routines
+ */
ACPI_STATUS
AcpiPsInitScope (
ACPI_PARSE_STATE *ParserState,
@@ -301,8 +286,9 @@
ACPI_PARSE_STATE *state);
-/* pstree - parse tree manipulation routines */
-
+/*
+ * pstree - parse tree manipulation routines
+ */
void
AcpiPsAppendArg(
ACPI_PARSE_OBJECT *op,
@@ -321,17 +307,14 @@
UINT32 argn);
ACPI_PARSE_OBJECT *
-AcpiPsGetChild (
- ACPI_PARSE_OBJECT *op);
-
-ACPI_PARSE_OBJECT *
AcpiPsGetDepthNext (
ACPI_PARSE_OBJECT *Origin,
ACPI_PARSE_OBJECT *Op);
-/* pswalk - parse tree walk routines */
-
+/*
+ * pswalk - parse tree walk routines
+ */
ACPI_STATUS
AcpiPsWalkParsedAml (
ACPI_PARSE_OBJECT *StartOp,
@@ -354,9 +337,14 @@
AcpiPsDeleteCompletedOp (
ACPI_WALK_STATE *WalkState);
+void
+AcpiPsDeleteParseTree (
+ ACPI_PARSE_OBJECT *root);
-/* psutils - parser utilities */
+/*
+ * psutils - parser utilities
+ */
ACPI_PARSE_OBJECT *
AcpiPsCreateScopeOp (
void);
@@ -374,10 +362,6 @@
AcpiPsFreeOp (
ACPI_PARSE_OBJECT *Op);
-void
-AcpiPsDeleteParseCache (
- void);
-
BOOLEAN
AcpiPsIsLeadingChar (
UINT32 c);
@@ -396,8 +380,9 @@
UINT32 name);
-/* psdump - display parser tree */
-
+/*
+ * psdump - display parser tree
+ */
UINT32
AcpiPsSprintPath (
char *BufferStart,
Index: exprep.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exprep.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exprep.c -L sys/contrib/dev/acpica/exprep.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exprep.c
+++ sys/contrib/dev/acpica/exprep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exprep - ACPI AML (p-code) execution - field prep utilities
- * $Revision: 128 $
+ * $Revision: 1.142 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,8 +126,23 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exprep")
+/* Local prototypes */
+
+static UINT32
+AcpiExDecodeFieldAccess (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT8 FieldFlags,
+ UINT32 *ReturnByteAlignment);
+
#ifdef ACPI_UNDER_DEVELOPMENT
+
+static UINT32
+AcpiExGenerateAccess (
+ UINT32 FieldBitOffset,
+ UINT32 FieldBitLength,
+ UINT32 RegionLength);
+
/*******************************************************************************
*
* FUNCTION: AcpiExGenerateAccess
@@ -167,18 +182,20 @@
UINT32 Accesses;
- ACPI_FUNCTION_TRACE ("ExGenerateAccess");
+ ACPI_FUNCTION_TRACE (ExGenerateAccess);
/* Round Field start offset and length to "minimal" byte boundaries */
FieldByteOffset = ACPI_DIV_8 (ACPI_ROUND_DOWN (FieldBitOffset, 8));
- FieldByteEndOffset = ACPI_DIV_8 (ACPI_ROUND_UP (FieldBitLength + FieldBitOffset, 8));
+ FieldByteEndOffset = ACPI_DIV_8 (ACPI_ROUND_UP (FieldBitLength +
+ FieldBitOffset, 8));
FieldByteLength = FieldByteEndOffset - FieldByteOffset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Bit length %d, Bit offset %d\n",
FieldBitLength, FieldBitOffset));
+
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Byte Length %d, Byte Offset %d, End Offset %d\n",
FieldByteLength, FieldByteOffset, FieldByteEndOffset));
@@ -192,21 +209,27 @@
for (AccessByteWidth = 1; AccessByteWidth <= 8; AccessByteWidth <<= 1)
{
/*
- * 1) Round end offset up to next access boundary and make sure that this
- * does not go beyond the end of the parent region.
- * 2) When the Access width is greater than the FieldByteLength, we are done.
- * (This does not optimize for the perfectly aligned case yet).
+ * 1) Round end offset up to next access boundary and make sure that
+ * this does not go beyond the end of the parent region.
+ * 2) When the Access width is greater than the FieldByteLength, we
+ * are done. (This does not optimize for the perfectly aligned
+ * case yet).
*/
if (ACPI_ROUND_UP (FieldByteEndOffset, AccessByteWidth) <= RegionLength)
{
- FieldStartOffset = ACPI_ROUND_DOWN (FieldByteOffset, AccessByteWidth) /
- AccessByteWidth;
- FieldEndOffset = ACPI_ROUND_UP ((FieldByteLength + FieldByteOffset),
- AccessByteWidth) / AccessByteWidth;
- Accesses = FieldEndOffset - FieldStartOffset;
+ FieldStartOffset =
+ ACPI_ROUND_DOWN (FieldByteOffset, AccessByteWidth) /
+ AccessByteWidth;
+
+ FieldEndOffset =
+ ACPI_ROUND_UP ((FieldByteLength + FieldByteOffset),
+ AccessByteWidth) / AccessByteWidth;
+
+ Accesses = FieldEndOffset - FieldStartOffset;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"AccessWidth %d end is within region\n", AccessByteWidth));
+
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field Start %d, Field End %d -- requires %d accesses\n",
FieldStartOffset, FieldEndOffset, Accesses));
@@ -216,8 +239,8 @@
if (Accesses <= 1)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "Entire field can be accessed with one operation of size %d\n",
- AccessByteWidth));
+ "Entire field can be accessed with one operation of size %d\n",
+ AccessByteWidth));
return_VALUE (AccessByteWidth);
}
@@ -234,16 +257,21 @@
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "AccessWidth %d end is NOT within region\n", AccessByteWidth));
+ "AccessWidth %d end is NOT within region\n", AccessByteWidth));
if (AccessByteWidth == 1)
{
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Field goes beyond end-of-region!\n"));
- return_VALUE (0); /* Field does not fit in the region at all */
- }
- /* This width goes beyond the end-of-region, back off to previous access */
+ /* Field does not fit in the region at all */
+
+ return_VALUE (0);
+ }
+ /*
+ * This width goes beyond the end-of-region, back off to
+ * previous access
+ */
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Backing off to previous optimal access width of %d\n",
MinimumAccessWidth));
@@ -251,8 +279,10 @@
}
}
- /* Could not read/write field with one operation, just use max access width */
-
+ /*
+ * Could not read/write field with one operation,
+ * just use max access width
+ */
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"Cannot access field in one operation, using width 8\n"));
return_VALUE (8);
@@ -264,8 +294,9 @@
*
* FUNCTION: AcpiExDecodeFieldAccess
*
- * PARAMETERS: Access - Encoded field access bits
- * Length - Field length.
+ * PARAMETERS: ObjDesc - Field object
+ * FieldFlags - Encoded fieldflags (contains access bits)
+ * ReturnByteAlignment - Where the byte alignment is returned
*
* RETURN: Field granularity (8, 16, 32 or 64) and
* ByteAlignment (1, 2, 3, or 4)
@@ -285,7 +316,7 @@
UINT32 BitLength;
- ACPI_FUNCTION_TRACE ("ExDecodeFieldAccess");
+ ACPI_FUNCTION_TRACE (ExDecodeFieldAccess);
Access = (FieldFlags & AML_FIELD_ACCESS_TYPE_MASK);
@@ -295,9 +326,10 @@
case AML_FIELD_ACCESS_ANY:
#ifdef ACPI_UNDER_DEVELOPMENT
- ByteAlignment = AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset,
- ObjDesc->CommonField.BitLength,
- 0xFFFFFFFF /* Temp until we pass RegionLength as param */);
+ ByteAlignment =
+ AcpiExGenerateAccess (ObjDesc->CommonField.StartFieldBitOffset,
+ ObjDesc->CommonField.BitLength,
+ 0xFFFFFFFF /* Temp until we pass RegionLength as parameter */);
BitLength = ByteAlignment * 8;
#endif
@@ -329,10 +361,10 @@
default:
/* Invalid field access type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown field access type %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown field access type %X",
Access));
- return_VALUE (0);
+ return_UINT32 (0);
}
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_BUFFER_FIELD)
@@ -346,7 +378,7 @@
}
*ReturnByteAlignment = ByteAlignment;
- return_VALUE (BitLength);
+ return_UINT32 (BitLength);
}
@@ -358,6 +390,7 @@
* FieldFlags - Access, LockRule, and UpdateRule.
* The format of a FieldFlag is described
* in the ACPI specification
+ * FieldAttribute - Special attributes (not used)
* FieldBitPosition - Field start position
* FieldBitLength - Field length in number of bits
*
@@ -383,7 +416,7 @@
UINT32 NearestByteAddress;
- ACPI_FUNCTION_TRACE ("ExPrepCommonFieldObject");
+ ACPI_FUNCTION_TRACE (ExPrepCommonFieldObject);
/*
@@ -420,7 +453,9 @@
/* Setup width (access granularity) fields */
ObjDesc->CommonField.AccessByteWidth = (UINT8)
- ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
+ ACPI_DIV_8 (AccessBitWidth); /* 1, 2, 4, 8 */
+
+ ObjDesc->CommonField.AccessBitWidth = (UINT8) AccessBitWidth;
/*
* BaseByteOffset is the address of the start of the field within the
@@ -445,28 +480,6 @@
(FieldBitPosition - ACPI_MUL_8 (ObjDesc->CommonField.BaseByteOffset));
/*
- * Valid bits -- the number of bits that compose a partial datum,
- * 1) At the end of the field within the region (arbitrary starting bit
- * offset)
- * 2) At the end of a buffer used to contain the field (starting offset
- * always zero)
- */
- ObjDesc->CommonField.EndFieldValidBits = (UINT8)
- ((ObjDesc->CommonField.StartFieldBitOffset + FieldBitLength) %
- AccessBitWidth);
- /* StartBufferBitOffset always = 0 */
-
- ObjDesc->CommonField.EndBufferValidBits = (UINT8)
- (FieldBitLength % AccessBitWidth);
-
- /*
- * DatumValidBits is the number of valid field bits in the first
- * field datum.
- */
- ObjDesc->CommonField.DatumValidBits = (UINT8)
- (AccessBitWidth - ObjDesc->CommonField.StartFieldBitOffset);
-
- /*
* Does the entire field fit within a single field access element? (datum)
* (i.e., without crossing a datum boundary)
*/
@@ -484,11 +497,7 @@
*
* FUNCTION: AcpiExPrepFieldValue
*
- * PARAMETERS: Node - Owning Node
- * RegionNode - Region in which field is being defined
- * FieldFlags - Access, LockRule, and UpdateRule.
- * FieldBitPosition - Field start position
- * FieldBitLength - Field length in number of bits
+ * PARAMETERS: Info - Contains all field creation info
*
* RETURN: Status
*
@@ -506,7 +515,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExPrepFieldValue");
+ ACPI_FUNCTION_TRACE (ExPrepFieldValue);
/* Parameter validation */
@@ -515,15 +524,15 @@
{
if (!Info->RegionNode)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null RegionNode\n"));
+ ACPI_ERROR ((AE_INFO, "Null RegionNode"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
Type = AcpiNsGetType (Info->RegionNode);
if (Type != ACPI_TYPE_REGION)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed Region, found type %X (%s)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed Region, found type %X (%s)",
Type, AcpiUtGetTypeName (Type)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -555,7 +564,7 @@
{
case ACPI_TYPE_LOCAL_REGION_FIELD:
- ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
+ ObjDesc->Field.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
/* An additional reference for the container */
@@ -571,8 +580,10 @@
case ACPI_TYPE_LOCAL_BANK_FIELD:
ObjDesc->BankField.Value = Info->BankValue;
- ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (Info->RegionNode);
- ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject (Info->RegisterNode);
+ ObjDesc->BankField.RegionObj = AcpiNsGetAttachedObject (
+ Info->RegionNode);
+ ObjDesc->BankField.BankObj = AcpiNsGetAttachedObject (
+ Info->RegisterNode);
/* An additional reference for the attached objects */
@@ -591,14 +602,16 @@
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (Info->RegisterNode);
- ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (Info->DataRegisterNode);
- ObjDesc->IndexField.Value = (UINT32)
- (Info->FieldBitPosition / ACPI_MUL_8 (ObjDesc->Field.AccessByteWidth));
+ /* Get the Index and Data registers */
+
+ ObjDesc->IndexField.IndexObj = AcpiNsGetAttachedObject (
+ Info->RegisterNode);
+ ObjDesc->IndexField.DataObj = AcpiNsGetAttachedObject (
+ Info->DataRegisterNode);
if (!ObjDesc->IndexField.DataObj || !ObjDesc->IndexField.IndexObj)
{
- ACPI_REPORT_ERROR (("Null Index Object during field prep\n"));
+ ACPI_ERROR ((AE_INFO, "Null Index Object during field prep"));
AcpiUtDeleteObjectDesc (ObjDesc);
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -608,6 +621,27 @@
AcpiUtAddReference (ObjDesc->IndexField.DataObj);
AcpiUtAddReference (ObjDesc->IndexField.IndexObj);
+ /*
+ * April 2006: Changed to match MS behavior
+ *
+ * The value written to the Index register is the byte offset of the
+ * target field in units of the granularity of the IndexField
+ *
+ * Previously, the value was calculated as an index in terms of the
+ * width of the Data register, as below:
+ *
+ * ObjDesc->IndexField.Value = (UINT32)
+ * (Info->FieldBitPosition / ACPI_MUL_8 (
+ * ObjDesc->Field.AccessByteWidth));
+ *
+ * February 2006: Tried value as a byte offset:
+ * ObjDesc->IndexField.Value = (UINT32)
+ * ACPI_DIV_8 (Info->FieldBitPosition);
+ */
+ ObjDesc->IndexField.Value = (UINT32) ACPI_ROUND_DOWN (
+ ACPI_DIV_8 (Info->FieldBitPosition),
+ ObjDesc->IndexField.AccessByteWidth);
+
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
"IndexField: BitOff %X, Off %X, Value %X, Gran %X, Index %p, Data %p\n",
ObjDesc->IndexField.StartFieldBitOffset,
Index: acenv.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acenv.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acenv.h -L sys/contrib/dev/acpica/acenv.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acenv.h
+++ sys/contrib/dev/acpica/acenv.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acenv.h - Generation environment specific items
- * $Revision: 109 $
+ * $Revision: 1.131 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,34 +122,56 @@
* Configuration for ACPI tools and utilities
*/
-#ifdef _ACPI_DUMP_APP
-#ifndef MSDOS
-#define ACPI_DEBUG_OUTPUT
+#ifdef ACPI_LIBRARY
+/*
+ * Note: The non-debug version of the AcpiLibrary does not contain any
+ * debug support, for minimimal size. The debug version uses ACPI_FULL_DEBUG
+ */
+#define ACPI_USE_LOCAL_CACHE
#endif
+
+#ifdef ACPI_ASL_COMPILER
+#define ACPI_DEBUG_OUTPUT
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
-#define ACPI_NO_METHOD_EXECUTION
-#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_LARGE_NAMESPACE_NODE
+#define ACPI_DATA_TABLE_DISASSEMBLY
#endif
-#ifdef _ACPI_EXEC_APP
+#ifdef ACPI_EXEC_APP
#undef DEBUGGER_THREADING
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
-#define ACPI_DEBUG_OUTPUT
+#define ACPI_FULL_DEBUG
#define ACPI_APPLICATION
#define ACPI_DEBUGGER
-#define ACPI_DISASSEMBLER
-#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_MUTEX_DEBUG
+#define ACPI_DBG_TRACK_ALLOCATIONS
#endif
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_DASM_APP
+#ifndef MSDOS
#define ACPI_DEBUG_OUTPUT
+#endif
#define ACPI_APPLICATION
#define ACPI_DISASSEMBLER
-#define ACPI_CONSTANT_EVAL_ONLY
+#define ACPI_NO_METHOD_EXECUTION
+#define ACPI_LARGE_NAMESPACE_NODE
+#define ACPI_DATA_TABLE_DISASSEMBLY
+#endif
+
+#ifdef ACPI_APPLICATION
#define ACPI_USE_SYSTEM_CLIBRARY
+#define ACPI_USE_LOCAL_CACHE
+#endif
+
+#ifdef ACPI_FULL_DEBUG
+#define ACPI_DEBUGGER
+#define ACPI_DEBUG_OUTPUT
+#define ACPI_DISASSEMBLER
#endif
+
/*
* Environment configuration. The purpose of this file is to interface to the
* local generation environment.
@@ -204,7 +226,7 @@
#elif defined(MSDOS) /* Must appear after WIN32 and WIN64 check */
#include "acdos16.h"
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
#include <contrib/dev/acpica/acfreebsd.h>
#elif defined(__NetBSD__)
@@ -216,6 +238,9 @@
#elif defined(NETWARE)
#include "acnetware.h"
+#elif defined(__sun)
+#include "acsolaris.h"
+
#else
/* All other environments */
@@ -225,24 +250,6 @@
#define COMPILER_DEPENDENT_INT64 long long
#define COMPILER_DEPENDENT_UINT64 unsigned long long
-/*
- * This macro is used to tag functions as "printf-like" because
- * some compilers can catch printf format string problems. MSVC
- * doesn't, so this is proprocessed away.
- */
-#define ACPI_PRINTF_LIKE_FUNC
-
-#endif
-
-/*
- * Memory allocation tracking. Used only if
- * 1) This is the debug version
- * 2) This is NOT a 16-bit version of the code (not enough real-mode memory)
- */
-#ifdef ACPI_DEBUG_OUTPUT
-#if ACPI_MACHINE_WIDTH != 16
-#define ACPI_DBG_TRACK_ALLOCATIONS
-#endif
#endif
/*! [End] no source code translation !*/
@@ -268,18 +275,20 @@
#endif
#endif /* !DEBUGGER_THREADING */
+
/******************************************************************************
*
* C library configuration
*
*****************************************************************************/
+#define ACPI_IS_ASCII(c) ((c) < 0x80)
+
#ifdef ACPI_USE_SYSTEM_CLIBRARY
/*
* Use the standard C library headers.
* We want to keep these to a minimum.
*/
-
#ifdef ACPI_USE_STANDARD_HEADERS
/*
* Use the standard headers from the standard locations
@@ -294,9 +303,8 @@
/*
* We will be linking to the standard Clib functions
*/
-
#define ACPI_STRSTR(s1,s2) strstr((s1), (s2))
-#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s))
+#define ACPI_STRCHR(s1,c) strchr((s1), (c))
#define ACPI_STRLEN(s) (ACPI_SIZE) strlen((s))
#define ACPI_STRCPY(d,s) (void) strcpy((d), (s))
#define ACPI_STRNCPY(d,s,n) (void) strncpy((d), (s), (ACPI_SIZE)(n))
@@ -305,28 +313,28 @@
#define ACPI_STRCAT(d,s) (void) strcat((d), (s))
#define ACPI_STRNCAT(d,s,n) strncat((d), (s), (ACPI_SIZE)(n))
#define ACPI_STRTOUL(d,s,n) strtoul((d), (s), (ACPI_SIZE)(n))
-#define ACPI_MEMCMP(s1,s2,n) memcmp((s1), (s2), (ACPI_SIZE)(n))
+#define ACPI_MEMCMP(s1,s2,n) memcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
#define ACPI_MEMCPY(d,s,n) (void) memcpy((d), (s), (ACPI_SIZE)(n))
#define ACPI_MEMSET(d,s,n) (void) memset((d), (s), (ACPI_SIZE)(n))
-#define ACPI_TOUPPER toupper
-#define ACPI_TOLOWER tolower
-#define ACPI_IS_XDIGIT isxdigit
-#define ACPI_IS_DIGIT isdigit
-#define ACPI_IS_SPACE isspace
-#define ACPI_IS_UPPER isupper
-#define ACPI_IS_PRINT isprint
-#define ACPI_IS_ALPHA isalpha
-#define ACPI_IS_ASCII isascii
+#define ACPI_TOUPPER(i) toupper((int) (i))
+#define ACPI_TOLOWER(i) tolower((int) (i))
+#define ACPI_IS_XDIGIT(i) isxdigit((int) (i))
+#define ACPI_IS_DIGIT(i) isdigit((int) (i))
+#define ACPI_IS_SPACE(i) isspace((int) (i))
+#define ACPI_IS_UPPER(i) isupper((int) (i))
+#define ACPI_IS_PRINT(i) isprint((int) (i))
+#define ACPI_IS_ALPHA(i) isalpha((int) (i))
+
+#else
/******************************************************************************
*
* Not using native C library, use local implementations
*
*****************************************************************************/
-#else
-/*
+ /*
* Use local definitions of C library macros and functions
* NOTE: The function implementations may not be as efficient
* as an inline or assembly code implementation provided by a
@@ -343,14 +351,12 @@
/*
* Storage alignment properties
*/
-
#define _AUPBND (sizeof (ACPI_NATIVE_INT) - 1)
#define _ADNBND (sizeof (ACPI_NATIVE_INT) - 1)
/*
* Variable argument list macro definitions
*/
-
#define _Bnd(X, bnd) (((sizeof (X)) + (bnd)) & (~(bnd)))
#define va_arg(ap, T) (*(T *)(((ap) += (_Bnd (T, _AUPBND))) - (_Bnd (T,_ADNBND))))
#define va_end(ap) (void) 0
@@ -359,19 +365,19 @@
#endif /* va_arg */
-#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2))
-#define ACPI_STRUPR(s) (void) AcpiUtStrupr ((s))
-#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s))
-#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s))
+#define ACPI_STRSTR(s1,s2) AcpiUtStrstr ((s1), (s2))
+#define ACPI_STRCHR(s1,c) AcpiUtStrchr ((s1), (c))
+#define ACPI_STRLEN(s) (ACPI_SIZE) AcpiUtStrlen ((s))
+#define ACPI_STRCPY(d,s) (void) AcpiUtStrcpy ((d), (s))
#define ACPI_STRNCPY(d,s,n) (void) AcpiUtStrncpy ((d), (s), (ACPI_SIZE)(n))
#define ACPI_STRNCMP(d,s,n) AcpiUtStrncmp ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s))
-#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s))
+#define ACPI_STRCMP(d,s) AcpiUtStrcmp ((d), (s))
+#define ACPI_STRCAT(d,s) (void) AcpiUtStrcat ((d), (s))
#define ACPI_STRNCAT(d,s,n) AcpiUtStrncat ((d), (s), (ACPI_SIZE)(n))
#define ACPI_STRTOUL(d,s,n) AcpiUtStrtoul ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((s1), (s2), (ACPI_SIZE)(n))
-#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
-#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
+#define ACPI_MEMCMP(s1,s2,n) AcpiUtMemcmp((const char *)(s1), (const char *)(s2), (ACPI_SIZE)(n))
+#define ACPI_MEMCPY(d,s,n) (void) AcpiUtMemcpy ((d), (s), (ACPI_SIZE)(n))
+#define ACPI_MEMSET(d,v,n) (void) AcpiUtMemset ((d), (v), (ACPI_SIZE)(n))
#define ACPI_TOUPPER AcpiUtToUpper
#define ACPI_TOLOWER AcpiUtToLower
Index: nsdump.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsdump.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsdump.c -L sys/contrib/dev/acpica/nsdump.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsdump.c
+++ sys/contrib/dev/acpica/nsdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 160 $
+ * $Revision: 1.182 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,16 +125,32 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsdump")
+/* Local prototypes */
-#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+void
+AcpiNsDumpRootDevices (
+ void);
+
+static ACPI_STATUS
+AcpiNsDumpOneDevice (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+#endif
+
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*******************************************************************************
*
* FUNCTION: AcpiNsPrintPathname
*
- * PARAMETERS: NumSegment - Number of ACPI name segments
+ * PARAMETERS: NumSegments - Number of ACPI name segments
* Pathname - The compressed (internal) path
*
+ * RETURN: None
+ *
* DESCRIPTION: Print an object's full namespace pathname
*
******************************************************************************/
@@ -144,7 +160,10 @@
UINT32 NumSegments,
char *Pathname)
{
- ACPI_FUNCTION_NAME ("NsPrintPathname");
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_NAME (NsPrintPathname);
if (!(AcpiDbgLevel & ACPI_LV_NAMES) || !(AcpiDbgLayer & ACPI_NAMESPACE))
@@ -158,9 +177,14 @@
while (NumSegments)
{
- AcpiOsPrintf ("%4.4s", Pathname);
- Pathname += ACPI_NAME_SIZE;
+ for (i = 0; i < 4; i++)
+ {
+ ACPI_IS_PRINT (Pathname[i]) ?
+ AcpiOsPrintf ("%c", Pathname[i]) :
+ AcpiOsPrintf ("?");
+ }
+ Pathname += ACPI_NAME_SIZE;
NumSegments--;
if (NumSegments)
{
@@ -181,6 +205,8 @@
* Level - Desired debug level
* Component - Caller's component ID
*
+ * RETURN: None
+ *
* DESCRIPTION: Print an object's full namespace pathname
* Manages allocation/freeing of a pathname buffer
*
@@ -194,7 +220,7 @@
UINT32 Component)
{
- ACPI_FUNCTION_TRACE ("NsDumpPathname");
+ ACPI_FUNCTION_TRACE (NsDumpPathname);
/* Do this only if the requested debug level and component are enabled */
@@ -216,9 +242,12 @@
*
* FUNCTION: AcpiNsDumpOneObject
*
- * PARAMETERS: Handle - Node to be dumped
+ * PARAMETERS: ObjHandle - Node to be dumped
* Level - Nesting level of the handle
* Context - Passed into WalkNamespace
+ * ReturnValue - Not used
+ *
+ * RETURN: Status
*
* DESCRIPTION: Dump a single Node
* This procedure is a UserFunction called by AcpiNsWalkNamespace.
@@ -242,7 +271,7 @@
UINT32 i;
- ACPI_FUNCTION_NAME ("NsDumpOneObject");
+ ACPI_FUNCTION_NAME (NsDumpOneObject);
/* Is output enabled? */
@@ -263,41 +292,55 @@
/* Check if the owner matches */
- if ((Info->OwnerId != ACPI_UINT32_MAX) &&
+ if ((Info->OwnerId != ACPI_OWNER_ID_MAX) &&
(Info->OwnerId != ThisNode->OwnerId))
{
return (AE_OK);
}
- /* Indent the object according to the level */
+ if (!(Info->DisplayType & ACPI_DISPLAY_SHORT))
+ {
+ /* Indent the object according to the level */
- AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
+ AcpiOsPrintf ("%2d%*s", (UINT32) Level - 1, (int) Level * 2, " ");
- /* Check the node type and name */
+ /* Check the node type and name */
- if (Type > ACPI_TYPE_LOCAL_MAX)
- {
- ACPI_REPORT_WARNING (("Invalid ACPI Type %08X\n", Type));
- }
+ if (Type > ACPI_TYPE_LOCAL_MAX)
+ {
+ ACPI_WARNING ((AE_INFO, "Invalid ACPI Object Type %08X", Type));
+ }
- if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
- {
- ACPI_REPORT_WARNING (("Invalid ACPI Name %08X\n",
- ThisNode->Name.Integer));
+ if (!AcpiUtValidAcpiName (ThisNode->Name.Integer))
+ {
+ ThisNode->Name.Integer = AcpiUtRepairName (ThisNode->Name.Ascii);
+
+ ACPI_WARNING ((AE_INFO, "Invalid ACPI Name %08X",
+ ThisNode->Name.Integer));
+ }
+
+ AcpiOsPrintf ("%4.4s", AcpiUtGetNodeName (ThisNode));
}
/*
* Now we can print out the pertinent information
*/
- AcpiOsPrintf ("%4.4s %-12s %p ",
- AcpiUtGetNodeName (ThisNode), AcpiUtGetTypeName (Type), ThisNode);
+ AcpiOsPrintf (" %-12s %p %2.2X ",
+ AcpiUtGetTypeName (Type), ThisNode, ThisNode->OwnerId);
DbgLevel = AcpiDbgLevel;
AcpiDbgLevel = 0;
ObjDesc = AcpiNsGetAttachedObject (ThisNode);
AcpiDbgLevel = DbgLevel;
- switch (Info->DisplayType)
+ /* Temp nodes are those nodes created by a control method */
+
+ if (ThisNode->Flags & ANOBJ_TEMPORARY)
+ {
+ AcpiOsPrintf ("(T) ");
+ }
+
+ switch (Info->DisplayType & ACPI_DISPLAY_MASK)
{
case ACPI_DISPLAY_SUMMARY:
@@ -492,8 +535,7 @@
return (AE_OK);
}
- AcpiOsPrintf ("(R%d)",
- ObjDesc->Common.ReferenceCount);
+ AcpiOsPrintf ("(R%d)", ObjDesc->Common.ReferenceCount);
switch (Type)
{
@@ -556,7 +598,7 @@
while (ObjDesc)
{
ObjType = ACPI_TYPE_INVALID;
- AcpiOsPrintf (" Attached Object %p: ", ObjDesc);
+ AcpiOsPrintf ("Attached Object %p: ", ObjDesc);
/* Decode the type of attached object and dump the contents */
@@ -566,9 +608,9 @@
AcpiOsPrintf ("(Ptr to Node)\n");
BytesToDump = sizeof (ACPI_NAMESPACE_NODE);
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
break;
-
case ACPI_DESC_TYPE_OPERAND:
ObjType = ACPI_GET_OBJECT_TYPE (ObjDesc);
@@ -581,24 +623,19 @@
}
else
{
- AcpiOsPrintf ("(Ptr to ACPI Object type %s, %X)\n",
- AcpiUtGetTypeName (ObjType), ObjType);
+ AcpiOsPrintf ("(Ptr to ACPI Object type %X [%s])\n",
+ ObjType, AcpiUtGetTypeName (ObjType));
BytesToDump = sizeof (ACPI_OPERAND_OBJECT);
}
- break;
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
+ break;
default:
- AcpiOsPrintf (
- "(String or Buffer ptr - not an object descriptor) [%s]\n",
- AcpiUtGetDescriptorName (ObjDesc));
- BytesToDump = 16;
break;
}
- ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
-
/* If value is NOT an internal object, we are done */
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
@@ -611,13 +648,17 @@
*/
switch (ObjType)
{
+ case ACPI_TYPE_BUFFER:
case ACPI_TYPE_STRING:
+ /*
+ * NOTE: takes advantage of common fields between string/buffer
+ */
+ BytesToDump = ObjDesc->String.Length;
ObjDesc = (void *) ObjDesc->String.Pointer;
- break;
-
- case ACPI_TYPE_BUFFER:
- ObjDesc = (void *) ObjDesc->Buffer.Pointer;
- break;
+ AcpiOsPrintf ( "(Buffer/String pointer %p length %X)\n",
+ ObjDesc, BytesToDump);
+ ACPI_DUMP_BUFFER (ObjDesc, BytesToDump);
+ goto Cleanup;
case ACPI_TYPE_BUFFER_FIELD:
ObjDesc = (ACPI_OPERAND_OBJECT *) ObjDesc->BufferField.BufferObj;
@@ -661,12 +702,15 @@
* FUNCTION: AcpiNsDumpObjects
*
* PARAMETERS: Type - Object type to be dumped
+ * DisplayType - 0 or ACPI_DISPLAY_SUMMARY
* MaxDepth - Maximum depth of dump. Use ACPI_UINT32_MAX
* for an effectively unlimited depth.
* OwnerId - Dump only objects owned by this ID. Use
* ACPI_UINT32_MAX to match all owners.
* StartHandle - Where in namespace to start/end search
*
+ * RETURN: None
+ *
* DESCRIPTION: Dump typed objects within the loaded namespace.
* Uses AcpiNsWalkNamespace in conjunction with AcpiNsDumpOneObject.
*
@@ -677,7 +721,7 @@
ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
- UINT32 OwnerId,
+ ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle)
{
ACPI_WALK_INFO Info;
@@ -691,11 +735,44 @@
Info.DisplayType = DisplayType;
(void) AcpiNsWalkNamespace (Type, StartHandle, MaxDepth,
- ACPI_NS_WALK_NO_UNLOCK, AcpiNsDumpOneObject,
- (void *) &Info, NULL);
+ ACPI_NS_WALK_NO_UNLOCK | ACPI_NS_WALK_TEMP_NODES,
+ AcpiNsDumpOneObject, (void *) &Info, NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiNsDumpEntry
+ *
+ * PARAMETERS: Handle - Node to be dumped
+ * DebugLevel - Output level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump a single Node
+ *
+ ******************************************************************************/
+
+void
+AcpiNsDumpEntry (
+ ACPI_HANDLE Handle,
+ UINT32 DebugLevel)
+{
+ ACPI_WALK_INFO Info;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Info.DebugLevel = DebugLevel;
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY;
+
+ (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
}
+#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpTables
@@ -705,6 +782,8 @@
* MaxDepth - Maximum depth of dump. Use INT_MAX
* for an effectively unlimited depth.
*
+ * RETURN: None
+ *
* DESCRIPTION: Dump the name space, or a portion of it.
*
******************************************************************************/
@@ -717,7 +796,7 @@
ACPI_HANDLE SearchHandle = SearchBase;
- ACPI_FUNCTION_TRACE ("NsDumpTables");
+ ACPI_FUNCTION_TRACE (NsDumpTables);
if (!AcpiGbl_RootNode)
@@ -732,46 +811,16 @@
if (ACPI_NS_ALL == SearchBase)
{
- /* entire namespace */
+ /* Entire namespace */
SearchHandle = AcpiGbl_RootNode;
ACPI_DEBUG_PRINT ((ACPI_DB_TABLES, "\\\n"));
}
AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_OBJECTS, MaxDepth,
- ACPI_UINT32_MAX, SearchHandle);
+ ACPI_OWNER_ID_MAX, SearchHandle);
return_VOID;
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsDumpEntry
- *
- * PARAMETERS: Handle - Node to be dumped
- * DebugLevel - Output level
- *
- * DESCRIPTION: Dump a single Node
- *
- ******************************************************************************/
-
-void
-AcpiNsDumpEntry (
- ACPI_HANDLE Handle,
- UINT32 DebugLevel)
-{
- ACPI_WALK_INFO Info;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- Info.DebugLevel = DebugLevel;
- Info.OwnerId = ACPI_UINT32_MAX;
- Info.DisplayType = ACPI_DISPLAY_SUMMARY;
-
- (void) AcpiNsDumpOneObject (Handle, 1, &Info, NULL);
-}
-
+#endif
#endif
Index: rsutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsutils.c -L sys/contrib/dev/acpica/rsutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsutils.c
+++ sys/contrib/dev/acpica/rsutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsutils - Utilities for the resource manager
- * $Revision: 39 $
+ * $Revision: 1.67 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,11 +128,444 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiRsDecodeBitmask
+ *
+ * PARAMETERS: Mask - Bitmask to decode
+ * List - Where the converted list is returned
+ *
+ * RETURN: Count of bits set (length of list)
+ *
+ * DESCRIPTION: Convert a bit mask into a list of values
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiRsDecodeBitmask (
+ UINT16 Mask,
+ UINT8 *List)
+{
+ ACPI_NATIVE_UINT i;
+ UINT8 BitCount;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Decode the mask bits */
+
+ for (i = 0, BitCount = 0; Mask; i++)
+ {
+ if (Mask & 0x0001)
+ {
+ List[BitCount] = (UINT8) i;
+ BitCount++;
+ }
+
+ Mask >>= 1;
+ }
+
+ return (BitCount);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsEncodeBitmask
+ *
+ * PARAMETERS: List - List of values to encode
+ * Count - Length of list
+ *
+ * RETURN: Encoded bitmask
+ *
+ * DESCRIPTION: Convert a list of values to an encoded bitmask
+ *
+ ******************************************************************************/
+
+UINT16
+AcpiRsEncodeBitmask (
+ UINT8 *List,
+ UINT8 Count)
+{
+ ACPI_NATIVE_UINT i;
+ UINT16 Mask;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Encode the list into a single bitmask */
+
+ for (i = 0, Mask = 0; i < Count; i++)
+ {
+ Mask |= (0x0001 << List[i]);
+ }
+
+ return (Mask);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsMoveData
+ *
+ * PARAMETERS: Destination - Pointer to the destination descriptor
+ * Source - Pointer to the source descriptor
+ * ItemCount - How many items to move
+ * MoveType - Byte width
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Move multiple data items from one descriptor to another. Handles
+ * alignment issues and endian issues if necessary, as configured
+ * via the ACPI_MOVE_* macros. (This is why a memcpy is not used)
+ *
+ ******************************************************************************/
+
+void
+AcpiRsMoveData (
+ void *Destination,
+ void *Source,
+ UINT16 ItemCount,
+ UINT8 MoveType)
+{
+ ACPI_NATIVE_UINT i;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* One move per item */
+
+ for (i = 0; i < ItemCount; i++)
+ {
+ switch (MoveType)
+ {
+ /*
+ * For the 8-bit case, we can perform the move all at once
+ * since there are no alignment or endian issues
+ */
+ case ACPI_RSC_MOVE8:
+ ACPI_MEMCPY (Destination, Source, ItemCount);
+ return;
+
+ /*
+ * 16-, 32-, and 64-bit cases must use the move macros that perform
+ * endian conversion and/or accomodate hardware that cannot perform
+ * misaligned memory transfers
+ */
+ case ACPI_RSC_MOVE16:
+ ACPI_MOVE_16_TO_16 (&ACPI_CAST_PTR (UINT16, Destination)[i],
+ &ACPI_CAST_PTR (UINT16, Source)[i]);
+ break;
+
+ case ACPI_RSC_MOVE32:
+ ACPI_MOVE_32_TO_32 (&ACPI_CAST_PTR (UINT32, Destination)[i],
+ &ACPI_CAST_PTR (UINT32, Source)[i]);
+ break;
+
+ case ACPI_RSC_MOVE64:
+ ACPI_MOVE_64_TO_64 (&ACPI_CAST_PTR (UINT64, Destination)[i],
+ &ACPI_CAST_PTR (UINT64, Source)[i]);
+ break;
+
+ default:
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsSetResourceLength
+ *
+ * PARAMETERS: TotalLength - Length of the AML descriptor, including
+ * the header and length fields.
+ * Aml - Pointer to the raw AML descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set the ResourceLength field of an AML
+ * resource descriptor, both Large and Small descriptors are
+ * supported automatically. Note: Descriptor Type field must
+ * be valid.
+ *
+ ******************************************************************************/
+
+void
+AcpiRsSetResourceLength (
+ ACPI_RSDESC_SIZE TotalLength,
+ AML_RESOURCE *Aml)
+{
+ ACPI_RS_LENGTH ResourceLength;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Length is the total descriptor length minus the header length */
+
+ ResourceLength = (ACPI_RS_LENGTH)
+ (TotalLength - AcpiUtGetResourceHeaderLength (Aml));
+
+ /* Length is stored differently for large and small descriptors */
+
+ if (Aml->SmallHeader.DescriptorType & ACPI_RESOURCE_NAME_LARGE)
+ {
+ /* Large descriptor -- bytes 1-2 contain the 16-bit length */
+
+ ACPI_MOVE_16_TO_16 (&Aml->LargeHeader.ResourceLength, &ResourceLength);
+ }
+ else
+ {
+ /* Small descriptor -- bits 2:0 of byte 0 contain the length */
+
+ Aml->SmallHeader.DescriptorType = (UINT8)
+
+ /* Clear any existing length, preserving descriptor type bits */
+
+ ((Aml->SmallHeader.DescriptorType & ~ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK)
+
+ | ResourceLength);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsSetResourceHeader
+ *
+ * PARAMETERS: DescriptorType - Byte to be inserted as the type
+ * TotalLength - Length of the AML descriptor, including
+ * the header and length fields.
+ * Aml - Pointer to the raw AML descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Set the DescriptorType and ResourceLength fields of an AML
+ * resource descriptor, both Large and Small descriptors are
+ * supported automatically
+ *
+ ******************************************************************************/
+
+void
+AcpiRsSetResourceHeader (
+ UINT8 DescriptorType,
+ ACPI_RSDESC_SIZE TotalLength,
+ AML_RESOURCE *Aml)
+{
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* Set the Resource Type */
+
+ Aml->SmallHeader.DescriptorType = DescriptorType;
+
+ /* Set the Resource Length */
+
+ AcpiRsSetResourceLength (TotalLength, Aml);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsStrcpy
+ *
+ * PARAMETERS: Destination - Pointer to the destination string
+ * Source - Pointer to the source string
+ *
+ * RETURN: String length, including NULL terminator
+ *
+ * DESCRIPTION: Local string copy that returns the string length, saving a
+ * strcpy followed by a strlen.
+ *
+ ******************************************************************************/
+
+static UINT16
+AcpiRsStrcpy (
+ char *Destination,
+ char *Source)
+{
+ UINT16 i;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ for (i = 0; Source[i]; i++)
+ {
+ Destination[i] = Source[i];
+ }
+
+ Destination[i] = 0;
+
+ /* Return string length including the NULL terminator */
+
+ return ((UINT16) (i + 1));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetResourceSource
+ *
+ * PARAMETERS: ResourceLength - Length field of the descriptor
+ * MinimumLength - Minimum length of the descriptor (minus
+ * any optional fields)
+ * ResourceSource - Where the ResourceSource is returned
+ * Aml - Pointer to the raw AML descriptor
+ * StringPtr - (optional) where to store the actual
+ * ResourceSource string
+ *
+ * RETURN: Length of the string plus NULL terminator, rounded up to native
+ * word boundary
+ *
+ * DESCRIPTION: Copy the optional ResourceSource data from a raw AML descriptor
+ * to an internal resource descriptor
+ *
+ ******************************************************************************/
+
+ACPI_RS_LENGTH
+AcpiRsGetResourceSource (
+ ACPI_RS_LENGTH ResourceLength,
+ ACPI_RS_LENGTH MinimumLength,
+ ACPI_RESOURCE_SOURCE *ResourceSource,
+ AML_RESOURCE *Aml,
+ char *StringPtr)
+{
+ ACPI_RSDESC_SIZE TotalLength;
+ UINT8 *AmlResourceSource;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
+ AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
+
+ /*
+ * ResourceSource is present if the length of the descriptor is longer than
+ * the minimum length.
+ *
+ * Note: Some resource descriptors will have an additional null, so
+ * we add 1 to the minimum length.
+ */
+ if (TotalLength > (ACPI_RSDESC_SIZE) (MinimumLength + 1))
+ {
+ /* Get the ResourceSourceIndex */
+
+ ResourceSource->Index = AmlResourceSource[0];
+
+ ResourceSource->StringPtr = StringPtr;
+ if (!StringPtr)
+ {
+ /*
+ * String destination pointer is not specified; Set the String
+ * pointer to the end of the current ResourceSource structure.
+ */
+ ResourceSource->StringPtr = ACPI_ADD_PTR (char, ResourceSource,
+ sizeof (ACPI_RESOURCE_SOURCE));
+ }
+
+ /*
+ * In order for the Resource length to be a multiple of the native
+ * word, calculate the length of the string (+1 for NULL terminator)
+ * and expand to the next word multiple.
+ *
+ * Zero the entire area of the buffer.
+ */
+ TotalLength = (UINT32) ACPI_STRLEN (
+ ACPI_CAST_PTR (char, &AmlResourceSource[1])) + 1;
+ TotalLength = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (TotalLength);
+
+ ACPI_MEMSET (ResourceSource->StringPtr, 0, TotalLength);
+
+ /* Copy the ResourceSource string to the destination */
+
+ ResourceSource->StringLength = AcpiRsStrcpy (ResourceSource->StringPtr,
+ ACPI_CAST_PTR (char, &AmlResourceSource[1]));
+
+ return ((ACPI_RS_LENGTH) TotalLength);
+ }
+
+ /* ResourceSource is not present */
+
+ ResourceSource->Index = 0;
+ ResourceSource->StringLength = 0;
+ ResourceSource->StringPtr = NULL;
+ return (0);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsSetResourceSource
+ *
+ * PARAMETERS: Aml - Pointer to the raw AML descriptor
+ * MinimumLength - Minimum length of the descriptor (minus
+ * any optional fields)
+ * ResourceSource - Internal ResourceSource
+
+ *
+ * RETURN: Total length of the AML descriptor
+ *
+ * DESCRIPTION: Convert an optional ResourceSource from internal format to a
+ * raw AML resource descriptor
+ *
+ ******************************************************************************/
+
+ACPI_RSDESC_SIZE
+AcpiRsSetResourceSource (
+ AML_RESOURCE *Aml,
+ ACPI_RS_LENGTH MinimumLength,
+ ACPI_RESOURCE_SOURCE *ResourceSource)
+{
+ UINT8 *AmlResourceSource;
+ ACPI_RSDESC_SIZE DescriptorLength;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ DescriptorLength = MinimumLength;
+
+ /* Non-zero string length indicates presence of a ResourceSource */
+
+ if (ResourceSource->StringLength)
+ {
+ /* Point to the end of the AML descriptor */
+
+ AmlResourceSource = ACPI_ADD_PTR (UINT8, Aml, MinimumLength);
+
+ /* Copy the ResourceSourceIndex */
+
+ AmlResourceSource[0] = (UINT8) ResourceSource->Index;
+
+ /* Copy the ResourceSource string */
+
+ ACPI_STRCPY (ACPI_CAST_PTR (char, &AmlResourceSource[1]),
+ ResourceSource->StringPtr);
+
+ /*
+ * Add the length of the string (+ 1 for null terminator) to the
+ * final descriptor length
+ */
+ DescriptorLength += ((ACPI_RSDESC_SIZE) ResourceSource->StringLength + 1);
+ }
+
+ /* Return the new total length of the AML descriptor */
+
+ return (DescriptorLength);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiRsGetPrtMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * PARAMETERS: Node - Device node
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -146,22 +579,22 @@
ACPI_STATUS
AcpiRsGetPrtMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetPrtMethodData");
+ ACPI_FUNCTION_TRACE (RsGetPrtMethodData);
/* Parameters guaranteed valid by caller */
- /*
- * Execute the method, no parameters
- */
- Status = AcpiUtEvaluateObject (Handle, "_PRT", ACPI_BTYPE_PACKAGE, &ObjDesc);
+ /* Execute the method, no parameters */
+
+ Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRT,
+ ACPI_BTYPE_PACKAGE, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -184,9 +617,9 @@
*
* FUNCTION: AcpiRsGetCrsMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * PARAMETERS: Node - Device node
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -200,22 +633,22 @@
ACPI_STATUS
AcpiRsGetCrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetCrsMethodData");
+ ACPI_FUNCTION_TRACE (RsGetCrsMethodData);
/* Parameters guaranteed valid by caller */
- /*
- * Execute the method, no parameters
- */
- Status = AcpiUtEvaluateObject (Handle, "_CRS", ACPI_BTYPE_BUFFER, &ObjDesc);
+ /* Execute the method, no parameters */
+
+ Status = AcpiUtEvaluateObject (Node, METHOD_NAME__CRS,
+ ACPI_BTYPE_BUFFER, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -239,9 +672,9 @@
*
* FUNCTION: AcpiRsGetPrsMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * PARAMETERS: Node - Device node
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -255,22 +688,22 @@
ACPI_STATUS
AcpiRsGetPrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *RetBuffer)
{
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetPrsMethodData");
+ ACPI_FUNCTION_TRACE (RsGetPrsMethodData);
/* Parameters guaranteed valid by caller */
- /*
- * Execute the method, no parameters
- */
- Status = AcpiUtEvaluateObject (Handle, "_PRS", ACPI_BTYPE_BUFFER, &ObjDesc);
+ /* Execute the method, no parameters */
+
+ Status = AcpiUtEvaluateObject (Node, METHOD_NAME__PRS,
+ ACPI_BTYPE_BUFFER, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -294,9 +727,10 @@
*
* FUNCTION: AcpiRsGetMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * RetBuffer - a pointer to a buffer structure for the
- * results
+ * PARAMETERS: Handle - Handle to the containing object
+ * Path - Path to method, relative to Handle
+ * RetBuffer - Pointer to a buffer structure for the
+ * results
*
* RETURN: Status
*
@@ -318,16 +752,16 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("RsGetMethodData");
+ ACPI_FUNCTION_TRACE (RsGetMethodData);
/* Parameters guaranteed valid by caller */
- /*
- * Execute the method, no parameters
- */
+ /* Execute the method, no parameters */
+
Status = AcpiUtEvaluateObject (Handle, Path, ACPI_BTYPE_BUFFER, &ObjDesc);
- if (ACPI_FAILURE (Status)) {
+ if (ACPI_FAILURE (Status))
+ {
return_ACPI_STATUS (Status);
}
@@ -344,13 +778,14 @@
return_ACPI_STATUS (Status);
}
+
/*******************************************************************************
*
* FUNCTION: AcpiRsSetSrsMethodData
*
- * PARAMETERS: Handle - a handle to the containing object
- * InBuffer - a pointer to a buffer structure of the
- * parameter
+ * PARAMETERS: Node - Device node
+ * InBuffer - Pointer to a buffer structure of the
+ * parameter
*
* RETURN: Status
*
@@ -360,69 +795,81 @@
* If the function fails an appropriate status will be returned
* and the contents of the callers buffer is undefined.
*
+ * Note: Parameters guaranteed valid by caller
+ *
******************************************************************************/
ACPI_STATUS
AcpiRsSetSrsMethodData (
- ACPI_HANDLE Handle,
+ ACPI_NAMESPACE_NODE *Node,
ACPI_BUFFER *InBuffer)
{
- ACPI_PARAMETER_INFO Info;
- ACPI_OPERAND_OBJECT *Params[2];
+ ACPI_EVALUATE_INFO *Info;
+ ACPI_OPERAND_OBJECT *Args[2];
ACPI_STATUS Status;
ACPI_BUFFER Buffer;
- ACPI_FUNCTION_TRACE ("RsSetSrsMethodData");
+ ACPI_FUNCTION_TRACE (RsSetSrsMethodData);
- /* Parameters guaranteed valid by caller */
+ /* Allocate and initialize the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->PrefixNode = Node;
+ Info->Pathname = METHOD_NAME__SRS;
+ Info->Parameters = Args;
+ Info->ParameterType = ACPI_PARAM_ARGS;
+ Info->Flags = ACPI_IGNORE_RETURN_VALUE;
/*
* The InBuffer parameter will point to a linked list of
- * resource parameters. It needs to be formatted into a
+ * resource parameters. It needs to be formatted into a
* byte stream to be sent in as an input parameter to _SRS
*
* Convert the linked list into a byte stream
*/
Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- Status = AcpiRsCreateByteStream (InBuffer->Pointer, &Buffer);
+ Status = AcpiRsCreateAmlResources (InBuffer->Pointer, &Buffer);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
- /*
- * Init the param object
- */
- Params[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
- if (!Params[0])
+ /* Create and initialize the method parameter object */
+
+ Args[0] = AcpiUtCreateInternalObject (ACPI_TYPE_BUFFER);
+ if (!Args[0])
{
- AcpiOsFree (Buffer.Pointer);
- return_ACPI_STATUS (AE_NO_MEMORY);
+ /*
+ * Must free the buffer allocated above (otherwise it is freed
+ * later)
+ */
+ ACPI_FREE (Buffer.Pointer);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
- /*
- * Set up the parameter object
- */
- Params[0]->Buffer.Length = (UINT32) Buffer.Length;
- Params[0]->Buffer.Pointer = Buffer.Pointer;
- Params[0]->Common.Flags = AOPOBJ_DATA_VALID;
- Params[1] = NULL;
-
- Info.Node = Handle;
- Info.Parameters = Params;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ Args[0]->Buffer.Length = (UINT32) Buffer.Length;
+ Args[0]->Buffer.Pointer = Buffer.Pointer;
+ Args[0]->Common.Flags = AOPOBJ_DATA_VALID;
+ Args[1] = NULL;
- /*
- * Execute the method, no return value
- */
- Status = AcpiNsEvaluateRelative ("_SRS", &Info);
+ /* Execute the method, no return value is expected */
- /*
- * Clean up and return the status from AcpiNsEvaluateRelative
- */
- AcpiUtRemoveReference (Params[0]);
+ Status = AcpiNsEvaluate (Info);
+
+ /* Clean up and return the status from AcpiNsEvaluate */
+
+ AcpiUtRemoveReference (Args[0]);
+
+Cleanup:
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
Index: rsaddr.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsaddr.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsaddr.c -L sys/contrib/dev/acpica/rsaddr.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsaddr.c
+++ sys/contrib/dev/acpica/rsaddr.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsaddr - Address resource descriptors (16/32/64)
- * $Revision: 35 $
+ * $Revision: 1.50 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,1193 +125,355 @@
/*******************************************************************************
*
- * FUNCTION: AcpiRsAddress16Resource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertAddress16 - All WORD (16-bit) address resources
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsAddress16Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[5] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT8 *TempPtr;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16);
- UINT32 Index;
- UINT16 Temp16;
- UINT8 Temp8;
-
-
- ACPI_FUNCTION_TRACE ("RsAddress16Resource");
-
-
- /*
- * Point past the Descriptor to get the number of bytes consumed
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- /* Validate minimum descriptor length */
-
- if (Temp16 < 13)
- {
- return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
- }
-
- *BytesConsumed = Temp16 + 3;
- OutputStruct->Id = ACPI_RSTYPE_ADDRESS16;
-
- /*
- * Get the Resource Type (Byte3)
- */
- Buffer += 2;
- Temp8 = *Buffer;
-
- /* Values 0-2 are valid */
-
- if (Temp8 > 2)
- {
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- }
-
- OutputStruct->Data.Address16.ResourceType = Temp8 & 0x03;
-
- /*
- * Get the General Flags (Byte4)
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- /* Producer / Consumer */
-
- OutputStruct->Data.Address16.ProducerConsumer = Temp8 & 0x01;
-
- /* Decode */
-
- OutputStruct->Data.Address16.Decode = (Temp8 >> 1) & 0x01;
-
- /* Min Address Fixed */
-
- OutputStruct->Data.Address16.MinAddressFixed = (Temp8 >> 2) & 0x01;
-
- /* Max Address Fixed */
-
- OutputStruct->Data.Address16.MaxAddressFixed = (Temp8 >> 3) & 0x01;
-
- /*
- * Get the Type Specific Flags (Byte5)
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address16.ResourceType)
- {
- OutputStruct->Data.Address16.Attribute.Memory.ReadWriteAttribute =
- (UINT16) (Temp8 & 0x01);
- OutputStruct->Data.Address16.Attribute.Memory.CacheAttribute =
- (UINT16) ((Temp8 >> 1) & 0x03);
- }
- else
- {
- if (ACPI_IO_RANGE == OutputStruct->Data.Address16.ResourceType)
- {
- OutputStruct->Data.Address16.Attribute.Io.RangeAttribute =
- (UINT16) (Temp8 & 0x03);
- OutputStruct->Data.Address16.Attribute.Io.TranslationAttribute =
- (UINT16) ((Temp8 >> 4) & 0x03);
- }
- else
- {
- /* BUS_NUMBER_RANGE == Address16.Data->ResourceType */
- /* Nothing needs to be filled in */
- }
- }
-
- /*
- * Get Granularity (Bytes 6-7)
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.Granularity, Buffer);
-
- /*
- * Get MinAddressRange (Bytes 8-9)
- */
- Buffer += 2;
- ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MinAddressRange, Buffer);
-
- /*
- * Get MaxAddressRange (Bytes 10-11)
- */
- Buffer += 2;
- ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.MaxAddressRange, Buffer);
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS16,
+ ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS16),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress16)},
- /*
- * Get AddressTranslationOffset (Bytes 12-13)
- */
- Buffer += 2;
- ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressTranslationOffset, Buffer);
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS16,
+ sizeof (AML_RESOURCE_ADDRESS16),
+ 0},
- /*
- * Get AddressLength (Bytes 14-15)
- */
- Buffer += 2;
- ACPI_MOVE_16_TO_32 (&OutputStruct->Data.Address16.AddressLength, Buffer);
+ /* Resource Type, General Flags, and Type-Specific Flags */
- /*
- * Resource Source Index (if present)
- */
- Buffer += 2;
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
/*
- * This will leave us pointing to the Resource Source Index
- * If it is present, then save it off and calculate the
- * pointer to where the null terminated string goes:
- * Each Interrupt takes 32-bits + the 5 bytes of the
- * stream that are default.
- *
- * Note: Some resource descriptors will have an additional null, so
- * we add 1 to the length.
+ * These fields are contiguous in both the source and destination:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
*/
- if (*BytesConsumed > (16 + 1))
- {
- /* Dereference the Index */
-
- Temp8 = *Buffer;
- OutputStruct->Data.Address16.ResourceSource.Index = (UINT32) Temp8;
-
- /* Point to the String */
-
- Buffer += 1;
-
- /* Point the String pointer to the end of this structure */
-
- OutputStruct->Data.Address16.ResourceSource.StringPtr =
- (char *)((UINT8 * )OutputStruct + StructSize);
-
- TempPtr = (UINT8 *) OutputStruct->Data.Address16.ResourceSource.StringPtr;
-
- /* Copy the string into the buffer */
-
- Index = 0;
-
- while (0x00 != *Buffer)
- {
- *TempPtr = *Buffer;
-
- TempPtr += 1;
- Buffer += 1;
- Index += 1;
- }
-
- /*
- * Add the terminating null
- */
- *TempPtr = 0x00;
-
- OutputStruct->Data.Address16.ResourceSource.StringLength = Index + 1;
-
- /*
- * In order for the StructSize to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * StructSize to the next 32-bit boundary.
- */
- Temp8 = (UINT8) (Index + 1);
- StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
- }
- else
- {
- OutputStruct->Data.Address16.ResourceSource.Index = 0x00;
- OutputStruct->Data.Address16.ResourceSource.StringLength = 0;
- OutputStruct->Data.Address16.ResourceSource.StringPtr = NULL;
- }
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Address16.Granularity),
+ AML_OFFSET (Address16.Granularity),
+ 5},
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
+ /* Optional ResourceSource (Index and String) */
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address16.ResourceSource),
+ 0,
+ sizeof (AML_RESOURCE_ADDRESS16)}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsAddress16Stream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsConvertAddress32 - All DWORD (32-bit) address resources
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsAddress16Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[5] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT8 *LengthField;
- UINT8 Temp8;
- char *TempPointer = NULL;
- ACPI_SIZE ActualBytes;
-
-
- ACPI_FUNCTION_TRACE ("RsAddress16Stream");
-
-
- /*
- * The descriptor field is static
- */
- *Buffer = 0x88;
- Buffer += 1;
-
- /*
- * Save a pointer to the Length field - to be filled in later
- */
- LengthField = Buffer;
- Buffer += 2;
-
- /*
- * Set the Resource Type (Memory, Io, BusNumber)
- */
- Temp8 = (UINT8) (LinkedList->Data.Address16.ResourceType & 0x03);
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the general flags
- */
- Temp8 = (UINT8) (LinkedList->Data.Address16.ProducerConsumer & 0x01);
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS32,
+ ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS32),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress32)},
- Temp8 |= (LinkedList->Data.Address16.Decode & 0x01) << 1;
- Temp8 |= (LinkedList->Data.Address16.MinAddressFixed & 0x01) << 2;
- Temp8 |= (LinkedList->Data.Address16.MaxAddressFixed & 0x01) << 3;
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS32,
+ sizeof (AML_RESOURCE_ADDRESS32),
+ 0},
- *Buffer = Temp8;
- Buffer += 1;
+ /* Resource Type, General Flags, and Type-Specific Flags */
- /*
- * Set the type specific flags
- */
- Temp8 = 0;
-
- if (ACPI_MEMORY_RANGE == LinkedList->Data.Address16.ResourceType)
- {
- Temp8 = (UINT8)
- (LinkedList->Data.Address16.Attribute.Memory.ReadWriteAttribute &
- 0x01);
-
- Temp8 |=
- (LinkedList->Data.Address16.Attribute.Memory.CacheAttribute &
- 0x03) << 1;
- }
- else if (ACPI_IO_RANGE == LinkedList->Data.Address16.ResourceType)
- {
- Temp8 = (UINT8)
- (LinkedList->Data.Address16.Attribute.Io.RangeAttribute &
- 0x03);
- Temp8 |=
- (LinkedList->Data.Address16.Attribute.Io.TranslationAttribute &
- 0x03) << 4;
- }
-
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the address space granularity
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.Granularity);
- Buffer += 2;
-
- /*
- * Set the address range minimum
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MinAddressRange);
- Buffer += 2;
-
- /*
- * Set the address range maximum
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.MaxAddressRange);
- Buffer += 2;
-
- /*
- * Set the address translation offset
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressTranslationOffset);
- Buffer += 2;
-
- /*
- * Set the address length
- */
- ACPI_MOVE_32_TO_16 (Buffer, &LinkedList->Data.Address16.AddressLength);
- Buffer += 2;
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
/*
- * Resource Source Index and Resource Source are optional
+ * These fields are contiguous in both the source and destination:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
*/
- if (0 != LinkedList->Data.Address16.ResourceSource.StringLength)
- {
- Temp8 = (UINT8) LinkedList->Data.Address16.ResourceSource.Index;
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.Address32.Granularity),
+ AML_OFFSET (Address32.Granularity),
+ 5},
- *Buffer = Temp8;
- Buffer += 1;
+ /* Optional ResourceSource (Index and String) */
- TempPointer = (char *) Buffer;
-
- /*
- * Copy the string
- */
- ACPI_STRCPY (TempPointer,
- LinkedList->Data.Address16.ResourceSource.StringPtr);
-
- /*
- * Buffer needs to be set to the length of the sting + one for the
- * terminating null
- */
- Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address16.ResourceSource.StringPtr) + 1);
- }
-
- /*
- * Return the number of bytes consumed in this operation
- */
- ActualBytes = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- *BytesConsumed = ActualBytes;
-
- /*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
- */
- ActualBytes -= 3;
- ACPI_MOVE_SIZE_TO_16 (LengthField, &ActualBytes);
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address32.ResourceSource),
+ 0,
+ sizeof (AML_RESOURCE_ADDRESS32)}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsAddress32Resource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertAddress64 - All QWORD (64-bit) address resources
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsAddress32Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[5] =
{
- UINT8 *Buffer;
- ACPI_RESOURCE *OutputStruct= (void *) *OutputBuffer;
- UINT16 Temp16;
- UINT8 Temp8;
- UINT8 *TempPtr;
- ACPI_SIZE StructSize;
- UINT32 Index;
-
-
- ACPI_FUNCTION_TRACE ("RsAddress32Resource");
-
-
- Buffer = ByteStreamBuffer;
- StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32);
-
- /*
- * Point past the Descriptor to get the number of bytes consumed
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- /* Validate minimum descriptor length */
-
- if (Temp16 < 23)
- {
- return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
- }
-
- *BytesConsumed = Temp16 + 3;
- OutputStruct->Id = ACPI_RSTYPE_ADDRESS32;
-
- /*
- * Get the Resource Type (Byte3)
- */
- Buffer += 2;
- Temp8 = *Buffer;
-
- /* Values 0-2 are valid */
- if(Temp8 > 2)
- {
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- }
-
- OutputStruct->Data.Address32.ResourceType = Temp8 & 0x03;
-
- /*
- * Get the General Flags (Byte4)
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- /*
- * Producer / Consumer
- */
- OutputStruct->Data.Address32.ProducerConsumer = Temp8 & 0x01;
-
- /*
- * Decode
- */
- OutputStruct->Data.Address32.Decode = (Temp8 >> 1) & 0x01;
-
- /*
- * Min Address Fixed
- */
- OutputStruct->Data.Address32.MinAddressFixed = (Temp8 >> 2) & 0x01;
-
- /*
- * Max Address Fixed
- */
- OutputStruct->Data.Address32.MaxAddressFixed = (Temp8 >> 3) & 0x01;
-
- /*
- * Get the Type Specific Flags (Byte5)
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address32.ResourceType)
- {
- OutputStruct->Data.Address32.Attribute.Memory.ReadWriteAttribute =
- (UINT16) (Temp8 & 0x01);
-
- OutputStruct->Data.Address32.Attribute.Memory.CacheAttribute =
- (UINT16) ((Temp8 >> 1) & 0x03);
- }
- else
- {
- if (ACPI_IO_RANGE == OutputStruct->Data.Address32.ResourceType)
- {
- OutputStruct->Data.Address32.Attribute.Io.RangeAttribute =
- (UINT16) (Temp8 & 0x03);
- OutputStruct->Data.Address32.Attribute.Io.TranslationAttribute =
- (UINT16) ((Temp8 >> 4) & 0x03);
- }
- else
- {
- /* BUS_NUMBER_RANGE == OutputStruct->Data.Address32.ResourceType */
- /* Nothing needs to be filled in */
- }
- }
-
- /*
- * Get Granularity (Bytes 6-9)
- */
- Buffer += 1;
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.Granularity, Buffer);
-
- /*
- * Get MinAddressRange (Bytes 10-13)
- */
- Buffer += 4;
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MinAddressRange, Buffer);
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_ADDRESS64,
+ ACPI_RS_SIZE (ACPI_RESOURCE_ADDRESS64),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertAddress64)},
- /*
- * Get MaxAddressRange (Bytes 14-17)
- */
- Buffer += 4;
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.MaxAddressRange, Buffer);
-
- /*
- * Get AddressTranslationOffset (Bytes 18-21)
- */
- Buffer += 4;
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressTranslationOffset, Buffer);
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_ADDRESS64,
+ sizeof (AML_RESOURCE_ADDRESS64),
+ 0},
- /*
- * Get AddressLength (Bytes 22-25)
- */
- Buffer += 4;
- ACPI_MOVE_32_TO_32 (&OutputStruct->Data.Address32.AddressLength, Buffer);
+ /* Resource Type, General Flags, and Type-Specific Flags */
- /*
- * Resource Source Index (if present)
- */
- Buffer += 4;
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
/*
- * This will leave us pointing to the Resource Source Index
- * If it is present, then save it off and calculate the
- * pointer to where the null terminated string goes:
- *
- * Note: Some resource descriptors will have an additional null, so
- * we add 1 to the length.
+ * These fields are contiguous in both the source and destination:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
*/
- if (*BytesConsumed > (26 + 1))
- {
- /* Dereference the Index */
-
- Temp8 = *Buffer;
- OutputStruct->Data.Address32.ResourceSource.Index =
- (UINT32) Temp8;
-
- /* Point to the String */
+ {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.Address64.Granularity),
+ AML_OFFSET (Address64.Granularity),
+ 5},
- Buffer += 1;
+ /* Optional ResourceSource (Index and String) */
- /* Point the String pointer to the end of this structure */
-
- OutputStruct->Data.Address32.ResourceSource.StringPtr =
- (char *)((UINT8 *)OutputStruct + StructSize);
-
- TempPtr = (UINT8 *) OutputStruct->Data.Address32.ResourceSource.StringPtr;
-
- /* Copy the string into the buffer */
-
- Index = 0;
- while (0x00 != *Buffer)
- {
- *TempPtr = *Buffer;
-
- TempPtr += 1;
- Buffer += 1;
- Index += 1;
- }
-
- /*
- * Add the terminating null
- */
- *TempPtr = 0x00;
- OutputStruct->Data.Address32.ResourceSource.StringLength = Index + 1;
-
- /*
- * In order for the StructSize to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * StructSize to the next 32-bit boundary.
- */
- Temp8 = (UINT8) (Index + 1);
- StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
- }
- else
- {
- OutputStruct->Data.Address32.ResourceSource.Index = 0x00;
- OutputStruct->Data.Address32.ResourceSource.StringLength = 0;
- OutputStruct->Data.Address32.ResourceSource.StringPtr = NULL;
- }
-
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_SOURCE, ACPI_RS_OFFSET (Data.Address64.ResourceSource),
+ 0,
+ sizeof (AML_RESOURCE_ADDRESS64)}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsAddress32Stream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsConvertExtAddress64 - All Extended (64-bit) address resources
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsAddress32Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[5] =
{
- UINT8 *Buffer;
- UINT16 *LengthField;
- UINT8 Temp8;
- char *TempPointer;
-
-
- ACPI_FUNCTION_TRACE ("RsAddress32Stream");
-
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64,
+ ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_ADDRESS64),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtAddress64)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64,
+ sizeof (AML_RESOURCE_EXTENDED_ADDRESS64),
+ 0},
+
+ /* Resource Type, General Flags, and Type-Specific Flags */
+
+ {ACPI_RSC_ADDRESS, 0, 0, 0},
+
+ /* Revision ID */
+
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.ExtAddress64.RevisionID),
+ AML_OFFSET (ExtAddress64.RevisionID),
+ 1},
+ /*
+ * These fields are contiguous in both the source and destination:
+ * Address Granularity
+ * Address Range Minimum
+ * Address Range Maximum
+ * Address Translation Offset
+ * Address Length
+ * Type-Specific Attribute
+ */
+ {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.ExtAddress64.Granularity),
+ AML_OFFSET (ExtAddress64.Granularity),
+ 6}
+};
- Buffer = *OutputBuffer;
- /*
- * The descriptor field is static
- */
- *Buffer = 0x87;
- Buffer += 1;
-
- /*
- * Set a pointer to the Length field - to be filled in later
- */
- LengthField = ACPI_CAST_PTR (UINT16, Buffer);
- Buffer += 2;
+/*******************************************************************************
+ *
+ * AcpiRsConvertGeneralFlags - Flags common to all address descriptors
+ *
+ ******************************************************************************/
- /*
- * Set the Resource Type (Memory, Io, BusNumber)
- */
- Temp8 = (UINT8) (LinkedList->Data.Address32.ResourceType & 0x03);
+static ACPI_RSCONVERT_INFO AcpiRsConvertGeneralFlags[6] =
+{
+ {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.Flags),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertGeneralFlags)},
- *Buffer = Temp8;
- Buffer += 1;
+ /* Resource Type (Memory, Io, BusNumber, etc.) */
- /*
- * Set the general flags
- */
- Temp8 = (UINT8) (LinkedList->Data.Address32.ProducerConsumer & 0x01);
- Temp8 |= (LinkedList->Data.Address32.Decode & 0x01) << 1;
- Temp8 |= (LinkedList->Data.Address32.MinAddressFixed & 0x01) << 2;
- Temp8 |= (LinkedList->Data.Address32.MaxAddressFixed & 0x01) << 3;
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Address.ResourceType),
+ AML_OFFSET (Address.ResourceType),
+ 1},
- *Buffer = Temp8;
- Buffer += 1;
+ /* General Flags - Consume, Decode, MinFixed, MaxFixed */
- /*
- * Set the type specific flags
- */
- Temp8 = 0;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.ProducerConsumer),
+ AML_OFFSET (Address.Flags),
+ 0},
- if (ACPI_MEMORY_RANGE == LinkedList->Data.Address32.ResourceType)
- {
- Temp8 = (UINT8)
- (LinkedList->Data.Address32.Attribute.Memory.ReadWriteAttribute &
- 0x01);
-
- Temp8 |=
- (LinkedList->Data.Address32.Attribute.Memory.CacheAttribute &
- 0x03) << 1;
- }
- else if (ACPI_IO_RANGE == LinkedList->Data.Address32.ResourceType)
- {
- Temp8 = (UINT8)
- (LinkedList->Data.Address32.Attribute.Io.RangeAttribute &
- 0x03);
- Temp8 |=
- (LinkedList->Data.Address32.Attribute.Io.TranslationAttribute &
- 0x03) << 4;
- }
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Decode),
+ AML_OFFSET (Address.Flags),
+ 1},
- *Buffer = Temp8;
- Buffer += 1;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MinAddressFixed),
+ AML_OFFSET (Address.Flags),
+ 2},
- /*
- * Set the address space granularity
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.Granularity);
- Buffer += 4;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.MaxAddressFixed),
+ AML_OFFSET (Address.Flags),
+ 3}
+};
- /*
- * Set the address range minimum
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MinAddressRange);
- Buffer += 4;
- /*
- * Set the address range maximum
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.MaxAddressRange);
- Buffer += 4;
+/*******************************************************************************
+ *
+ * AcpiRsConvertMemFlags - Flags common to Memory address descriptors
+ *
+ ******************************************************************************/
- /*
- * Set the address translation offset
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressTranslationOffset);
- Buffer += 4;
+static ACPI_RSCONVERT_INFO AcpiRsConvertMemFlags[5] =
+{
+ {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertMemFlags)},
- /*
- * Set the address length
- */
- ACPI_MOVE_32_TO_32 (Buffer, &LinkedList->Data.Address32.AddressLength);
- Buffer += 4;
+ /* Memory-specific flags */
- /*
- * Resource Source Index and Resource Source are optional
- */
- if (0 != LinkedList->Data.Address32.ResourceSource.StringLength)
- {
- Temp8 = (UINT8) LinkedList->Data.Address32.ResourceSource.Index;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.WriteProtect),
+ AML_OFFSET (Address.SpecificFlags),
+ 0},
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Caching),
+ AML_OFFSET (Address.SpecificFlags),
+ 1},
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.RangeType),
+ AML_OFFSET (Address.SpecificFlags),
+ 3},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Mem.Translation),
+ AML_OFFSET (Address.SpecificFlags),
+ 5}
+};
- *Buffer = Temp8;
- Buffer += 1;
- TempPointer = (char *) Buffer;
+/*******************************************************************************
+ *
+ * AcpiRsConvertIoFlags - Flags common to I/O address descriptors
+ *
+ ******************************************************************************/
- /*
- * Copy the string
- */
- ACPI_STRCPY (TempPointer,
- LinkedList->Data.Address32.ResourceSource.StringPtr);
-
- /*
- * Buffer needs to be set to the length of the sting + one for the
- * terminating null
- */
- Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address32.ResourceSource.StringPtr) + 1);
- }
+static ACPI_RSCONVERT_INFO AcpiRsConvertIoFlags[4] =
+{
+ {ACPI_RSC_FLAGINIT, 0, AML_OFFSET (Address.SpecificFlags),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertIoFlags)},
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+ /* I/O-specific flags */
- /*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
- */
- *LengthField = (UINT16) (*BytesConsumed - 3);
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.RangeType),
+ AML_OFFSET (Address.SpecificFlags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.Translation),
+ AML_OFFSET (Address.SpecificFlags),
+ 4},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Address.Info.Io.TranslationType),
+ AML_OFFSET (Address.SpecificFlags),
+ 5}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsAddress64Resource
+ * FUNCTION: AcpiRsGetAddressCommon
+ *
+ * PARAMETERS: Resource - Pointer to the internal resource struct
+ * Aml - Pointer to the AML resource descriptor
+ *
+ * RETURN: TRUE if the ResourceType field is OK, FALSE otherwise
*
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert common flag fields from a raw AML resource descriptor
+ * to an internal resource descriptor
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsAddress64Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+BOOLEAN
+AcpiRsGetAddressCommon (
+ ACPI_RESOURCE *Resource,
+ AML_RESOURCE *Aml)
{
- UINT8 *Buffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16;
- UINT8 Temp8;
- UINT8 *TempPtr;
- ACPI_SIZE StructSize;
- UINT32 Index;
-
-
- ACPI_FUNCTION_TRACE ("RsAddress64Resource");
-
+ ACPI_FUNCTION_ENTRY ();
- Buffer = ByteStreamBuffer;
- StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64);
- /*
- * Point past the Descriptor to get the number of bytes consumed
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- /* Validate minimum descriptor length */
+ /* Validate the Resource Type */
- if (Temp16 < 43)
+ if ((Aml->Address.ResourceType > 2) && (Aml->Address.ResourceType < 0xC0))
{
- return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+ return (FALSE);
}
- *BytesConsumed = Temp16 + 3;
- OutputStruct->Id = ACPI_RSTYPE_ADDRESS64;
+ /* Get the Resource Type and General Flags */
- /*
- * Get the Resource Type (Byte3)
- */
- Buffer += 2;
- Temp8 = *Buffer;
+ (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertGeneralFlags);
- /* Values 0-2 are valid */
+ /* Get the Type-Specific Flags (Memory and I/O descriptors only) */
- if(Temp8 > 2)
+ if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
{
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertMemFlags);
}
-
- OutputStruct->Data.Address64.ResourceType = Temp8 & 0x03;
-
- /*
- * Get the General Flags (Byte4)
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- /*
- * Producer / Consumer
- */
- OutputStruct->Data.Address64.ProducerConsumer = Temp8 & 0x01;
-
- /*
- * Decode
- */
- OutputStruct->Data.Address64.Decode = (Temp8 >> 1) & 0x01;
-
- /*
- * Min Address Fixed
- */
- OutputStruct->Data.Address64.MinAddressFixed = (Temp8 >> 2) & 0x01;
-
- /*
- * Max Address Fixed
- */
- OutputStruct->Data.Address64.MaxAddressFixed = (Temp8 >> 3) & 0x01;
-
- /*
- * Get the Type Specific Flags (Byte5)
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- if (ACPI_MEMORY_RANGE == OutputStruct->Data.Address64.ResourceType)
+ else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
{
- OutputStruct->Data.Address64.Attribute.Memory.ReadWriteAttribute =
- (UINT16) (Temp8 & 0x01);
-
- OutputStruct->Data.Address64.Attribute.Memory.CacheAttribute =
- (UINT16) ((Temp8 >> 1) & 0x03);
+ (void) AcpiRsConvertAmlToResource (Resource, Aml, AcpiRsConvertIoFlags);
}
else
{
- if (ACPI_IO_RANGE == OutputStruct->Data.Address64.ResourceType)
- {
- OutputStruct->Data.Address64.Attribute.Io.RangeAttribute =
- (UINT16) (Temp8 & 0x03);
- OutputStruct->Data.Address64.Attribute.Io.TranslationAttribute =
- (UINT16) ((Temp8 >> 4) & 0x03);
- }
- else
- {
- /* BUS_NUMBER_RANGE == OutputStruct->Data.Address64.ResourceType */
- /* Nothing needs to be filled in */
- }
- }
-
- /*
- * Get Granularity (Bytes 6-13)
- */
- Buffer += 1;
- ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.Granularity, Buffer);
-
- /*
- * Get MinAddressRange (Bytes 14-21)
- */
- Buffer += 8;
- ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MinAddressRange, Buffer);
-
- /*
- * Get MaxAddressRange (Bytes 22-29)
- */
- Buffer += 8;
- ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.MaxAddressRange, Buffer);
-
- /*
- * Get AddressTranslationOffset (Bytes 30-37)
- */
- Buffer += 8;
- ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressTranslationOffset, Buffer);
-
- /*
- * Get AddressLength (Bytes 38-45)
- */
- Buffer += 8;
- ACPI_MOVE_64_TO_64 (&OutputStruct->Data.Address64.AddressLength, Buffer);
-
- /*
- * Resource Source Index (if present)
- */
- Buffer += 8;
-
- /*
- * This will leave us pointing to the Resource Source Index
- * If it is present, then save it off and calculate the
- * pointer to where the null terminated string goes:
- * Each Interrupt takes 32-bits + the 5 bytes of the
- * stream that are default.
- *
- * Note: Some resource descriptors will have an additional null, so
- * we add 1 to the length.
- */
- if (*BytesConsumed > (46 + 1))
- {
- /* Dereference the Index */
-
- Temp8 = *Buffer;
- OutputStruct->Data.Address64.ResourceSource.Index =
- (UINT32) Temp8;
-
- /* Point to the String */
-
- Buffer += 1;
-
- /* Point the String pointer to the end of this structure */
-
- OutputStruct->Data.Address64.ResourceSource.StringPtr =
- (char *)((UINT8 *)OutputStruct + StructSize);
+ /* Generic resource type, just grab the TypeSpecific byte */
- TempPtr = (UINT8 *) OutputStruct->Data.Address64.ResourceSource.StringPtr;
-
- /* Copy the string into the buffer */
-
- Index = 0;
- while (0x00 != *Buffer)
- {
- *TempPtr = *Buffer;
-
- TempPtr += 1;
- Buffer += 1;
- Index += 1;
- }
-
- /*
- * Add the terminating null
- */
- *TempPtr = 0x00;
- OutputStruct->Data.Address64.ResourceSource.StringLength = Index + 1;
-
- /*
- * In order for the StructSize to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * StructSize to the next 32-bit boundary.
- */
- Temp8 = (UINT8) (Index + 1);
- StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
- }
- else
- {
- OutputStruct->Data.Address64.ResourceSource.Index = 0x00;
- OutputStruct->Data.Address64.ResourceSource.StringLength = 0;
- OutputStruct->Data.Address64.ResourceSource.StringPtr = NULL;
+ Resource->Data.Address.Info.TypeSpecific = Aml->Address.SpecificFlags;
}
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
+ return (TRUE);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsAddress64Stream
+ * FUNCTION: AcpiRsSetAddressCommon
*
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
+ * PARAMETERS: Aml - Pointer to the AML resource descriptor
+ * Resource - Pointer to the internal resource struct
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert common flag fields from a resource descriptor to an
+ * AML descriptor
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsAddress64Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+void
+AcpiRsSetAddressCommon (
+ AML_RESOURCE *Aml,
+ ACPI_RESOURCE *Resource)
{
- UINT8 *Buffer;
- UINT16 *LengthField;
- UINT8 Temp8;
- char *TempPointer;
-
-
- ACPI_FUNCTION_TRACE ("RsAddress64Stream");
-
-
- Buffer = *OutputBuffer;
-
- /*
- * The descriptor field is static
- */
- *Buffer = 0x8A;
- Buffer += 1;
-
- /*
- * Set a pointer to the Length field - to be filled in later
- */
- LengthField = ACPI_CAST_PTR (UINT16, Buffer);
- Buffer += 2;
-
- /*
- * Set the Resource Type (Memory, Io, BusNumber)
- */
- Temp8 = (UINT8) (LinkedList->Data.Address64.ResourceType & 0x03);
+ ACPI_FUNCTION_ENTRY ();
- *Buffer = Temp8;
- Buffer += 1;
- /*
- * Set the general flags
- */
- Temp8 = (UINT8) (LinkedList->Data.Address64.ProducerConsumer & 0x01);
- Temp8 |= (LinkedList->Data.Address64.Decode & 0x01) << 1;
- Temp8 |= (LinkedList->Data.Address64.MinAddressFixed & 0x01) << 2;
- Temp8 |= (LinkedList->Data.Address64.MaxAddressFixed & 0x01) << 3;
+ /* Set the Resource Type and General Flags */
- *Buffer = Temp8;
- Buffer += 1;
+ (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertGeneralFlags);
- /*
- * Set the type specific flags
- */
- Temp8 = 0;
+ /* Set the Type-Specific Flags (Memory and I/O descriptors only) */
- if (ACPI_MEMORY_RANGE == LinkedList->Data.Address64.ResourceType)
+ if (Resource->Data.Address.ResourceType == ACPI_MEMORY_RANGE)
{
- Temp8 = (UINT8)
- (LinkedList->Data.Address64.Attribute.Memory.ReadWriteAttribute &
- 0x01);
-
- Temp8 |=
- (LinkedList->Data.Address64.Attribute.Memory.CacheAttribute &
- 0x03) << 1;
+ (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertMemFlags);
}
- else if (ACPI_IO_RANGE == LinkedList->Data.Address64.ResourceType)
+ else if (Resource->Data.Address.ResourceType == ACPI_IO_RANGE)
{
- Temp8 = (UINT8)
- (LinkedList->Data.Address64.Attribute.Io.RangeAttribute &
- 0x03);
- Temp8 |=
- (LinkedList->Data.Address64.Attribute.Io.RangeAttribute &
- 0x03) << 4;
+ (void) AcpiRsConvertResourceToAml (Resource, Aml, AcpiRsConvertIoFlags);
}
-
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the address space granularity
- */
- ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.Granularity);
- Buffer += 8;
-
- /*
- * Set the address range minimum
- */
- ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MinAddressRange);
- Buffer += 8;
-
- /*
- * Set the address range maximum
- */
- ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.MaxAddressRange);
- Buffer += 8;
-
- /*
- * Set the address translation offset
- */
- ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressTranslationOffset);
- Buffer += 8;
-
- /*
- * Set the address length
- */
- ACPI_MOVE_64_TO_64 (Buffer, &LinkedList->Data.Address64.AddressLength);
- Buffer += 8;
-
- /*
- * Resource Source Index and Resource Source are optional
- */
- if (0 != LinkedList->Data.Address64.ResourceSource.StringLength)
+ else
{
- Temp8 = (UINT8) LinkedList->Data.Address64.ResourceSource.Index;
-
- *Buffer = Temp8;
- Buffer += 1;
+ /* Generic resource type, just copy the TypeSpecific byte */
- TempPointer = (char *) Buffer;
-
- /*
- * Copy the string
- */
- ACPI_STRCPY (TempPointer, LinkedList->Data.Address64.ResourceSource.StringPtr);
-
- /*
- * Buffer needs to be set to the length of the sting + one for the
- * terminating null
- */
- Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.Address64.ResourceSource.StringPtr) + 1);
+ Aml->Address.SpecificFlags = Resource->Data.Address.Info.TypeSpecific;
}
-
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
-
- /*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
- */
- *LengthField = (UINT16) (*BytesConsumed - 3);
- return_ACPI_STATUS (AE_OK);
}
+
Index: rsmisc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsmisc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsmisc.c -L sys/contrib/dev/acpica/rsmisc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsmisc.c
+++ sys/contrib/dev/acpica/rsmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsmisc - Miscellaneous resource descriptors
- * $Revision: 27 $
+ * $Revision: 1.46 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,561 +123,549 @@
ACPI_MODULE_NAME ("rsmisc")
+#define INIT_RESOURCE_TYPE(i) i->ResourceOffset
+#define INIT_RESOURCE_LENGTH(i) i->AmlOffset
+#define INIT_TABLE_LENGTH(i) i->Value
+
+#define COMPARE_OPCODE(i) i->ResourceOffset
+#define COMPARE_TARGET(i) i->AmlOffset
+#define COMPARE_VALUE(i) i->Value
+
+
/*******************************************************************************
*
- * FUNCTION: AcpiRsEndTagResource
+ * FUNCTION: AcpiRsConvertAmlToResource
*
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
+ * Info - Pointer to appropriate conversion table
*
* RETURN: Status
*
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * DESCRIPTION: Convert an external AML resource descriptor to the corresponding
+ * internal resource descriptor
*
******************************************************************************/
ACPI_STATUS
-AcpiRsEndTagResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+AcpiRsConvertAmlToResource (
+ ACPI_RESOURCE *Resource,
+ AML_RESOURCE *Aml,
+ ACPI_RSCONVERT_INFO *Info)
{
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH;
+ ACPI_RS_LENGTH AmlResourceLength;
+ void *Source;
+ void *Destination;
+ char *Target;
+ UINT8 Count;
+ UINT8 FlagsMode = FALSE;
+ UINT16 ItemCount = 0;
+ UINT16 Temp16 = 0;
- ACPI_FUNCTION_TRACE ("RsEndTagResource");
+ ACPI_FUNCTION_TRACE (RsConvertAmlToResource);
- /*
- * The number of bytes consumed is static
- */
- *BytesConsumed = 2;
+ if (((ACPI_NATIVE_UINT) Resource) & 0x3)
+ {
+ /* Each internal resource struct is expected to be 32-bit aligned */
- /*
- * Fill out the structure
- */
- OutputStruct->Id = ACPI_RSTYPE_END_TAG;
+ ACPI_WARNING ((AE_INFO,
+ "Misaligned resource pointer (get): %p Type %2.2X Len %X",
+ Resource, Resource->Type, Resource->Length));
+ }
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = 0;
+ /* Extract the resource Length field (does not include header length) */
+
+ AmlResourceLength = AcpiUtGetResourceLength (Aml);
/*
- * Return the final size of the structure
+ * First table entry must be ACPI_RSC_INITxxx and must contain the
+ * table length (# of table entries)
*/
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ Count = INIT_TABLE_LENGTH (Info);
+ while (Count)
+ {
+ /*
+ * Source is the external AML byte stream buffer,
+ * destination is the internal resource descriptor
+ */
+ Source = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
+ Destination = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsEndTagStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
- *
- ******************************************************************************/
+ switch (Info->Opcode)
+ {
+ case ACPI_RSC_INITGET:
+ /*
+ * Get the resource type and the initial (minimum) length
+ */
+ ACPI_MEMSET (Resource, 0, INIT_RESOURCE_LENGTH (Info));
+ Resource->Type = INIT_RESOURCE_TYPE (Info);
+ Resource->Length = INIT_RESOURCE_LENGTH (Info);
+ break;
-ACPI_STATUS
-AcpiRsEndTagStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
-{
- UINT8 *Buffer = *OutputBuffer;
- UINT8 Temp8 = 0;
+ case ACPI_RSC_INITSET:
+ break;
- ACPI_FUNCTION_TRACE ("RsEndTagStream");
+ case ACPI_RSC_FLAGINIT:
- /*
- * The descriptor field is static
- */
- *Buffer = 0x79;
- Buffer += 1;
+ FlagsMode = TRUE;
+ break;
- /*
- * Set the Checksum - zero means that the resource data is treated as if
- * the checksum operation succeeded (ACPI Spec 1.0b Section 6.4.2.8)
- */
- Temp8 = 0;
- *Buffer = Temp8;
- Buffer += 1;
+ case ACPI_RSC_1BITFLAG:
+ /*
+ * Mask and shift the flag bit
+ */
+ ACPI_SET8 (Destination) = (UINT8)
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x01);
+ break;
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
+ case ACPI_RSC_2BITFLAG:
+ /*
+ * Mask and shift the flag bits
+ */
+ ACPI_SET8 (Destination) = (UINT8)
+ ((ACPI_GET8 (Source) >> Info->Value) & 0x03);
+ break;
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsVendorResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
- *
- ******************************************************************************/
-ACPI_STATUS
-AcpiRsVendorResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
-{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- UINT8 Index;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR);
+ case ACPI_RSC_COUNT:
+ ItemCount = ACPI_GET8 (Source);
+ ACPI_SET8 (Destination) = (UINT8) ItemCount;
- ACPI_FUNCTION_TRACE ("RsVendorResource");
+ Resource->Length = Resource->Length +
+ (Info->Value * (ItemCount - 1));
+ break;
- /*
- * Dereference the Descriptor to find if this is a large or small item.
- */
- Temp8 = *Buffer;
+ case ACPI_RSC_COUNT16:
- if (Temp8 & 0x80)
- {
- /*
- * Large Item, point to the length field
- */
- Buffer += 1;
+ ItemCount = AmlResourceLength;
+ ACPI_SET16 (Destination) = ItemCount;
- /* Dereference */
+ Resource->Length = Resource->Length +
+ (Info->Value * (ItemCount - 1));
+ break;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- /* Calculate bytes consumed */
+ case ACPI_RSC_LENGTH:
- *BytesConsumed = (ACPI_SIZE) Temp16 + 3;
+ Resource->Length = Resource->Length + Info->Value;
+ break;
- /* Point to the first vendor byte */
- Buffer += 2;
- }
- else
- {
- /*
- * Small Item, dereference the size
- */
- Temp16 = (UINT8)(*Buffer & 0x07);
+ case ACPI_RSC_MOVE8:
+ case ACPI_RSC_MOVE16:
+ case ACPI_RSC_MOVE32:
+ case ACPI_RSC_MOVE64:
+ /*
+ * Raw data move. Use the Info value field unless ItemCount has
+ * been previously initialized via a COUNT opcode
+ */
+ if (Info->Value)
+ {
+ ItemCount = Info->Value;
+ }
+ AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
+ break;
- /* Calculate bytes consumed */
- *BytesConsumed = (ACPI_SIZE) Temp16 + 1;
+ case ACPI_RSC_SET8:
- /* Point to the first vendor byte */
+ ACPI_MEMSET (Destination, Info->AmlOffset, Info->Value);
+ break;
- Buffer += 1;
- }
- OutputStruct->Id = ACPI_RSTYPE_VENDOR;
- OutputStruct->Data.VendorSpecific.Length = Temp16;
+ case ACPI_RSC_DATA8:
- for (Index = 0; Index < Temp16; Index++)
- {
- OutputStruct->Data.VendorSpecific.Reserved[Index] = *Buffer;
- Buffer += 1;
- }
+ Target = ACPI_ADD_PTR (char, Resource, Info->Value);
+ ACPI_MEMCPY (Destination, Source, ACPI_GET16 (Target));
+ break;
- /*
- * In order for the StructSize to fall on a 32-bit boundary,
- * calculate the length of the vendor string and expand the
- * StructSize to the next 32-bit boundary.
- */
- StructSize += ACPI_ROUND_UP_TO_32BITS (Temp16);
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
+ case ACPI_RSC_ADDRESS:
+ /*
+ * Common handler for address descriptor flags
+ */
+ if (!AcpiRsGetAddressCommon (Resource, Aml))
+ {
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ }
+ break;
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
+
+ case ACPI_RSC_SOURCE:
+ /*
+ * Optional ResourceSource (Index and String)
+ */
+ Resource->Length +=
+ AcpiRsGetResourceSource (AmlResourceLength, Info->Value,
+ Destination, Aml, NULL);
+ break;
+
+
+ case ACPI_RSC_SOURCEX:
+ /*
+ * Optional ResourceSource (Index and String). This is the more
+ * complicated case used by the Interrupt() macro
+ */
+ Target = ACPI_ADD_PTR (char, Resource, Info->AmlOffset + (ItemCount * 4));
+
+ Resource->Length +=
+ AcpiRsGetResourceSource (AmlResourceLength,
+ (ACPI_RS_LENGTH) (((ItemCount - 1) * sizeof (UINT32)) + Info->Value),
+ Destination, Aml, Target);
+ break;
+
+
+ case ACPI_RSC_BITMASK:
+ /*
+ * 8-bit encoded bitmask (DMA macro)
+ */
+ ItemCount = AcpiRsDecodeBitmask (ACPI_GET8 (Source), Destination);
+ if (ItemCount)
+ {
+ Resource->Length += (ItemCount - 1);
+ }
+
+ Target = ACPI_ADD_PTR (char, Resource, Info->Value);
+ ACPI_SET8 (Target) = (UINT8) ItemCount;
+ break;
+
+
+ case ACPI_RSC_BITMASK16:
+ /*
+ * 16-bit encoded bitmask (IRQ macro)
+ */
+ ACPI_MOVE_16_TO_16 (&Temp16, Source);
+
+ ItemCount = AcpiRsDecodeBitmask (Temp16, Destination);
+ if (ItemCount)
+ {
+ Resource->Length += (ItemCount - 1);
+ }
+
+ Target = ACPI_ADD_PTR (char, Resource, Info->Value);
+ ACPI_SET8 (Target) = (UINT8) ItemCount;
+ break;
+
+
+ case ACPI_RSC_EXIT_NE:
+ /*
+ * Control - Exit conversion if not equal
+ */
+ switch (Info->ResourceOffset)
+ {
+ case ACPI_RSC_COMPARE_AML_LENGTH:
+ if (AmlResourceLength != Info->Value)
+ {
+ goto Exit;
+ }
+ break;
+
+ case ACPI_RSC_COMPARE_VALUE:
+ if (ACPI_GET8 (Source) != Info->Value)
+ {
+ goto Exit;
+ }
+ break;
+
+ default:
+
+ ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+ break;
+
+
+ default:
+
+ ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Count--;
+ Info++;
+ }
+
+Exit:
+ if (!FlagsMode)
+ {
+ /* Round the resource struct length up to the next boundary (32 or 64) */
+
+ Resource->Length = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (Resource->Length);
+ }
return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsVendorStream
+ * FUNCTION: AcpiRsConvertResourceToAml
*
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Aml - Where the AML descriptor is returned
+ * Info - Pointer to appropriate conversion table
*
* RETURN: Status
*
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * DESCRIPTION: Convert an internal resource descriptor to the corresponding
+ * external AML resource descriptor.
*
******************************************************************************/
ACPI_STATUS
-AcpiRsVendorStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+AcpiRsConvertResourceToAml (
+ ACPI_RESOURCE *Resource,
+ AML_RESOURCE *Aml,
+ ACPI_RSCONVERT_INFO *Info)
{
- UINT8 *Buffer = *OutputBuffer;
+ void *Source = NULL;
+ void *Destination;
+ ACPI_RSDESC_SIZE AmlLength = 0;
+ UINT8 Count;
UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- UINT8 Index;
+ UINT16 ItemCount = 0;
- ACPI_FUNCTION_TRACE ("RsVendorStream");
+ ACPI_FUNCTION_TRACE (RsConvertResourceToAml);
/*
- * Dereference the length to find if this is a large or small item.
+ * First table entry must be ACPI_RSC_INITxxx and must contain the
+ * table length (# of table entries)
*/
- if(LinkedList->Data.VendorSpecific.Length > 7)
+ Count = INIT_TABLE_LENGTH (Info);
+
+ while (Count)
{
/*
- * Large Item, Set the descriptor field and length bytes
+ * Source is the internal resource descriptor,
+ * destination is the external AML byte stream buffer
*/
- *Buffer = 0x84;
- Buffer += 1;
+ Source = ACPI_ADD_PTR (void, Resource, Info->ResourceOffset);
+ Destination = ACPI_ADD_PTR (void, Aml, Info->AmlOffset);
- Temp16 = (UINT16) LinkedList->Data.VendorSpecific.Length;
+ switch (Info->Opcode)
+ {
+ case ACPI_RSC_INITSET:
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
- }
- else
- {
- /*
- * Small Item, Set the descriptor field
- */
- Temp8 = 0x70;
- Temp8 |= (UINT8) LinkedList->Data.VendorSpecific.Length;
+ ACPI_MEMSET (Aml, 0, INIT_RESOURCE_LENGTH (Info));
+ AmlLength = INIT_RESOURCE_LENGTH (Info);
+ AcpiRsSetResourceHeader (INIT_RESOURCE_TYPE (Info), AmlLength, Aml);
+ break;
- *Buffer = Temp8;
- Buffer += 1;
- }
- /*
- * Loop through all of the Vendor Specific fields
- */
- for (Index = 0; Index < LinkedList->Data.VendorSpecific.Length; Index++)
- {
- Temp8 = LinkedList->Data.VendorSpecific.Reserved[Index];
+ case ACPI_RSC_INITGET:
+ break;
- *Buffer = Temp8;
- Buffer += 1;
- }
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
+ case ACPI_RSC_FLAGINIT:
+ /*
+ * Clear the flag byte
+ */
+ ACPI_SET8 (Destination) = 0;
+ break;
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsStartDependFnsResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
- *
- ******************************************************************************/
+ case ACPI_RSC_1BITFLAG:
+ /*
+ * Mask and shift the flag bit
+ */
+ ACPI_SET8 (Destination) |= (UINT8)
+ ((ACPI_GET8 (Source) & 0x01) << Info->Value);
+ break;
-ACPI_STATUS
-AcpiRsStartDependFnsResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
-{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT8 Temp8 = 0;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+ case ACPI_RSC_2BITFLAG:
+ /*
+ * Mask and shift the flag bits
+ */
+ ACPI_SET8 (Destination) |= (UINT8)
+ ((ACPI_GET8 (Source) & 0x03) << Info->Value);
+ break;
- ACPI_FUNCTION_TRACE ("RsStartDependFnsResource");
+ case ACPI_RSC_COUNT:
- /*
- * The number of bytes consumed are contained in the descriptor (Bits:0-1)
- */
- Temp8 = *Buffer;
+ ItemCount = ACPI_GET8 (Source);
+ ACPI_SET8 (Destination) = (UINT8) ItemCount;
- *BytesConsumed = (Temp8 & 0x01) + 1;
+ AmlLength = (UINT16) (AmlLength + (Info->Value * (ItemCount - 1)));
+ break;
- OutputStruct->Id = ACPI_RSTYPE_START_DPF;
- /*
- * Point to Byte 1 if it is used
- */
- if (2 == *BytesConsumed)
- {
- Buffer += 1;
- Temp8 = *Buffer;
+ case ACPI_RSC_COUNT16:
- /*
- * Check Compatibility priority
- */
- OutputStruct->Data.StartDpf.CompatibilityPriority = Temp8 & 0x03;
+ ItemCount = ACPI_GET16 (Source);
+ AmlLength = (UINT16) (AmlLength + ItemCount);
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
- if (3 == OutputStruct->Data.StartDpf.CompatibilityPriority)
- {
- return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
- }
- /*
- * Check Performance/Robustness preference
- */
- OutputStruct->Data.StartDpf.PerformanceRobustness = (Temp8 >> 2) & 0x03;
+ case ACPI_RSC_LENGTH:
- if (3 == OutputStruct->Data.StartDpf.PerformanceRobustness)
- {
- return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
- }
- }
- else
- {
- OutputStruct->Data.StartDpf.CompatibilityPriority =
- ACPI_ACCEPTABLE_CONFIGURATION;
+ AcpiRsSetResourceLength (Info->Value, Aml);
+ break;
- OutputStruct->Data.StartDpf.PerformanceRobustness =
- ACPI_ACCEPTABLE_CONFIGURATION;
- }
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
+ case ACPI_RSC_MOVE8:
+ case ACPI_RSC_MOVE16:
+ case ACPI_RSC_MOVE32:
+ case ACPI_RSC_MOVE64:
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ if (Info->Value)
+ {
+ ItemCount = Info->Value;
+ }
+ AcpiRsMoveData (Destination, Source, ItemCount, Info->Opcode);
+ break;
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsEndDependFnsResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
- *
- ******************************************************************************/
+ case ACPI_RSC_ADDRESS:
-ACPI_STATUS
-AcpiRsEndDependFnsResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
-{
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- ACPI_SIZE StructSize = ACPI_RESOURCE_LENGTH;
+ /* Set the Resource Type, General Flags, and Type-Specific Flags */
+ AcpiRsSetAddressCommon (Aml, Resource);
+ break;
- ACPI_FUNCTION_TRACE ("RsEndDependFnsResource");
+ case ACPI_RSC_SOURCEX:
+ /*
+ * Optional ResourceSource (Index and String)
+ */
+ AmlLength = AcpiRsSetResourceSource (
+ Aml, (ACPI_RS_LENGTH) AmlLength, Source);
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
- /*
- * The number of bytes consumed is static
- */
- *BytesConsumed = 1;
- /*
- * Fill out the structure
- */
- OutputStruct->Id = ACPI_RSTYPE_END_DPF;
+ case ACPI_RSC_SOURCE:
+ /*
+ * Optional ResourceSource (Index and String). This is the more
+ * complicated case used by the Interrupt() macro
+ */
+ AmlLength = AcpiRsSetResourceSource (Aml, Info->Value, Source);
+ AcpiRsSetResourceLength (AmlLength, Aml);
+ break;
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ case ACPI_RSC_BITMASK:
+ /*
+ * 8-bit encoded bitmask (DMA macro)
+ */
+ ACPI_SET8 (Destination) = (UINT8)
+ AcpiRsEncodeBitmask (Source,
+ *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
+ break;
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsStartDependFnsStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - UINT32 pointer that is filled with
- * the number of bytes of the
- * OutputBuffer used
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
- *
- ******************************************************************************/
+ case ACPI_RSC_BITMASK16:
+ /*
+ * 16-bit encoded bitmask (IRQ macro)
+ */
+ Temp16 = AcpiRsEncodeBitmask (Source,
+ *ACPI_ADD_PTR (UINT8, Resource, Info->Value));
+ ACPI_MOVE_16_TO_16 (Destination, &Temp16);
+ break;
-ACPI_STATUS
-AcpiRsStartDependFnsStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
-{
- UINT8 *Buffer = *OutputBuffer;
- UINT8 Temp8 = 0;
+ case ACPI_RSC_EXIT_LE:
+ /*
+ * Control - Exit conversion if less than or equal
+ */
+ if (ItemCount <= Info->Value)
+ {
+ goto Exit;
+ }
+ break;
- ACPI_FUNCTION_TRACE ("RsStartDependFnsStream");
+ case ACPI_RSC_EXIT_NE:
+ /*
+ * Control - Exit conversion if not equal
+ */
+ switch (COMPARE_OPCODE (Info))
+ {
+ case ACPI_RSC_COMPARE_VALUE:
- /*
- * The descriptor field is set based upon whether a byte is needed
- * to contain Priority data.
- */
- if (ACPI_ACCEPTABLE_CONFIGURATION ==
- LinkedList->Data.StartDpf.CompatibilityPriority &&
- ACPI_ACCEPTABLE_CONFIGURATION ==
- LinkedList->Data.StartDpf.PerformanceRobustness)
- {
- *Buffer = 0x30;
- }
- else
- {
- *Buffer = 0x31;
- Buffer += 1;
+ if (*ACPI_ADD_PTR (UINT8, Resource,
+ COMPARE_TARGET (Info)) != COMPARE_VALUE (Info))
+ {
+ goto Exit;
+ }
+ break;
- /*
- * Set the Priority Byte Definition
- */
- Temp8 = 0;
- Temp8 = (UINT8) ((LinkedList->Data.StartDpf.PerformanceRobustness &
- 0x03) << 2);
- Temp8 |= (LinkedList->Data.StartDpf.CompatibilityPriority &
- 0x03);
- *Buffer = Temp8;
- }
+ default:
- Buffer += 1;
+ ACPI_ERROR ((AE_INFO, "Invalid conversion sub-opcode"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+ break;
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
+
+ default:
+
+ ACPI_ERROR ((AE_INFO, "Invalid conversion opcode"));
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Count--;
+ Info++;
+ }
+
+Exit:
return_ACPI_STATUS (AE_OK);
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsEndDependFnsStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
- *
- ******************************************************************************/
+#if 0
+/* Previous resource validations */
-ACPI_STATUS
-AcpiRsEndDependFnsStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
-{
- UINT8 *Buffer = *OutputBuffer;
+ if (Aml->ExtAddress64.RevisionID != AML_RESOURCE_EXTENDED_ADDRESS_REVISION)
+ {
+ return_ACPI_STATUS (AE_SUPPORT);
+ }
+
+ if (Resource->Data.StartDpf.PerformanceRobustness >= 3)
+ {
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_VALUE);
+ }
+ if (((Aml->Irq.Flags & 0x09) == 0x00) ||
+ ((Aml->Irq.Flags & 0x09) == 0x09))
+ {
+ /*
+ * Only [ActiveHigh, EdgeSensitive] or [ActiveLow, LevelSensitive]
+ * polarity/trigger interrupts are allowed (ACPI spec, section
+ * "IRQ Format"), so 0x00 and 0x09 are illegal.
+ */
+ ACPI_ERROR ((AE_INFO,
+ "Invalid interrupt polarity/trigger in resource list, %X",
+ Aml->Irq.Flags));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
- ACPI_FUNCTION_TRACE ("RsEndDependFnsStream");
+ Resource->Data.ExtendedIrq.InterruptCount = Temp8;
+ if (Temp8 < 1)
+ {
+ /* Must have at least one IRQ */
+ return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
+ }
- /*
- * The descriptor field is static
- */
- *Buffer = 0x38;
- Buffer += 1;
+ if (Resource->Data.Dma.Transfer == 0x03)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid DMA.Transfer preference (3)"));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
+#endif
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
Index: acapps.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acapps.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acapps.h -L sys/contrib/dev/acpica/acapps.h -u -r1.1.1.1 -r1.2
--- sys/contrib/dev/acpica/acapps.h
+++ sys/contrib/dev/acpica/acapps.h
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,9 @@
#pragma warning(disable:4100) /* warning C4100: unreferenced formal parameter */
#endif
+#define FILE_SUFFIX_DISASSEMBLY "dsl"
+#define ACPI_TABLE_FILE_SUFFIX ".dat"
+
extern UINT8 *DsdtPtr;
extern UINT32 AcpiDsdtLength;
extern UINT8 *AmlStart;
@@ -136,21 +139,9 @@
char **argv,
char *opts);
-ACPI_STATUS
-AdInitialize (
- void);
-
-char *
-FlGenerateFilename (
- char *InputFilename,
- char *Suffix);
-
-ACPI_STATUS
-FlSplitInputPathname (
- char *InputPath,
- char **OutDirectoryPath,
- char **OutFilename);
-
+/*
+ * adisasm
+ */
ACPI_STATUS
AdAmlDisassemble (
BOOLEAN OutToFile,
@@ -187,6 +178,66 @@
ACPI_STATUS
AdDisplayStatistics (void);
+/*
+ * adwalk
+ */
+void
+AcpiDmCrossReferenceNamespace (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot);
+
+void
+AcpiDmDumpTree (
+ ACPI_PARSE_OBJECT *Origin);
+
+void
+AcpiDmFindOrphanMethods (
+ ACPI_PARSE_OBJECT *Origin);
+
+void
+AcpiDmFinishNamespaceLoad (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot);
+
+void
+AcpiDmConvertResourceIndexes (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot);
+
+/*
+ * adfile
+ */
+ACPI_STATUS
+AdInitialize (
+ void);
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix);
+
+ACPI_STATUS
+FlSplitInputPathname (
+ char *InputPath,
+ char **OutDirectoryPath,
+ char **OutFilename);
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix);
+
+char *
+AdGenerateFilename (
+ char *Prefix,
+ char *TableId);
+
+void
+AdWriteTable (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ char *TableName,
+ char *OemTableId);
#endif /* _ACAPPS */
Index: psargs.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/psargs.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/psargs.c -L sys/contrib/dev/acpica/psargs.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/psargs.c
+++ sys/contrib/dev/acpica/psargs.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psargs - Parse AML opcode arguments
- * $Revision: 76 $
+ * $Revision: 1.92 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,10 +120,21 @@
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/amlcode.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acdispat.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psargs")
+/* Local prototypes */
+
+static UINT32
+AcpiPsGetNextPackageLength (
+ ACPI_PARSE_STATE *ParserState);
+
+static ACPI_PARSE_OBJECT *
+AcpiPsGetNextField (
+ ACPI_PARSE_STATE *ParserState);
+
/*******************************************************************************
*
@@ -131,69 +142,55 @@
*
* PARAMETERS: ParserState - Current parser state object
*
- * RETURN: Decoded package length. On completion, the AML pointer points
+ * RETURN: Decoded package length. On completion, the AML pointer points
* past the length byte or bytes.
*
- * DESCRIPTION: Decode and return a package length field
+ * DESCRIPTION: Decode and return a package length field.
+ * Note: Largest package length is 28 bits, from ACPI specification
*
******************************************************************************/
-UINT32
+static UINT32
AcpiPsGetNextPackageLength (
ACPI_PARSE_STATE *ParserState)
{
- UINT32 EncodedLength;
- UINT32 Length = 0;
+ UINT8 *Aml = ParserState->Aml;
+ UINT32 PackageLength = 0;
+ ACPI_NATIVE_UINT ByteCount;
+ UINT8 ByteZeroMask = 0x3F; /* Default [0:5] */
- ACPI_FUNCTION_TRACE ("PsGetNextPackageLength");
+ ACPI_FUNCTION_TRACE (PsGetNextPackageLength);
- EncodedLength = (UINT32) ACPI_GET8 (ParserState->Aml);
- ParserState->Aml++;
+ /*
+ * Byte 0 bits [6:7] contain the number of additional bytes
+ * used to encode the package length, either 0,1,2, or 3
+ */
+ ByteCount = (Aml[0] >> 6);
+ ParserState->Aml += (ByteCount + 1);
+ /* Get bytes 3, 2, 1 as needed */
- switch (EncodedLength >> 6) /* bits 6-7 contain encoding scheme */
+ while (ByteCount)
{
- case 0: /* 1-byte encoding (bits 0-5) */
-
- Length = (EncodedLength & 0x3F);
- break;
-
-
- case 1: /* 2-byte encoding (next byte + bits 0-3) */
-
- Length = ((ACPI_GET8 (ParserState->Aml) << 04) |
- (EncodedLength & 0x0F));
- ParserState->Aml++;
- break;
-
-
- case 2: /* 3-byte encoding (next 2 bytes + bits 0-3) */
-
- Length = ((ACPI_GET8 (ParserState->Aml + 1) << 12) |
- (ACPI_GET8 (ParserState->Aml) << 04) |
- (EncodedLength & 0x0F));
- ParserState->Aml += 2;
- break;
-
-
- case 3: /* 4-byte encoding (next 3 bytes + bits 0-3) */
-
- Length = ((ACPI_GET8 (ParserState->Aml + 2) << 20) |
- (ACPI_GET8 (ParserState->Aml + 1) << 12) |
- (ACPI_GET8 (ParserState->Aml) << 04) |
- (EncodedLength & 0x0F));
- ParserState->Aml += 3;
- break;
-
- default:
+ /*
+ * Final bit positions for the package length bytes:
+ * Byte3->[20:27]
+ * Byte2->[12:19]
+ * Byte1->[04:11]
+ * Byte0->[00:03]
+ */
+ PackageLength |= (Aml[ByteCount] << ((ByteCount << 3) - 4));
- /* Can't get here, only 2 bits / 4 cases */
- break;
+ ByteZeroMask = 0x0F; /* Use bits [0:3] of byte 0 */
+ ByteCount--;
}
- return_VALUE (Length);
+ /* Byte 0 is a special case, either bits [0:3] or [0:5] are used */
+
+ PackageLength |= (Aml[0] & ByteZeroMask);
+ return_UINT32 (PackageLength);
}
@@ -215,17 +212,17 @@
ACPI_PARSE_STATE *ParserState)
{
UINT8 *Start = ParserState->Aml;
- ACPI_NATIVE_UINT Length;
+ UINT32 PackageLength;
- ACPI_FUNCTION_TRACE ("PsGetNextPackageEnd");
+ ACPI_FUNCTION_TRACE (PsGetNextPackageEnd);
- /* Function below changes ParserState->Aml */
+ /* Function below updates ParserState->Aml */
- Length = (ACPI_NATIVE_UINT) AcpiPsGetNextPackageLength (ParserState);
+ PackageLength = AcpiPsGetNextPackageLength (ParserState);
- return_PTR (Start + Length); /* end of package */
+ return_PTR (Start + PackageLength); /* end of package */
}
@@ -252,21 +249,19 @@
UINT8 *End = ParserState->Aml;
- ACPI_FUNCTION_TRACE ("PsGetNextNamestring");
+ ACPI_FUNCTION_TRACE (PsGetNextNamestring);
- /* Handle multiple prefix characters */
+ /* Point past any namestring prefix characters (backslash or carat) */
- while (AcpiPsIsPrefixChar (ACPI_GET8 (End)))
+ while (AcpiPsIsPrefixChar (*End))
{
- /* Include prefix '\\' or '^' */
-
End++;
}
- /* Decode the path */
+ /* Decode the path prefix character */
- switch (ACPI_GET8 (End))
+ switch (*End)
{
case 0:
@@ -288,9 +283,9 @@
case AML_MULTI_NAME_PREFIX_OP:
- /* Multiple name segments, 4 chars each */
+ /* Multiple name segments, 4 chars each, count in next byte */
- End += 2 + ((ACPI_SIZE) ACPI_GET8 (End + 1) * ACPI_NAME_SIZE);
+ End += 2 + (*(End + 1) * ACPI_NAME_SIZE);
break;
default:
@@ -301,7 +296,7 @@
break;
}
- ParserState->Aml = (UINT8*) End;
+ ParserState->Aml = End;
return_PTR ((char *) Start);
}
@@ -314,7 +309,7 @@
* Arg - Where the namepath will be stored
* ArgCount - If the namepath points to a control method
* the method's argument is returned here.
- * MethodCall - Whether the namepath can possibly be the
+ * PossibleMethodCall - Whether the namepath can possibly be the
* start of a method call
*
* RETURN: Status
@@ -332,135 +327,149 @@
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_STATE *ParserState,
ACPI_PARSE_OBJECT *Arg,
- BOOLEAN MethodCall)
+ BOOLEAN PossibleMethodCall)
{
char *Path;
ACPI_PARSE_OBJECT *NameOp;
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *MethodDesc;
ACPI_NAMESPACE_NODE *Node;
ACPI_GENERIC_STATE ScopeInfo;
- ACPI_FUNCTION_TRACE ("PsGetNextNamepath");
+ ACPI_FUNCTION_TRACE (PsGetNextNamepath);
Path = AcpiPsGetNextNamestring (ParserState);
+ AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
- /* Null path case is allowed */
+ /* Null path case is allowed, just exit */
- if (Path)
+ if (!Path)
{
- /*
- * Lookup the name in the internal namespace
- */
- ScopeInfo.Scope.Node = NULL;
- Node = ParserState->StartNode;
- if (Node)
+ Arg->Common.Value.Name = Path;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Setup search scope info */
+
+ ScopeInfo.Scope.Node = NULL;
+ Node = ParserState->StartNode;
+ if (Node)
+ {
+ ScopeInfo.Scope.Node = Node;
+ }
+
+ /*
+ * Lookup the name in the internal namespace. We don't want to add
+ * anything new to the namespace here, however, so we use MODE_EXECUTE.
+ * Allow searching of the parent tree, but don't open a new scope -
+ * we just want to lookup the object (must be mode EXECUTE to perform
+ * the upsearch)
+ */
+ Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
+
+ /*
+ * If this name is a control method invocation, we must
+ * setup the method call
+ */
+ if (ACPI_SUCCESS (Status) &&
+ PossibleMethodCall &&
+ (Node->Type == ACPI_TYPE_METHOD))
+ {
+ /* This name is actually a control method invocation */
+
+ MethodDesc = AcpiNsGetAttachedObject (Node);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Control Method - %p Desc %p Path=%p\n", Node, MethodDesc, Path));
+
+ NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
+ if (!NameOp)
{
- ScopeInfo.Scope.Node = Node;
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /*
- * Lookup object. We don't want to add anything new to the namespace
- * here, however. So we use MODE_EXECUTE. Allow searching of the
- * parent tree, but don't open a new scope -- we just want to lookup the
- * object (MUST BE mode EXECUTE to perform upsearch)
- */
- Status = AcpiNsLookup (&ScopeInfo, Path, ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL, &Node);
- if (ACPI_SUCCESS (Status) && MethodCall)
- {
- if (Node->Type == ACPI_TYPE_METHOD)
- {
- /*
- * This name is actually a control method invocation
- */
- MethodDesc = AcpiNsGetAttachedObject (Node);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Control Method - %p Desc %p Path=%p\n",
- Node, MethodDesc, Path));
+ /* Change Arg into a METHOD CALL and attach name to it */
- NameOp = AcpiPsAllocOp (AML_INT_NAMEPATH_OP);
- if (!NameOp)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
+ AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
+ NameOp->Common.Value.Name = Path;
- /* Change arg into a METHOD CALL and attach name to it */
+ /* Point METHODCALL/NAME to the METHOD Node */
- AcpiPsInitOp (Arg, AML_INT_METHODCALL_OP);
- NameOp->Common.Value.Name = Path;
+ NameOp->Common.Node = Node;
+ AcpiPsAppendArg (Arg, NameOp);
- /* Point METHODCALL/NAME to the METHOD Node */
+ if (!MethodDesc)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Control Method %p has no attached object",
+ Node));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
- NameOp->Common.Node = Node;
- AcpiPsAppendArg (Arg, NameOp);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Control Method - %p Args %X\n",
+ Node, MethodDesc->Method.ParamCount));
- if (!MethodDesc)
- {
- ACPI_REPORT_ERROR ((
- "PsGetNextNamepath: Control Method %p has no attached object\n",
- Node));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
+ /* Get the number of arguments to expect */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Control Method - %p Args %X\n",
- Node, MethodDesc->Method.ParamCount));
+ WalkState->ArgCount = MethodDesc->Method.ParamCount;
+ return_ACPI_STATUS (AE_OK);
+ }
- /* Get the number of arguments to expect */
+ /*
+ * Special handling if the name was not found during the lookup -
+ * some NotFound cases are allowed
+ */
+ if (Status == AE_NOT_FOUND)
+ {
+ /* 1) NotFound is ok during load pass 1/2 (allow forward references) */
- WalkState->ArgCount = MethodDesc->Method.ParamCount;
- return_ACPI_STATUS (AE_OK);
- }
+ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) !=
+ ACPI_PARSE_EXECUTE)
+ {
+ Status = AE_OK;
+ }
- /*
- * Else this is normal named object reference.
- * Just init the NAMEPATH object with the pathname.
- * (See code below)
- */
- }
-
- if (ACPI_FAILURE (Status))
- {
- /*
- * 1) Any error other than NOT_FOUND is always severe
- * 2) NOT_FOUND is only important if we are executing a method.
- * 3) If executing a CondRefOf opcode, NOT_FOUND is ok.
- */
- if ((((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) &&
- (Status == AE_NOT_FOUND) &&
- (WalkState->Op->Common.AmlOpcode != AML_COND_REF_OF_OP)) ||
+ /* 2) NotFound during a CondRefOf(x) is ok by definition */
- (Status != AE_NOT_FOUND))
- {
- ACPI_REPORT_NSERROR (Path, Status);
+ else if (WalkState->Op->Common.AmlOpcode == AML_COND_REF_OF_OP)
+ {
+ Status = AE_OK;
+ }
- AcpiOsPrintf ("SearchNode %p StartNode %p ReturnNode %p\n",
- ScopeInfo.Scope.Node, ParserState->StartNode, Node);
+ /*
+ * 3) NotFound while building a Package is ok at this point, we
+ * may flag as an error later if slack mode is not enabled.
+ * (Some ASL code depends on allowing this behavior)
+ */
+ else if ((Arg->Common.Parent) &&
+ ((Arg->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Arg->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
+ {
+ Status = AE_OK;
+ }
+ }
+ /* Final exception check (may have been changed from code above) */
- }
- else
- {
- /*
- * We got a NOT_FOUND during table load or we encountered
- * a CondRefOf(x) where the target does not exist.
- * -- either case is ok
- */
- Status = AE_OK;
- }
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR_NAMESPACE (Path, Status);
+
+ if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) ==
+ ACPI_PARSE_EXECUTE)
+ {
+ /* Report a control method execution error */
+
+ Status = AcpiDsMethodError (Status, WalkState);
}
}
- /*
- * Regardless of success/failure above,
- * Just initialize the Op with the pathname.
- */
- AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
- Arg->Common.Value.Name = Path;
+ /* Save the namepath */
+ Arg->Common.Value.Name = Path;
return_ACPI_STATUS (Status);
}
@@ -485,63 +494,71 @@
UINT32 ArgType,
ACPI_PARSE_OBJECT *Arg)
{
+ UINT32 Length;
+ UINT16 Opcode;
+ UINT8 *Aml = ParserState->Aml;
- ACPI_FUNCTION_TRACE_U32 ("PsGetNextSimpleArg", ArgType);
+
+ ACPI_FUNCTION_TRACE_U32 (PsGetNextSimpleArg, ArgType);
switch (ArgType)
{
case ARGP_BYTEDATA:
- AcpiPsInitOp (Arg, AML_BYTE_OP);
- Arg->Common.Value.Integer = (UINT32) ACPI_GET8 (ParserState->Aml);
- ParserState->Aml++;
+ /* Get 1 byte from the AML stream */
+
+ Opcode = AML_BYTE_OP;
+ Arg->Common.Value.Integer = (ACPI_INTEGER) *Aml;
+ Length = 1;
break;
case ARGP_WORDDATA:
- AcpiPsInitOp (Arg, AML_WORD_OP);
-
/* Get 2 bytes from the AML stream */
- ACPI_MOVE_16_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
- ParserState->Aml += 2;
+ Opcode = AML_WORD_OP;
+ ACPI_MOVE_16_TO_64 (&Arg->Common.Value.Integer, Aml);
+ Length = 2;
break;
case ARGP_DWORDDATA:
- AcpiPsInitOp (Arg, AML_DWORD_OP);
-
/* Get 4 bytes from the AML stream */
- ACPI_MOVE_32_TO_32 (&Arg->Common.Value.Integer, ParserState->Aml);
- ParserState->Aml += 4;
+ Opcode = AML_DWORD_OP;
+ ACPI_MOVE_32_TO_64 (&Arg->Common.Value.Integer, Aml);
+ Length = 4;
break;
case ARGP_QWORDDATA:
- AcpiPsInitOp (Arg, AML_QWORD_OP);
-
/* Get 8 bytes from the AML stream */
- ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, ParserState->Aml);
- ParserState->Aml += 8;
+ Opcode = AML_QWORD_OP;
+ ACPI_MOVE_64_TO_64 (&Arg->Common.Value.Integer, Aml);
+ Length = 8;
break;
case ARGP_CHARLIST:
- AcpiPsInitOp (Arg, AML_STRING_OP);
- Arg->Common.Value.String = (char *) ParserState->Aml;
+ /* Get a pointer to the string, point past the string */
- while (ACPI_GET8 (ParserState->Aml) != '\0')
+ Opcode = AML_STRING_OP;
+ Arg->Common.Value.String = ACPI_CAST_PTR (char, Aml);
+
+ /* Find the null terminator */
+
+ Length = 0;
+ while (Aml[Length])
{
- ParserState->Aml++;
+ Length++;
}
- ParserState->Aml++;
+ Length++;
break;
@@ -550,15 +567,17 @@
AcpiPsInitOp (Arg, AML_INT_NAMEPATH_OP);
Arg->Common.Value.Name = AcpiPsGetNextNamestring (ParserState);
- break;
+ return_VOID;
default:
- ACPI_REPORT_ERROR (("Invalid ArgType %X\n", ArgType));
- break;
+ ACPI_ERROR ((AE_INFO, "Invalid ArgType %X", ArgType));
+ return_VOID;
}
+ AcpiPsInitOp (Arg, Opcode);
+ ParserState->Aml += Length;
return_VOID;
}
@@ -575,21 +594,22 @@
*
******************************************************************************/
-ACPI_PARSE_OBJECT *
+static ACPI_PARSE_OBJECT *
AcpiPsGetNextField (
ACPI_PARSE_STATE *ParserState)
{
- UINT32 AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml,
- ParserState->AmlStart);
+ UINT32 AmlOffset = (UINT32)
+ ACPI_PTR_DIFF (ParserState->Aml,
+ ParserState->AmlStart);
ACPI_PARSE_OBJECT *Field;
UINT16 Opcode;
UINT32 Name;
- ACPI_FUNCTION_TRACE ("PsGetNextField");
+ ACPI_FUNCTION_TRACE (PsGetNextField);
- /* determine field type */
+ /* Determine field type */
switch (ACPI_GET8 (ParserState->Aml))
{
@@ -611,7 +631,6 @@
break;
}
-
/* Allocate a new field op */
Field = AcpiPsAllocOp (Opcode);
@@ -654,7 +673,7 @@
* Get AccessType and AccessAttrib and merge into the field Op
* AccessType is first operand, AccessAttribute is second
*/
- Field->Common.Value.Integer = (ACPI_GET8 (ParserState->Aml) << 8);
+ Field->Common.Value.Integer = (((UINT32) ACPI_GET8 (ParserState->Aml) << 8));
ParserState->Aml++;
Field->Common.Value.Integer |= ACPI_GET8 (ParserState->Aml);
ParserState->Aml++;
@@ -674,10 +693,10 @@
*
* FUNCTION: AcpiPsGetNextArg
*
- * PARAMETERS: ParserState - Current parser state object
+ * PARAMETERS: WalkState - Current state
+ * ParserState - Current parser state object
* ArgType - The argument type (AML_*_ARG)
- * ArgCount - If the argument points to a control method
- * the method's argument is returned here.
+ * ReturnArg - Where the next arg is returned
*
* RETURN: Status, and an op object containing the next argument.
*
@@ -700,7 +719,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("PsGetNextArg", ParserState);
+ ACPI_FUNCTION_TRACE_PTR (PsGetNextArg, ParserState);
switch (ArgType)
@@ -712,7 +731,7 @@
case ARGP_NAME:
case ARGP_NAMESTRING:
- /* constants, strings, and namestrings are all the same size */
+ /* Constants, strings, and namestrings are all the same size */
Arg = AcpiPsAllocOp (AML_BYTE_OP);
if (!Arg)
@@ -753,7 +772,6 @@
{
Arg = Field;
}
-
Prev = Field;
}
@@ -778,8 +796,8 @@
/* Fill in bytelist data */
- Arg->Common.Value.Size = (UINT32) ACPI_PTR_DIFF (ParserState->PkgEnd,
- ParserState->Aml);
+ Arg->Common.Value.Size = (UINT32)
+ ACPI_PTR_DIFF (ParserState->PkgEnd, ParserState->Aml);
Arg->Named.Data = ParserState->Aml;
/* Skip to End of byte data */
@@ -810,7 +828,7 @@
}
else
{
- /* single complex argument, nothing returned */
+ /* Single complex argument, nothing returned */
WalkState->ArgCount = 1;
}
@@ -820,7 +838,7 @@
case ARGP_DATAOBJ:
case ARGP_TERMARG:
- /* single complex argument, nothing returned */
+ /* Single complex argument, nothing returned */
WalkState->ArgCount = 1;
break;
@@ -832,7 +850,7 @@
if (ParserState->Aml < ParserState->PkgEnd)
{
- /* non-empty list of variable arguments, nothing returned */
+ /* Non-empty list of variable arguments, nothing returned */
WalkState->ArgCount = ACPI_VAR_ARGS;
}
@@ -841,7 +859,7 @@
default:
- ACPI_REPORT_ERROR (("Invalid ArgType: %X\n", ArgType));
+ ACPI_ERROR ((AE_INFO, "Invalid ArgType: %X", ArgType));
Status = AE_AML_OPERAND_TYPE;
break;
}
Index: exmutex.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exmutex.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exmutex.c -L sys/contrib/dev/acpica/exmutex.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exmutex.c
+++ sys/contrib/dev/acpica/exmutex.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exmutex - ASL Mutex Acquire/Release functions
- * $Revision: 24 $
+ * $Revision: 1.40 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,10 +119,18 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acinterp.h>
+#include <contrib/dev/acpica/acevents.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exmutex")
+/* Local prototypes */
+
+static void
+AcpiExLinkMutex (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_THREAD_STATE *Thread);
+
/*******************************************************************************
*
@@ -130,7 +138,7 @@
*
* PARAMETERS: ObjDesc - The mutex to be unlinked
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Remove a mutex from the "AcquiredMutex" list
*
@@ -170,16 +178,16 @@
*
* FUNCTION: AcpiExLinkMutex
*
- * PARAMETERS: ObjDesc - The mutex to be linked
- * ListHead - head of the "AcquiredMutex" list
+ * PARAMETERS: ObjDesc - The mutex to be linked
+ * Thread - Current executing thread object
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Add a mutex to the "AcquiredMutex" list for this walk
*
******************************************************************************/
-void
+static void
AcpiExLinkMutex (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_THREAD_STATE *Thread)
@@ -209,10 +217,93 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiExAcquireMutexObject
+ *
+ * PARAMETERS: TimeDesc - Timeout in milliseconds
+ * ObjDesc - Mutex object
+ * Thread - Current thread state
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Acquire an AML mutex, low-level interface. Provides a common
+ * path that supports multiple acquires by the same thread.
+ *
+ * MUTEX: Interpreter must be locked
+ *
+ * NOTE: This interface is called from three places:
+ * 1) From AcpiExAcquireMutex, via an AML Acquire() operator
+ * 2) From AcpiExAcquireGlobalLock when an AML Field access requires the
+ * global lock
+ * 3) From the external interface, AcpiAcquireGlobalLock
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExAcquireMutexObject (
+ UINT16 Timeout,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_THREAD_ID ThreadId)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE_PTR (ExAcquireMutexObject, ObjDesc);
+
+
+ if (!ObjDesc)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Support for multiple acquires by the owning thread */
+
+ if (ObjDesc->Mutex.ThreadId == ThreadId)
+ {
+ /*
+ * The mutex is already owned by this thread, just increment the
+ * acquisition depth
+ */
+ ObjDesc->Mutex.AcquisitionDepth++;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Acquire the mutex, wait if necessary. Special case for Global Lock */
+
+ if (ObjDesc == AcpiGbl_GlobalLockMutex)
+ {
+ Status = AcpiEvAcquireGlobalLock (Timeout);
+ }
+ else
+ {
+ Status = AcpiExSystemWaitMutex (ObjDesc->Mutex.OsMutex,
+ Timeout);
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ /* Includes failure from a timeout on TimeDesc */
+
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Acquired the mutex: update mutex object */
+
+ ObjDesc->Mutex.ThreadId = ThreadId;
+ ObjDesc->Mutex.AcquisitionDepth = 1;
+ ObjDesc->Mutex.OriginalSyncLevel = 0;
+ ObjDesc->Mutex.OwnerThread = NULL; /* Used only for AML Acquire() */
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiExAcquireMutex
*
- * PARAMETERS: TimeDesc - The 'time to delay' object descriptor
- * ObjDesc - The object descriptor for this op
+ * PARAMETERS: TimeDesc - Timeout integer
+ * ObjDesc - Mutex object
+ * WalkState - Current method execution state
*
* RETURN: Status
*
@@ -229,7 +320,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExAcquireMutex", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExAcquireMutex, ObjDesc);
if (!ObjDesc)
@@ -237,67 +328,117 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Sanity check -- we must have a valid thread ID */
+ /* Must have a valid thread ID */
if (!WalkState->Thread)
{
- ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], null thread info\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ ACPI_ERROR ((AE_INFO, "Cannot acquire Mutex [%4.4s], null thread info",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
/*
- * Current Sync must be less than or equal to the sync level of the
- * mutex. This mechanism provides some deadlock prevention
+ * Current sync level must be less than or equal to the sync level of the
+ * mutex. This mechanism provides some deadlock prevention
*/
if (WalkState->Thread->CurrentSyncLevel > ObjDesc->Mutex.SyncLevel)
{
- ACPI_REPORT_ERROR (("Cannot acquire Mutex [%4.4s], incorrect SyncLevel\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ ACPI_ERROR ((AE_INFO,
+ "Cannot acquire Mutex [%4.4s], current SyncLevel is too large (%d)",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node),
+ WalkState->Thread->CurrentSyncLevel));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
- /* Support for multiple acquires by the owning thread */
-
- if (ObjDesc->Mutex.OwnerThread)
+ Status = AcpiExAcquireMutexObject ((UINT16) TimeDesc->Integer.Value,
+ ObjDesc, WalkState->Thread->ThreadId);
+ if (ACPI_SUCCESS (Status) && ObjDesc->Mutex.AcquisitionDepth == 1)
{
- /* Special case for Global Lock, allow all threads */
+ /* Save Thread object, original/current sync levels */
- if ((ObjDesc->Mutex.OwnerThread->ThreadId == WalkState->Thread->ThreadId) ||
- (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore))
- {
- /*
- * The mutex is already owned by this thread,
- * just increment the acquisition depth
- */
- ObjDesc->Mutex.AcquisitionDepth++;
- return_ACPI_STATUS (AE_OK);
- }
+ ObjDesc->Mutex.OwnerThread = WalkState->Thread;
+ ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel;
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
+
+ /* Link the mutex to the current thread for force-unlock at method exit */
+
+ AcpiExLinkMutex (ObjDesc, WalkState->Thread);
}
- /* Acquire the mutex, wait if necessary */
+ return_ACPI_STATUS (Status);
+}
- Status = AcpiExSystemAcquireMutex (TimeDesc, ObjDesc);
- if (ACPI_FAILURE (Status))
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExReleaseMutexObject
+ *
+ * PARAMETERS: ObjDesc - The object descriptor for this op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Release a previously acquired Mutex, low level interface.
+ * Provides a common path that supports multiple releases (after
+ * previous multiple acquires) by the same thread.
+ *
+ * MUTEX: Interpreter must be locked
+ *
+ * NOTE: This interface is called from three places:
+ * 1) From AcpiExReleaseMutex, via an AML Acquire() operator
+ * 2) From AcpiExReleaseGlobalLock when an AML Field access requires the
+ * global lock
+ * 3) From the external interface, AcpiReleaseGlobalLock
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiExReleaseMutexObject (
+ ACPI_OPERAND_OBJECT *ObjDesc)
+{
+ ACPI_STATUS Status = AE_OK;
+
+
+ ACPI_FUNCTION_TRACE (ExReleaseMutexObject);
+
+
+ if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
- /* Includes failure from a timeout on TimeDesc */
+ return (AE_NOT_ACQUIRED);
+ }
- return_ACPI_STATUS (Status);
+ /* Match multiple Acquires with multiple Releases */
+
+ ObjDesc->Mutex.AcquisitionDepth--;
+ if (ObjDesc->Mutex.AcquisitionDepth != 0)
+ {
+ /* Just decrement the depth and return */
+
+ return_ACPI_STATUS (AE_OK);
}
- /* Have the mutex: update mutex and walk info and save the SyncLevel */
+ if (ObjDesc->Mutex.OwnerThread)
+ {
+ /* Unlink the mutex from the owner's list */
- ObjDesc->Mutex.OwnerThread = WalkState->Thread;
- ObjDesc->Mutex.AcquisitionDepth = 1;
- ObjDesc->Mutex.OriginalSyncLevel = WalkState->Thread->CurrentSyncLevel;
+ AcpiExUnlinkMutex (ObjDesc);
+ ObjDesc->Mutex.OwnerThread = NULL;
+ }
- WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.SyncLevel;
+ /* Release the mutex, special case for Global Lock */
- /* Link the mutex to the current thread for force-unlock at method exit */
+ if (ObjDesc == AcpiGbl_GlobalLockMutex)
+ {
+ Status = AcpiEvReleaseGlobalLock ();
+ }
+ else
+ {
+ AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex);
+ }
- AcpiExLinkMutex (ObjDesc, WalkState->Thread);
+ /* Clear mutex info */
- return_ACPI_STATUS (AE_OK);
+ ObjDesc->Mutex.ThreadId = 0;
+ return_ACPI_STATUS (Status);
}
@@ -306,6 +447,7 @@
* FUNCTION: AcpiExReleaseMutex
*
* PARAMETERS: ObjDesc - The object descriptor for this op
+ * WalkState - Current method execution state
*
* RETURN: Status
*
@@ -318,10 +460,10 @@
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExReleaseMutex");
+ ACPI_FUNCTION_TRACE (ExReleaseMutex);
if (!ObjDesc)
@@ -333,69 +475,56 @@
if (!ObjDesc->Mutex.OwnerThread)
{
- ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], not acquired\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], not acquired",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
return_ACPI_STATUS (AE_AML_MUTEX_NOT_ACQUIRED);
}
- /* Sanity check -- we must have a valid thread ID */
-
- if (!WalkState->Thread)
- {
- ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], null thread info\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
/*
* The Mutex is owned, but this thread must be the owner.
* Special case for Global Lock, any thread can release
*/
if ((ObjDesc->Mutex.OwnerThread->ThreadId != WalkState->Thread->ThreadId) &&
- (ObjDesc->Mutex.Semaphore != AcpiGbl_GlobalLockSemaphore))
+ (ObjDesc != AcpiGbl_GlobalLockMutex))
{
- ACPI_REPORT_ERROR ((
- "Thread %X cannot release Mutex [%4.4s] acquired by thread %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Thread %X cannot release Mutex [%4.4s] acquired by thread %X",
WalkState->Thread->ThreadId,
AcpiUtGetNodeName (ObjDesc->Mutex.Node),
ObjDesc->Mutex.OwnerThread->ThreadId));
return_ACPI_STATUS (AE_AML_NOT_OWNER);
}
+ /* Must have a valid thread ID */
+
+ if (!WalkState->Thread)
+ {
+ ACPI_ERROR ((AE_INFO, "Cannot release Mutex [%4.4s], null thread info",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ return_ACPI_STATUS (AE_AML_INTERNAL);
+ }
+
/*
- * The sync level of the mutex must be less than or
- * equal to the current sync level
+ * The sync level of the mutex must be less than or equal to the current
+ * sync level
*/
if (ObjDesc->Mutex.SyncLevel > WalkState->Thread->CurrentSyncLevel)
{
- ACPI_REPORT_ERROR (("Cannot release Mutex [%4.4s], incorrect SyncLevel\n",
- AcpiUtGetNodeName (ObjDesc->Mutex.Node)));
+ ACPI_ERROR ((AE_INFO,
+ "Cannot release Mutex [%4.4s], SyncLevel mismatch: mutex %d current %d",
+ AcpiUtGetNodeName (ObjDesc->Mutex.Node),
+ ObjDesc->Mutex.SyncLevel, WalkState->Thread->CurrentSyncLevel));
return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
}
- /* Match multiple Acquires with multiple Releases */
+ Status = AcpiExReleaseMutexObject (ObjDesc);
- ObjDesc->Mutex.AcquisitionDepth--;
- if (ObjDesc->Mutex.AcquisitionDepth != 0)
+ if (ObjDesc->Mutex.AcquisitionDepth == 0)
{
- /* Just decrement the depth and return */
+ /* Restore the original SyncLevel */
- return_ACPI_STATUS (AE_OK);
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
}
-
- /* Unlink the mutex from the owner's list */
-
- AcpiExUnlinkMutex (ObjDesc);
-
- /* Release the mutex */
-
- Status = AcpiExSystemReleaseMutex (ObjDesc);
-
- /* Update the mutex and walk state, restore SyncLevel before acquire */
-
- ObjDesc->Mutex.OwnerThread = NULL;
- WalkState->Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
-
return_ACPI_STATUS (Status);
}
@@ -404,11 +533,17 @@
*
* FUNCTION: AcpiExReleaseAllMutexes
*
- * PARAMETERS: MutexList - Head of the mutex list
+ * PARAMETERS: Thread - Current executing thread object
*
* RETURN: Status
*
- * DESCRIPTION: Release all mutexes in the list
+ * DESCRIPTION: Release all mutexes held by this thread
+ *
+ * NOTE: This function is called as the thread is exiting the interpreter.
+ * Mutexes are not released when an individual control method is exited, but
+ * only when the parent thread actually exits the interpreter. This allows one
+ * method to acquire a mutex, and a different method to release it, as long as
+ * this is performed underneath a single parent control method.
*
******************************************************************************/
@@ -417,8 +552,7 @@
ACPI_THREAD_STATE *Thread)
{
ACPI_OPERAND_OBJECT *Next = Thread->AcquiredMutexList;
- ACPI_OPERAND_OBJECT *This;
- ACPI_STATUS Status;
+ ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_FUNCTION_ENTRY ();
@@ -428,28 +562,34 @@
while (Next)
{
- This = Next;
- Next = This->Mutex.Next;
+ ObjDesc = Next;
+ Next = ObjDesc->Mutex.Next;
+
+ ObjDesc->Mutex.Prev = NULL;
+ ObjDesc->Mutex.Next = NULL;
+ ObjDesc->Mutex.AcquisitionDepth = 0;
- This->Mutex.AcquisitionDepth = 1;
- This->Mutex.Prev = NULL;
- This->Mutex.Next = NULL;
+ /* Release the mutex, special case for Global Lock */
- /* Release the mutex */
+ if (ObjDesc == AcpiGbl_GlobalLockMutex)
+ {
+ /* Ignore errors */
- Status = AcpiExSystemReleaseMutex (This);
- if (ACPI_FAILURE (Status))
+ (void) AcpiEvReleaseGlobalLock ();
+ }
+ else
{
- continue;
+ AcpiOsReleaseMutex (ObjDesc->Mutex.OsMutex);
}
/* Mark mutex unowned */
- This->Mutex.OwnerThread = NULL;
+ ObjDesc->Mutex.OwnerThread = NULL;
+ ObjDesc->Mutex.ThreadId = 0;
/* Update Thread SyncLevel (Last mutex is the important one) */
- Thread->CurrentSyncLevel = This->Mutex.OriginalSyncLevel;
+ Thread->CurrentSyncLevel = ObjDesc->Mutex.OriginalSyncLevel;
}
}
Index: acobject.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acobject.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acobject.h -L sys/contrib/dev/acpica/acobject.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acobject.h
+++ sys/contrib/dev/acpica/acobject.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: acobject.h - Definition of ACPI_OPERAND_OBJECT (Internal object only)
- * $Revision: 126 $
+ * $Revision: 1.143 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,13 +118,23 @@
#ifndef _ACOBJECT_H
#define _ACOBJECT_H
+/* acpisrc:StructDefs -- for acpisrc conversion */
+
/*
- * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
+ * The ACPI_OPERAND_OBJECT is used to pass AML operands from the dispatcher
* to the interpreter, and to keep track of the various handlers such as
- * address space handlers and notify handlers. The object is a constant
+ * address space handlers and notify handlers. The object is a constant
* size in order to allow it to be cached and reused.
+ *
+ * Note: The object is optimized to be aligned and will not work if it is
+ * byte-packed.
*/
+#if ACPI_MACHINE_WIDTH == 64
+#pragma pack(8)
+#else
+#pragma pack(4)
+#endif
/*******************************************************************************
*
@@ -135,17 +145,25 @@
/*
* Common area for all objects.
*
- * DataType is used to differentiate between internal descriptors, and MUST
- * be the first byte in this structure.
+ * DescriptorType is used to differentiate between internal descriptors, and
+ * must be in the same place across all descriptors
+ *
+ * Note: The DescriptorType and Type fields must appear in the identical
+ * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
+ * structures.
*/
-#define ACPI_OBJECT_COMMON_HEADER /* SIZE/ALIGNMENT: 32 bits, one ptr plus trailing 8-bit flag */\
- UINT8 Descriptor; /* To differentiate various internal objs */\
+#define ACPI_OBJECT_COMMON_HEADER \
+ union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\
+ UINT8 DescriptorType; /* To differentiate various internal objs */\
UINT8 Type; /* ACPI_OBJECT_TYPE */\
UINT16 ReferenceCount; /* For object deletion management */\
- union acpi_operand_object *NextObject; /* Objects linked to parent NS node */\
- UINT8 Flags; \
+ UINT8 Flags;
+ /*
+ * Note: There are 3 bytes available here before the
+ * next natural alignment boundary (for both 32/64 cases)
+ */
-/* Values for flag byte above */
+/* Values for Flag byte above */
#define AOPOBJ_AML_CONSTANT 0x01
#define AOPOBJ_STATIC_POINTER 0x02
@@ -153,41 +171,7 @@
#define AOPOBJ_OBJECT_INITIALIZED 0x08
#define AOPOBJ_SETUP_COMPLETE 0x10
#define AOPOBJ_SINGLE_DATUM 0x20
-
-
-/*
- * Common bitfield for the field objects
- * "Field Datum" -- a datum from the actual field object
- * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
- */
-#define ACPI_COMMON_FIELD_INFO /* SIZE/ALIGNMENT: 24 bits + three 32-bit values */\
- UINT8 FieldFlags; /* Access, update, and lock bits */\
- UINT8 Attribute; /* From AccessAs keyword */\
- UINT8 AccessByteWidth; /* Read/Write size in bytes */\
- UINT32 BitLength; /* Length of field in bits */\
- UINT32 BaseByteOffset; /* Byte offset within containing object */\
- UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
- UINT8 DatumValidBits; /* Valid bit in first "Field datum" */\
- UINT8 EndFieldValidBits; /* Valid bits in the last "field datum" */\
- UINT8 EndBufferValidBits; /* Valid bits in the last "buffer datum" */\
- UINT32 Value; /* Value to store into the Bank or Index register */\
- ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
-
-
-/*
- * Fields common to both Strings and Buffers
- */
-#define ACPI_COMMON_BUFFER_INFO \
- UINT32 Length;
-
-
-/*
- * Common fields for objects that support ASL notifications
- */
-#define ACPI_COMMON_NOTIFY_INFO \
- union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
- union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
- union acpi_operand_object *Handler; /* Handler for Address space */
+#define AOPOBJ_INVALID 0x40 /* Used if host OS won't allow an OpRegion address */
/******************************************************************************
@@ -206,19 +190,27 @@
typedef struct acpi_object_integer
{
ACPI_OBJECT_COMMON_HEADER
+ UINT8 Fill[3]; /* Prevent warning on some compilers */
ACPI_INTEGER Value;
} ACPI_OBJECT_INTEGER;
+
/*
* Note: The String and Buffer object must be identical through the Pointer
- * element. There is code that depends on this.
+ * and length elements. There is code that depends on this.
+ *
+ * Fields common to both Strings and Buffers
*/
+#define ACPI_COMMON_BUFFER_INFO(_Type) \
+ _Type *Pointer; \
+ UINT32 Length;
+
+
typedef struct acpi_object_string /* Null terminated, ASCII characters only */
{
ACPI_OBJECT_COMMON_HEADER
- ACPI_COMMON_BUFFER_INFO
- char *Pointer; /* String in AML stream or allocated string */
+ ACPI_COMMON_BUFFER_INFO (char) /* String in AML stream or allocated string */
} ACPI_OBJECT_STRING;
@@ -226,11 +218,10 @@
typedef struct acpi_object_buffer
{
ACPI_OBJECT_COMMON_HEADER
- ACPI_COMMON_BUFFER_INFO
- UINT8 *Pointer; /* Buffer in AML stream or allocated buffer */
- ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
- UINT8 *AmlStart;
+ ACPI_COMMON_BUFFER_INFO (UINT8) /* Buffer in AML stream or allocated buffer */
UINT32 AmlLength;
+ UINT8 *AmlStart;
+ ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
} ACPI_OBJECT_BUFFER;
@@ -238,12 +229,11 @@
typedef struct acpi_object_package
{
ACPI_OBJECT_COMMON_HEADER
-
- UINT32 Count; /* # of elements in package */
- UINT32 AmlLength;
- UINT8 *AmlStart;
ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */
union acpi_operand_object **Elements; /* Array of pointers to AcpiObjects */
+ UINT8 *AmlStart;
+ UINT32 AmlLength;
+ UINT32 Count; /* # of elements in package */
} ACPI_OBJECT_PACKAGE;
@@ -257,40 +247,19 @@
typedef struct acpi_object_event
{
ACPI_OBJECT_COMMON_HEADER
- void *Semaphore;
+ ACPI_SEMAPHORE OsSemaphore; /* Actual OS synchronization object */
} ACPI_OBJECT_EVENT;
-#define ACPI_INFINITE_CONCURRENCY 0xFF
-
-typedef
-ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
- struct acpi_walk_state *WalkState);
-
-typedef struct acpi_object_method
-{
- ACPI_OBJECT_COMMON_HEADER
- UINT8 MethodFlags;
- UINT8 ParamCount;
- UINT32 AmlLength;
- void *Semaphore;
- UINT8 *AmlStart;
- ACPI_INTERNAL_METHOD Implementation;
- UINT8 Concurrency;
- UINT8 ThreadCount;
- ACPI_OWNER_ID OwningId;
-
-} ACPI_OBJECT_METHOD;
-
-
typedef struct acpi_object_mutex
{
ACPI_OBJECT_COMMON_HEADER
UINT8 SyncLevel; /* 0-15, specified in Mutex() call */
UINT16 AcquisitionDepth; /* Allow multiple Acquires, same thread */
+ ACPI_MUTEX OsMutex; /* Actual OS synchronization object */
+ ACPI_THREAD_ID ThreadId; /* Current owner of the mutex */
struct acpi_thread_state *OwnerThread; /* Current owner of the mutex */
- void *Semaphore; /* Actual OS synchronization object */
union acpi_operand_object *Prev; /* Link for list of acquired mutexes */
union acpi_operand_object *Next; /* Link for list of acquired mutexes */
ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
@@ -302,23 +271,47 @@
typedef struct acpi_object_region
{
ACPI_OBJECT_COMMON_HEADER
-
UINT8 SpaceId;
- union acpi_operand_object *Handler; /* Handler for region access */
ACPI_NAMESPACE_NODE *Node; /* Containing namespace node */
+ union acpi_operand_object *Handler; /* Handler for region access */
union acpi_operand_object *Next;
- UINT32 Length;
ACPI_PHYSICAL_ADDRESS Address;
+ UINT32 Length;
} ACPI_OBJECT_REGION;
+typedef struct acpi_object_method
+{
+ ACPI_OBJECT_COMMON_HEADER
+ UINT8 MethodFlags;
+ UINT8 ParamCount;
+ UINT8 SyncLevel;
+ union acpi_operand_object *Mutex;
+ UINT8 *AmlStart;
+ ACPI_INTERNAL_METHOD Implementation;
+ UINT32 AmlLength;
+ UINT8 ThreadCount;
+ ACPI_OWNER_ID OwnerId;
+
+} ACPI_OBJECT_METHOD;
+
+
/******************************************************************************
*
* Objects that can be notified. All share a common NotifyInfo area.
*
*****************************************************************************/
+/*
+ * Common fields for objects that support ASL notifications
+ */
+#define ACPI_COMMON_NOTIFY_INFO \
+ union acpi_operand_object *SystemNotify; /* Handler for system notifies */\
+ union acpi_operand_object *DeviceNotify; /* Handler for driver notifies */\
+ union acpi_operand_object *Handler; /* Handler for Address space */
+
+
typedef struct acpi_object_notify_common /* COMMON NOTIFY for POWER, PROCESSOR, DEVICE, and THERMAL */
{
ACPI_OBJECT_COMMON_HEADER
@@ -349,9 +342,12 @@
typedef struct acpi_object_processor
{
ACPI_OBJECT_COMMON_HEADER
+
+ /* The next two fields take advantage of the 3-byte space before NOTIFY_INFO */
+
+ UINT8 ProcId;
+ UINT8 Length;
ACPI_COMMON_NOTIFY_INFO
- UINT32 ProcId;
- UINT32 Length;
ACPI_IO_ADDRESS Address;
} ACPI_OBJECT_PROCESSOR;
@@ -371,12 +367,29 @@
*
*****************************************************************************/
+/*
+ * Common bitfield for the field objects
+ * "Field Datum" -- a datum from the actual field object
+ * "Buffer Datum" -- a datum from a user buffer, read from or to be written to the field
+ */
+#define ACPI_COMMON_FIELD_INFO \
+ UINT8 FieldFlags; /* Access, update, and lock bits */\
+ UINT8 Attribute; /* From AccessAs keyword */\
+ UINT8 AccessByteWidth; /* Read/Write size in bytes */\
+ ACPI_NAMESPACE_NODE *Node; /* Link back to parent node */\
+ UINT32 BitLength; /* Length of field in bits */\
+ UINT32 BaseByteOffset; /* Byte offset within containing object */\
+ UINT32 Value; /* Value to store into the Bank or Index register */\
+ UINT8 StartFieldBitOffset;/* Bit offset within first field datum (0-63) */\
+ UINT8 AccessBitWidth; /* Read/Write size in bits (8-64) */
+
+
typedef struct acpi_object_field_common /* COMMON FIELD (for BUFFER, REGION, BANK, and INDEX fields) */
{
ACPI_OBJECT_COMMON_HEADER
ACPI_COMMON_FIELD_INFO
- union acpi_operand_object *RegionObj; /* Containing Operation Region object */
- /* (REGION/BANK fields only) */
+ union acpi_operand_object *RegionObj; /* Parent Operation Region object (REGION/BANK fields only) */
+
} ACPI_OBJECT_FIELD_COMMON;
@@ -441,16 +454,11 @@
} ACPI_OBJECT_NOTIFY_HANDLER;
-/* Flags for address handler */
-
-#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x1
-
-
typedef struct acpi_object_addr_handler
{
ACPI_OBJECT_COMMON_HEADER
UINT8 SpaceId;
- UINT16 Hflags;
+ UINT8 HandlerFlags;
ACPI_ADR_SPACE_HANDLER Handler;
ACPI_NAMESPACE_NODE *Node; /* Parent device */
void *Context;
@@ -460,6 +468,10 @@
} ACPI_OBJECT_ADDR_HANDLER;
+/* Flags for address handler (HandlerFlags) */
+
+#define ACPI_ADDR_HANDLER_DEFAULT_INSTALLED 0x01
+
/******************************************************************************
*
@@ -476,10 +488,10 @@
ACPI_OBJECT_COMMON_HEADER
UINT8 TargetType; /* Used for IndexOp */
UINT16 Opcode;
- UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */
void *Object; /* NameOp=>HANDLE to obj, IndexOp=>ACPI_OPERAND_OBJECT */
ACPI_NAMESPACE_NODE *Node;
union acpi_operand_object **Where;
+ UINT32 Offset; /* Used for ArgOp, LocalOp, and IndexOp */
} ACPI_OBJECT_REFERENCE;
@@ -494,12 +506,10 @@
typedef struct acpi_object_extra
{
ACPI_OBJECT_COMMON_HEADER
- UINT8 ByteFill1;
- UINT16 WordFill1;
- UINT32 AmlLength;
- UINT8 *AmlStart;
ACPI_NAMESPACE_NODE *Method_REG; /* _REG method for this region (if any) */
void *RegionContext; /* Region-specific data */
+ UINT8 *AmlStart;
+ UINT32 AmlLength;
} ACPI_OBJECT_EXTRA;
@@ -533,31 +543,31 @@
typedef union acpi_operand_object
{
- ACPI_OBJECT_COMMON Common;
- ACPI_OBJECT_INTEGER Integer;
- ACPI_OBJECT_STRING String;
- ACPI_OBJECT_BUFFER Buffer;
- ACPI_OBJECT_PACKAGE Package;
- ACPI_OBJECT_EVENT Event;
- ACPI_OBJECT_METHOD Method;
- ACPI_OBJECT_MUTEX Mutex;
- ACPI_OBJECT_REGION Region;
- ACPI_OBJECT_NOTIFY_COMMON CommonNotify;
- ACPI_OBJECT_DEVICE Device;
- ACPI_OBJECT_POWER_RESOURCE PowerResource;
- ACPI_OBJECT_PROCESSOR Processor;
- ACPI_OBJECT_THERMAL_ZONE ThermalZone;
- ACPI_OBJECT_FIELD_COMMON CommonField;
- ACPI_OBJECT_REGION_FIELD Field;
- ACPI_OBJECT_BUFFER_FIELD BufferField;
- ACPI_OBJECT_BANK_FIELD BankField;
- ACPI_OBJECT_INDEX_FIELD IndexField;
- ACPI_OBJECT_NOTIFY_HANDLER Notify;
- ACPI_OBJECT_ADDR_HANDLER AddressSpace;
- ACPI_OBJECT_REFERENCE Reference;
- ACPI_OBJECT_EXTRA Extra;
- ACPI_OBJECT_DATA Data;
- ACPI_OBJECT_CACHE_LIST Cache;
+ ACPI_OBJECT_COMMON Common;
+ ACPI_OBJECT_INTEGER Integer;
+ ACPI_OBJECT_STRING String;
+ ACPI_OBJECT_BUFFER Buffer;
+ ACPI_OBJECT_PACKAGE Package;
+ ACPI_OBJECT_EVENT Event;
+ ACPI_OBJECT_METHOD Method;
+ ACPI_OBJECT_MUTEX Mutex;
+ ACPI_OBJECT_REGION Region;
+ ACPI_OBJECT_NOTIFY_COMMON CommonNotify;
+ ACPI_OBJECT_DEVICE Device;
+ ACPI_OBJECT_POWER_RESOURCE PowerResource;
+ ACPI_OBJECT_PROCESSOR Processor;
+ ACPI_OBJECT_THERMAL_ZONE ThermalZone;
+ ACPI_OBJECT_FIELD_COMMON CommonField;
+ ACPI_OBJECT_REGION_FIELD Field;
+ ACPI_OBJECT_BUFFER_FIELD BufferField;
+ ACPI_OBJECT_BANK_FIELD BankField;
+ ACPI_OBJECT_INDEX_FIELD IndexField;
+ ACPI_OBJECT_NOTIFY_HANDLER Notify;
+ ACPI_OBJECT_ADDR_HANDLER AddressSpace;
+ ACPI_OBJECT_REFERENCE Reference;
+ ACPI_OBJECT_EXTRA Extra;
+ ACPI_OBJECT_DATA Data;
+ ACPI_OBJECT_CACHE_LIST Cache;
} ACPI_OPERAND_OBJECT;
@@ -568,7 +578,6 @@
*
*****************************************************************************/
-
/* Object descriptor types */
#define ACPI_DESC_TYPE_CACHED 0x01 /* Used only when object is cached */
@@ -589,14 +598,22 @@
#define ACPI_DESC_TYPE_MAX 0x0F
+typedef struct acpi_common_descriptor
+{
+ void *CommonPointer;
+ UINT8 DescriptorType; /* To differentiate various internal objs */
+
+} ACPI_COMMON_DESCRIPTOR;
+
typedef union acpi_descriptor
{
- UINT8 DescriptorId; /* To differentiate various internal objs */\
+ ACPI_COMMON_DESCRIPTOR Common;
ACPI_OPERAND_OBJECT Object;
ACPI_NAMESPACE_NODE Node;
ACPI_PARSE_OBJECT Op;
} ACPI_DESCRIPTOR;
+#pragma pack()
#endif /* _ACOBJECT_H */
Index: dsfield.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dsfield.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dsfield.c -L sys/contrib/dev/acpica/dsfield.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dsfield.c
+++ sys/contrib/dev/acpica/dsfield.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsfield - Dispatcher field routines
- * $Revision: 74 $
+ * $Revision: 1.84 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,13 +127,20 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsfield")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDsGetFieldNames (
+ ACPI_CREATE_FIELD_INFO *Info,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Arg);
+
/*******************************************************************************
*
* FUNCTION: AcpiDsCreateBufferField
*
- * PARAMETERS: Opcode - The opcode to be executed
- * Operands - List of operands for the opcode
+ * PARAMETERS: Op - Current parse op (CreateXXField)
* WalkState - Current state
*
* RETURN: Status
@@ -144,7 +151,7 @@
* CreateWordFieldOp,
* CreateDWordFieldOp,
* CreateQWordFieldOp,
- * CreateFieldOp (all of which define fields in buffers)
+ * CreateFieldOp (all of which define a field in a buffer)
*
******************************************************************************/
@@ -161,7 +168,7 @@
UINT32 Flags;
- ACPI_FUNCTION_TRACE ("DsCreateBufferField");
+ ACPI_FUNCTION_TRACE (DsCreateBufferField);
/* Get the NameString argument */
@@ -200,7 +207,8 @@
}
else
{
- Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND;
+ Flags = ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
+ ACPI_NS_ERROR_IF_FOUND;
}
/*
@@ -211,21 +219,22 @@
Flags, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
}
- /* We could put the returned object (Node) on the object stack for later, but
- * for now, we will put it in the "op" object that the parser uses, so we
- * can get it again at the end of this scope
+ /*
+ * We could put the returned object (Node) on the object stack for later,
+ * but for now, we will put it in the "op" object that the parser uses,
+ * so we can get it again at the end of this scope
*/
Op->Common.Node = Node;
/*
- * If there is no object attached to the node, this node was just created and
- * we need to create the field object. Otherwise, this was a lookup of an
- * existing node and we don't want to create the field object again.
+ * If there is no object attached to the node, this node was just created
+ * and we need to create the field object. Otherwise, this was a lookup
+ * of an existing node and we don't want to create the field object again.
*/
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
@@ -290,7 +299,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsGetFieldNames (
ACPI_CREATE_FIELD_INFO *Info,
ACPI_WALK_STATE *WalkState,
@@ -300,7 +309,7 @@
ACPI_INTEGER Position;
- ACPI_FUNCTION_TRACE_PTR ("DsGetFieldNames", Info);
+ ACPI_FUNCTION_TRACE_PTR (DsGetFieldNames, Info);
/* First field starts at bit zero */
@@ -326,7 +335,8 @@
if (Position > ACPI_UINT32_MAX)
{
- ACPI_REPORT_ERROR (("Bit offset within field too large (> 0xFFFFFFFF)\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Bit offset within field too large (> 0xFFFFFFFF)"));
return_ACPI_STATUS (AE_SUPPORT);
}
@@ -338,12 +348,15 @@
/*
* Get a new AccessType and AccessAttribute -- to be used for all
- * field units that follow, until field end or another AccessAs keyword.
+ * field units that follow, until field end or another AccessAs
+ * keyword.
*
- * In FieldFlags, preserve the flag bits other than the ACCESS_TYPE bits
+ * In FieldFlags, preserve the flag bits other than the
+ * ACCESS_TYPE bits
*/
- Info->FieldFlags = (UINT8) ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
- ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8)));
+ Info->FieldFlags = (UINT8)
+ ((Info->FieldFlags & ~(AML_FIELD_ACCESS_TYPE_MASK)) |
+ ((UINT8) ((UINT32) Arg->Common.Value.Integer >> 8)));
Info->Attribute = (UINT8) (Arg->Common.Value.Integer);
break;
@@ -355,11 +368,12 @@
Status = AcpiNsLookup (WalkState->ScopeInfo,
(char *) &Arg->Named.Name,
- Info->FieldType, ACPI_IMODE_EXECUTE, ACPI_NS_DONT_OPEN_SCOPE,
+ Info->FieldType, ACPI_IMODE_EXECUTE,
+ ACPI_NS_DONT_OPEN_SCOPE,
WalkState, &Info->FieldNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
+ ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
if (Status != AE_ALREADY_EXISTS)
{
return_ACPI_STATUS (Status);
@@ -388,8 +402,9 @@
if (Position > ACPI_UINT32_MAX)
{
- ACPI_REPORT_ERROR (("Field [%4.4s] bit offset too large (> 0xFFFFFFFF)\n",
- (char *) &Info->FieldNode->Name));
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] bit offset too large (> 0xFFFFFFFF)",
+ ACPI_CAST_PTR (char, &Info->FieldNode->Name)));
return_ACPI_STATUS (AE_SUPPORT);
}
@@ -399,7 +414,8 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid opcode in field list: %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid opcode in field list: %X",
Arg->Common.AmlOpcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
@@ -436,7 +452,7 @@
ACPI_CREATE_FIELD_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateField", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateField, Op);
/* First arg is the name of the parent OpRegion (must already exist) */
@@ -449,7 +465,7 @@
ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
return_ACPI_STATUS (Status);
}
}
@@ -497,7 +513,7 @@
UINT8 Type = 0;
- ACPI_FUNCTION_TRACE_PTR ("DsInitFieldObjects", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsInitFieldObjects, Op);
switch (WalkState->Opcode)
@@ -533,11 +549,12 @@
Status = AcpiNsLookup (WalkState->ScopeInfo,
(char *) &Arg->Named.Name,
Type, ACPI_IMODE_LOAD_PASS1,
- ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
+ ACPI_NS_ERROR_IF_FOUND,
WalkState, &Node);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR ((char *) &Arg->Named.Name, Status);
+ ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
if (Status != AE_ALREADY_EXISTS)
{
return_ACPI_STATUS (Status);
@@ -585,7 +602,7 @@
ACPI_CREATE_FIELD_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateBankField", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateBankField, Op);
/* First arg is the name of the parent OpRegion (must already exist) */
@@ -598,7 +615,7 @@
ACPI_NS_SEARCH_PARENT, WalkState, &RegionNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.Name, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
return_ACPI_STATUS (Status);
}
}
@@ -611,14 +628,39 @@
ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
/* Third arg is the BankValue */
+ /* TBD: This arg is a TermArg, not a constant, and must be evaluated */
+
Arg = Arg->Common.Next;
- Info.BankValue = (UINT32) Arg->Common.Value.Integer;
+
+ /* Currently, only the following constants are supported */
+
+ switch (Arg->Common.AmlOpcode)
+ {
+ case AML_ZERO_OP:
+ Info.BankValue = 0;
+ break;
+
+ case AML_ONE_OP:
+ Info.BankValue = 1;
+ break;
+
+ case AML_BYTE_OP:
+ case AML_WORD_OP:
+ case AML_DWORD_OP:
+ case AML_QWORD_OP:
+ Info.BankValue = (UINT32) Arg->Common.Value.Integer;
+ break;
+
+ default:
+ Info.BankValue = 0;
+ ACPI_ERROR ((AE_INFO, "Non-constant BankValue for BankField is not implemented"));
+ }
/* Fourth arg is the field flags */
@@ -661,7 +703,7 @@
ACPI_CREATE_FIELD_INFO Info;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateIndexField", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateIndexField, Op);
/* First arg is the name of the Index register (must already exist) */
@@ -672,7 +714,7 @@
ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
@@ -684,7 +726,7 @@
ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
Index: dsobject.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dsobject.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dsobject.c -L sys/contrib/dev/acpica/dsobject.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dsobject.c
+++ sys/contrib/dev/acpica/dsobject.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsobject - Dispatcher object management routines
- * $Revision: 119 $
+ * $Revision: 1.135 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,9 +126,17 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsobject")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDsBuildInternalObject (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_OPERAND_OBJECT **ObjDescPtr);
+
#ifndef ACPI_NO_METHOD_EXECUTION
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsBuildInternalObject
*
@@ -141,9 +149,9 @@
* DESCRIPTION: Translate a parser Op object to the equivalent namespace object
* Simple objects are any objects other than a package object!
*
- ****************************************************************************/
+ ******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsBuildInternalObject (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
@@ -153,41 +161,69 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("DsBuildInternalObject");
+ ACPI_FUNCTION_TRACE (DsBuildInternalObject);
*ObjDescPtr = NULL;
if (Op->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
{
/*
- * This is an named object reference. If this name was
+ * This is a named object reference. If this name was
* previously looked up in the namespace, it was stored in this op.
* Otherwise, go ahead and look it up now
*/
if (!Op->Common.Node)
{
- Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Common.Value.String,
- ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
- ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
- (ACPI_NAMESPACE_NODE **) &(Op->Common.Node));
-
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ Op->Common.Value.String,
+ ACPI_TYPE_ANY, ACPI_IMODE_EXECUTE,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE, NULL,
+ ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &(Op->Common.Node)));
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Op->Common.Value.String, Status);
+ /* Check if we are resolving a named reference within a package */
+
+ if ((Status == AE_NOT_FOUND) && (AcpiGbl_EnableInterpreterSlack) &&
+
+ ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP)))
+ {
+ /*
+ * We didn't find the target and we are populating elements
+ * of a package - ignore if slack enabled. Some ASL code
+ * contains dangling invalid references in packages and
+ * expects that no exception will be issued. Leave the
+ * element as a null element. It cannot be used, but it
+ * can be overwritten by subsequent ASL code - this is
+ * typically the case.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Ignoring unresolved reference in package [%4.4s]\n",
+ WalkState->ScopeInfo->Scope.Node->Name.Ascii));
+
+ return_ACPI_STATUS (AE_OK);
+ }
+ else
+ {
+ ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status);
+ }
+
return_ACPI_STATUS (Status);
}
}
}
- /* Create and init the internal ACPI object */
+ /* Create and init a new internal ACPI object */
- ObjDesc = AcpiUtCreateInternalObject ((AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
+ ObjDesc = AcpiUtCreateInternalObject (
+ (AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode))->ObjectType);
if (!ObjDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode, &ObjDesc);
+ Status = AcpiDsInitObjectFromOp (WalkState, Op, Op->Common.AmlOpcode,
+ &ObjDesc);
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ObjDesc);
@@ -199,7 +235,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsBuildInternalBufferObj
*
@@ -213,7 +249,7 @@
* DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsBuildInternalBufferObj (
@@ -228,18 +264,16 @@
UINT32 ByteListLength = 0;
- ACPI_FUNCTION_TRACE ("DsBuildInternalBufferObj");
+ ACPI_FUNCTION_TRACE (DsBuildInternalBufferObj);
+ /*
+ * If we are evaluating a Named buffer object "Name (xxxx, Buffer)".
+ * The buffer object already exists (from the NS node), otherwise it must
+ * be created.
+ */
ObjDesc = *ObjDescPtr;
- if (ObjDesc)
- {
- /*
- * We are evaluating a Named buffer object "Name (xxxx, Buffer)".
- * The buffer object already exists (from the NS node)
- */
- }
- else
+ if (!ObjDesc)
{
/* Create a new buffer object */
@@ -263,8 +297,8 @@
{
if (ByteList->Common.AmlOpcode != AML_INT_BYTELIST_OP)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Expecting bytelist, got AML opcode %X in op %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Expecting bytelist, got AML opcode %X in op %p",
ByteList->Common.AmlOpcode, ByteList));
AcpiUtRemoveReference (ObjDesc);
@@ -295,7 +329,7 @@
}
else
{
- ObjDesc->Buffer.Pointer = ACPI_MEM_CALLOCATE (
+ ObjDesc->Buffer.Pointer = ACPI_ALLOCATE_ZEROED (
ObjDesc->Buffer.Length);
if (!ObjDesc->Buffer.Pointer)
{
@@ -313,18 +347,19 @@
}
ObjDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
- Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
+ Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);
return_ACPI_STATUS (AE_OK);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsBuildInternalPackageObj
*
* PARAMETERS: WalkState - Current walk state
* Op - Parser object to be translated
- * PackageLength - Number of elements in the package
+ * ElementCount - Number of elements in the package - this is
+ * the NumElements argument to Package()
* ObjDescPtr - Where the ACPI internal object is returned
*
* RETURN: Status
@@ -332,44 +367,54 @@
* DESCRIPTION: Translate a parser Op package object to the equivalent
* namespace object
*
- ****************************************************************************/
+ * NOTE: The number of elements in the package will be always be the NumElements
+ * count, regardless of the number of elements in the package list. If
+ * NumElements is smaller, only that many package list elements are used.
+ * if NumElements is larger, the Package object is padded out with
+ * objects of type Uninitialized (as per ACPI spec.)
+ *
+ * Even though the ASL compilers do not allow NumElements to be smaller
+ * than the Package list length (for the fixed length package opcode), some
+ * BIOS code modifies the AML on the fly to adjust the NumElements, and
+ * this code compensates for that. This also provides compatibility with
+ * other AML interpreters.
+ *
+ ******************************************************************************/
ACPI_STATUS
AcpiDsBuildInternalPackageObj (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
- UINT32 PackageLength,
+ UINT32 ElementCount,
ACPI_OPERAND_OBJECT **ObjDescPtr)
{
ACPI_PARSE_OBJECT *Arg;
ACPI_PARSE_OBJECT *Parent;
ACPI_OPERAND_OBJECT *ObjDesc = NULL;
- UINT32 PackageListLength;
ACPI_STATUS Status = AE_OK;
- UINT32 i;
+ ACPI_NATIVE_UINT i;
+ UINT16 Index;
+ UINT16 ReferenceCount;
- ACPI_FUNCTION_TRACE ("DsBuildInternalPackageObj");
+ ACPI_FUNCTION_TRACE (DsBuildInternalPackageObj);
/* Find the parent of a possibly nested package */
Parent = Op->Common.Parent;
- while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ while ((Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
(Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP))
{
Parent = Parent->Common.Parent;
}
+ /*
+ * If we are evaluating a Named package object "Name (xxxx, Package)",
+ * the package object already exists, otherwise it must be created.
+ */
ObjDesc = *ObjDescPtr;
- if (ObjDesc)
- {
- /*
- * We are evaluating a Named package object "Name (xxxx, Package)".
- * Get the existing package object from the NS node
- */
- }
- else
+ if (!ObjDesc)
{
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_PACKAGE);
*ObjDescPtr = ObjDesc;
@@ -381,35 +426,13 @@
ObjDesc->Package.Node = Parent->Common.Node;
}
- ObjDesc->Package.Count = PackageLength;
-
- /* Count the number of items in the package list */
-
- PackageListLength = 0;
- Arg = Op->Common.Value.Arg;
- Arg = Arg->Common.Next;
- while (Arg)
- {
- PackageListLength++;
- Arg = Arg->Common.Next;
- }
-
- /*
- * The package length (number of elements) will be the greater
- * of the specified length and the length of the initializer list
- */
- if (PackageListLength > PackageLength)
- {
- ObjDesc->Package.Count = PackageListLength;
- }
-
/*
- * Allocate the pointer array (array of pointers to the
- * individual objects). Add an extra pointer slot so
- * that the list is always null terminated.
+ * Allocate the element array (array of pointers to the individual
+ * objects) based on the NumElements parameter. Add an extra pointer slot
+ * so that the list is always null terminated.
*/
- ObjDesc->Package.Elements = ACPI_MEM_CALLOCATE (
- ((ACPI_SIZE) ObjDesc->Package.Count + 1) * sizeof (void *));
+ ObjDesc->Package.Elements = ACPI_ALLOCATE_ZEROED (
+ ((ACPI_SIZE) ElementCount + 1) * sizeof (void *));
if (!ObjDesc->Package.Elements)
{
@@ -417,37 +440,64 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ ObjDesc->Package.Count = ElementCount;
+
/*
- * Now init the elements of the package
+ * Initialize the elements of the package, up to the NumElements count.
+ * Package is automatically padded with uninitialized (NULL) elements
+ * if NumElements is greater than the package list length. Likewise,
+ * Package is truncated if NumElements is less than the list length.
*/
- i = 0;
Arg = Op->Common.Value.Arg;
Arg = Arg->Common.Next;
- while (Arg)
+ for (i = 0; Arg && (i < ElementCount); i++)
{
if (Arg->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP)
{
- /* Object (package or buffer) is already built */
+ /* This package element is already built, just get it */
- ObjDesc->Package.Elements[i] = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
+ ObjDesc->Package.Elements[i] =
+ ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Arg->Common.Node);
}
else
{
Status = AcpiDsBuildInternalObject (WalkState, Arg,
- &ObjDesc->Package.Elements[i]);
+ &ObjDesc->Package.Elements[i]);
+ }
+
+ if (*ObjDescPtr)
+ {
+ /* Existing package, get existing reference count */
+
+ ReferenceCount = (*ObjDescPtr)->Common.ReferenceCount;
+ if (ReferenceCount > 1)
+ {
+ /* Make new element ref count match original ref count */
+
+ for (Index = 0; Index < (ReferenceCount - 1); Index++)
+ {
+ AcpiUtAddReference ((ObjDesc->Package.Elements[i]));
+ }
+ }
}
- i++;
Arg = Arg->Common.Next;
}
+ if (!Arg)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Package List length larger than NumElements count (%X), truncated\n",
+ ElementCount));
+ }
+
ObjDesc->Package.Flags |= AOPOBJ_DATA_VALID;
- Op->Common.Node = (ACPI_NAMESPACE_NODE *) ObjDesc;
+ Op->Common.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjDesc);
return_ACPI_STATUS (Status);
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsCreateNode
*
@@ -459,7 +509,7 @@
*
* DESCRIPTION: Create the object to be associated with a namespace node
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsCreateNode (
@@ -471,7 +521,7 @@
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateNode", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateNode, Op);
/*
@@ -493,7 +543,8 @@
/* Build an internal object for the argument(s) */
- Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg, &ObjDesc);
+ Status = AcpiDsBuildInternalObject (WalkState, Op->Common.Value.Arg,
+ &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -516,7 +567,7 @@
#endif /* ACPI_NO_METHOD_EXECUTION */
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiDsInitObjectFromOp
*
@@ -531,7 +582,7 @@
* associated arguments. The namespace object is a more compact
* representation of the Op and its arguments.
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiDsInitObjectFromOp (
@@ -545,7 +596,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("DsInitObjectFromOp");
+ ACPI_FUNCTION_TRACE (DsInitObjectFromOp);
ObjDesc = *RetObjDesc;
@@ -566,7 +617,8 @@
/*
* Defer evaluation of Buffer TermArg operand
*/
- ObjDesc->Buffer.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
+ ObjDesc->Buffer.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
+ WalkState->Operands[0]);
ObjDesc->Buffer.AmlStart = Op->Named.Data;
ObjDesc->Buffer.AmlLength = Op->Named.Length;
break;
@@ -577,7 +629,8 @@
/*
* Defer evaluation of Package TermArg operand
*/
- ObjDesc->Package.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
+ ObjDesc->Package.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE,
+ WalkState->Operands[0]);
ObjDesc->Package.AmlStart = Op->Named.Data;
ObjDesc->Package.AmlLength = Op->Named.Length;
break;
@@ -591,9 +644,10 @@
/*
* Resolve AML Constants here - AND ONLY HERE!
* All constants are integers.
- * We mark the integer with a flag that indicates that it started life
- * as a constant -- so that stores to constants will perform as expected (noop).
- * (ZeroOp is used as a placeholder for optional target operands.)
+ * We mark the integer with a flag that indicates that it started
+ * life as a constant -- so that stores to constants will perform
+ * as expected (noop). ZeroOp is used as a placeholder for optional
+ * target operands.
*/
ObjDesc->Common.Flags = AOPOBJ_AML_CONSTANT;
@@ -622,12 +676,13 @@
case AML_REVISION_OP:
- ObjDesc->Integer.Value = ACPI_CA_SUPPORT_LEVEL;
+ ObjDesc->Integer.Value = ACPI_CA_VERSION;
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown constant opcode %X\n", Opcode));
+ ACPI_ERROR ((AE_INFO,
+ "Unknown constant opcode %X", Opcode));
Status = AE_AML_OPERAND_TYPE;
break;
}
@@ -637,11 +692,15 @@
case AML_TYPE_LITERAL:
ObjDesc->Integer.Value = Op->Common.Value.Integer;
+#ifndef ACPI_NO_METHOD_EXECUTION
+ AcpiExTruncateFor32bitTable (ObjDesc);
+#endif
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Integer type %X\n", OpInfo->Type));
+ ACPI_ERROR ((AE_INFO, "Unknown Integer type %X",
+ OpInfo->Type));
Status = AE_AML_OPERAND_TYPE;
break;
}
@@ -677,8 +736,10 @@
ObjDesc->Reference.Offset = Opcode - AML_LOCAL_OP;
#ifndef ACPI_NO_METHOD_EXECUTION
- Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP, ObjDesc->Reference.Offset,
- WalkState, (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
+ Status = AcpiDsMethodDataGetNode (AML_LOCAL_OP,
+ ObjDesc->Reference.Offset,
+ WalkState,
+ (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
#endif
break;
@@ -691,8 +752,10 @@
ObjDesc->Reference.Offset = Opcode - AML_ARG_OP;
#ifndef ACPI_NO_METHOD_EXECUTION
- Status = AcpiDsMethodDataGetNode (AML_ARG_OP, ObjDesc->Reference.Offset,
- WalkState, (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
+ Status = AcpiDsMethodDataGetNode (AML_ARG_OP,
+ ObjDesc->Reference.Offset,
+ WalkState,
+ (ACPI_NAMESPACE_NODE **) &ObjDesc->Reference.Object);
#endif
break;
@@ -713,7 +776,7 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unimplemented data type: %X\n",
+ ACPI_ERROR ((AE_INFO, "Unimplemented data type: %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_OPERAND_TYPE;
Index: evevent.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evevent.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evevent.c -L sys/contrib/dev/acpica/evevent.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evevent.c
+++ sys/contrib/dev/acpica/evevent.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evevent - Fixed Event handling and dispatch
- * $Revision: 113 $
+ * $Revision: 1.125 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,6 +120,16 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evevent")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiEvFixedEventInitialize (
+ void);
+
+static UINT32
+AcpiEvFixedEventDispatch (
+ UINT32 Event);
+
/*******************************************************************************
*
@@ -129,7 +139,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Initialize global data structures for events.
+ * DESCRIPTION: Initialize global data structures for ACPI events (Fixed, GPE)
*
******************************************************************************/
@@ -140,37 +150,27 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvInitializeEvents");
-
+ ACPI_FUNCTION_TRACE (EvInitializeEvents);
- /* Make sure we have ACPI tables */
-
- if (!AcpiGbl_DSDT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No ACPI tables present!\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
/*
- * Initialize the Fixed and General Purpose Events. This is
- * done prior to enabling SCIs to prevent interrupts from
- * occurring before handers are installed.
+ * Initialize the Fixed and General Purpose Events. This is done prior to
+ * enabling SCIs to prevent interrupts from occurring before the handlers are
+ * installed.
*/
Status = AcpiEvFixedEventInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to initialize fixed events, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to initialize fixed events"));
return_ACPI_STATUS (Status);
}
Status = AcpiEvGpeInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to initialize general purpose events, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to initialize general purpose events"));
return_ACPI_STATUS (Status);
}
@@ -180,6 +180,54 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiEvInstallFadtGpes
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Completes initialization of the FADT-defined GPE blocks
+ * (0 and 1). This causes the _PRW methods to be run, so the HW
+ * must be fully initialized at this point, including global lock
+ * support.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInstallFadtGpes (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (EvInstallFadtGpes);
+
+
+ /* Namespace must be locked */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ /* FADT GPE Block 0 */
+
+ (void) AcpiEvInitializeGpeBlock (
+ AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[0]);
+
+ /* FADT GPE Block 1 */
+
+ (void) AcpiEvInitializeGpeBlock (
+ AcpiGbl_FadtGpeDevice, AcpiGbl_GpeFadtBlocks[1]);
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiEvInstallXruptHandlers
*
* PARAMETERS: None
@@ -197,7 +245,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvInstallXruptHandlers");
+ ACPI_FUNCTION_TRACE (EvInstallXruptHandlers);
/* Install the SCI handler */
@@ -205,9 +253,8 @@
Status = AcpiEvInstallSciHandler ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to install System Control Interrupt Handler, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to install System Control Interrupt handler"));
return_ACPI_STATUS (Status);
}
@@ -216,9 +263,8 @@
Status = AcpiEvInitGlobalLockHandler ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Unable to initialize Global Lock handler, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to initialize Global Lock handler"));
return_ACPI_STATUS (Status);
}
@@ -239,7 +285,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiEvFixedEventInitialize (
void)
{
@@ -260,8 +306,8 @@
if (AcpiGbl_FixedEventInfo[i].EnableRegisterId != 0xFF)
{
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[i].EnableRegisterId,
- 0, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (
+ AcpiGbl_FixedEventInfo[i].EnableRegisterId, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -281,7 +327,7 @@
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
*
- * DESCRIPTION: Checks the PM status register for fixed events
+ * DESCRIPTION: Checks the PM status register for active fixed events
*
******************************************************************************/
@@ -295,15 +341,17 @@
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_NAME ("EvFixedEventDetect");
+ ACPI_FUNCTION_NAME (EvFixedEventDetect);
/*
* Read the fixed feature status and enable registers, as all the cases
* depend on their values. Ignore errors here.
*/
- (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS, &FixedStatus);
- (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE, &FixedEnable);
+ (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
+ &FixedStatus);
+ (void) AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_ENABLE,
+ &FixedEnable);
ACPI_DEBUG_PRINT ((ACPI_DB_INTERRUPTS,
"Fixed Event Block: Enable %08X Status %08X\n",
@@ -342,7 +390,7 @@
*
******************************************************************************/
-UINT32
+static UINT32
AcpiEvFixedEventDispatch (
UINT32 Event)
{
@@ -353,8 +401,7 @@
/* Clear the status bit */
- (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- 1, ACPI_MTX_DO_NOT_LOCK);
+ (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
/*
* Make sure we've got a handler. If not, report an error.
@@ -362,11 +409,10 @@
*/
if (NULL == AcpiGbl_FixedEventHandlers[Event].Handler)
{
- (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 0, ACPI_MTX_DO_NOT_LOCK);
+ (void) AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
- ACPI_REPORT_ERROR (
- ("No installed handler for fixed event [%08X]\n",
+ ACPI_ERROR ((AE_INFO,
+ "No installed handler for fixed event [%08X]",
Event));
return (ACPI_INTERRUPT_NOT_HANDLED);
Index: nsload.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsload.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsload.c -L sys/contrib/dev/acpica/nsload.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsload.c
+++ sys/contrib/dev/acpica/nsload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsload - namespace loading/expanding/contracting procedures
- * $Revision: 69 $
+ * $Revision: 1.80 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,19 +119,31 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsload")
+/* Local prototypes */
-#ifndef ACPI_NO_METHOD_EXECUTION
+#ifdef ACPI_FUTURE_IMPLEMENTATION
+ACPI_STATUS
+AcpiNsUnloadNamespace (
+ ACPI_HANDLE Handle);
+
+static ACPI_STATUS
+AcpiNsDeleteSubtree (
+ ACPI_HANDLE StartHandle);
+#endif
+
+#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
* FUNCTION: AcpiNsLoadTable
*
- * PARAMETERS: TableDesc - Descriptor for table to be loaded
+ * PARAMETERS: TableIndex - Index for table to be loaded
* Node - Owning NS node
*
* RETURN: Status
@@ -142,44 +154,15 @@
ACPI_STATUS
AcpiNsLoadTable (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *Node)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsLoadTable");
+ ACPI_FUNCTION_TRACE (NsLoadTable);
- /* Check if table contains valid AML (must be DSDT, PSDT, SSDT, etc.) */
-
- if (!(AcpiGbl_TableData[TableDesc->Type].Flags & ACPI_TABLE_EXECUTABLE))
- {
- /* Just ignore this table */
-
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Check validity of the AML start and length */
-
- if (!TableDesc->AmlStart)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null AML pointer\n"));
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AML block at %p\n",
- TableDesc->AmlStart));
-
- /* Ignore table if there is no AML contained within */
-
- if (!TableDesc->AmlLength)
- {
- ACPI_REPORT_WARNING (("Zero-length AML block in table [%4.4s]\n",
- TableDesc->Pointer->Signature));
- return_ACPI_STATUS (AE_OK);
- }
-
/*
* Parse the table and load the namespace with all named
* objects found within. Control methods are NOT parsed
@@ -189,16 +172,40 @@
* to another control method, we can't continue parsing
* because we don't know how many arguments to parse next!
*/
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* If table already loaded into namespace, just return */
+
+ if (AcpiTbIsTableLoaded (TableIndex))
+ {
+ Status = AE_ALREADY_EXISTS;
+ goto Unlock;
+ }
+
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Loading table into namespace ****\n"));
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiTbAllocateOwnerId (TableIndex);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto Unlock;
+ }
+
+ Status = AcpiNsParseTable (TableIndex, Node->Child);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiTbSetTableLoadedFlag (TableIndex, TRUE);
+ }
+ else
+ {
+ AcpiTbReleaseOwnerId (TableIndex);
}
- Status = AcpiNsParseTable (TableDesc, Node->Child);
+Unlock:
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
@@ -215,7 +222,7 @@
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Begin Table Method Parsing and Object Initialization ****\n"));
- Status = AcpiDsInitializeObjects (TableDesc, Node);
+ Status = AcpiDsInitializeObjects (TableIndex, Node);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"**** Completed Table Method Parsing and Object Initialization ****\n"));
@@ -224,140 +231,7 @@
}
-/*******************************************************************************
- *
- * FUNCTION: AcpiNsLoadTableByType
- *
- * PARAMETERS: TableType - Id of the table type to load
- *
- * RETURN: Status
- *
- * DESCRIPTION: Load an ACPI table or tables into the namespace. All tables
- * of the given type are loaded. The mechanism allows this
- * routine to be called repeatedly.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiNsLoadTableByType (
- ACPI_TABLE_TYPE TableType)
-{
- UINT32 i;
- ACPI_STATUS Status;
- ACPI_TABLE_DESC *TableDesc;
-
-
- ACPI_FUNCTION_TRACE ("NsLoadTableByType");
-
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Table types supported are:
- * DSDT (one), SSDT/PSDT (multiple)
- */
- switch (TableType)
- {
- case ACPI_TABLE_DSDT:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading DSDT\n"));
-
- TableDesc = AcpiGbl_TableLists[ACPI_TABLE_DSDT].Next;
-
- /* If table already loaded into namespace, just return */
-
- if (TableDesc->LoadedIntoNamespace)
- {
- goto UnlockAndExit;
- }
-
- /* Now load the single DSDT */
-
- Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
- if (ACPI_SUCCESS (Status))
- {
- TableDesc->LoadedIntoNamespace = TRUE;
- }
- break;
-
-
- case ACPI_TABLE_SSDT:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d SSDTs\n",
- AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count));
-
- /*
- * Traverse list of SSDT tables
- */
- TableDesc = AcpiGbl_TableLists[ACPI_TABLE_SSDT].Next;
- for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_SSDT].Count; i++)
- {
- /*
- * Only attempt to load table if it is not
- * already loaded!
- */
- if (!TableDesc->LoadedIntoNamespace)
- {
- Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- TableDesc->LoadedIntoNamespace = TRUE;
- }
-
- TableDesc = TableDesc->Next;
- }
- break;
-
-
- case ACPI_TABLE_PSDT:
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Loading %d PSDTs\n",
- AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count));
-
- /*
- * Traverse list of PSDT tables
- */
- TableDesc = AcpiGbl_TableLists[ACPI_TABLE_PSDT].Next;
-
- for (i = 0; i < AcpiGbl_TableLists[ACPI_TABLE_PSDT].Count; i++)
- {
- /* Only attempt to load table if it is not already loaded! */
-
- if (!TableDesc->LoadedIntoNamespace)
- {
- Status = AcpiNsLoadTable (TableDesc, AcpiGbl_RootNode);
- if (ACPI_FAILURE (Status))
- {
- break;
- }
-
- TableDesc->LoadedIntoNamespace = TRUE;
- }
-
- TableDesc = TableDesc->Next;
- }
- break;
-
-
- default:
- Status = AE_SUPPORT;
- break;
- }
-
-
-UnlockAndExit:
- (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- return_ACPI_STATUS (Status);
-}
-
-
+#ifdef ACPI_OBSOLETE_FUNCTIONS
/*******************************************************************************
*
* FUNCTION: AcpiLoadNamespace
@@ -378,14 +252,14 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiLoadNameSpace");
+ ACPI_FUNCTION_TRACE (AcpiLoadNameSpace);
/* There must be at least a DSDT installed */
if (AcpiGbl_DSDT == NULL)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "DSDT is not in memory\n"));
+ ACPI_ERROR ((AE_INFO, "DSDT is not in memory"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
@@ -393,7 +267,7 @@
* Load the namespace. The DSDT is required,
* but the SSDT and PSDT tables are optional.
*/
- Status = AcpiNsLoadTableByType (ACPI_TABLE_DSDT);
+ Status = AcpiNsLoadTableByType (ACPI_TABLE_ID_DSDT);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -401,8 +275,8 @@
/* Ignore exceptions from these */
- (void) AcpiNsLoadTableByType (ACPI_TABLE_SSDT);
- (void) AcpiNsLoadTableByType (ACPI_TABLE_PSDT);
+ (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_SSDT);
+ (void) AcpiNsLoadTableByType (ACPI_TABLE_ID_PSDT);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"ACPI Namespace successfully loaded at root %p\n",
@@ -410,8 +284,9 @@
return_ACPI_STATUS (Status);
}
+#endif
-
+#ifdef ACPI_FUTURE_IMPLEMENTATION
/*******************************************************************************
*
* FUNCTION: AcpiNsDeleteSubtree
@@ -428,7 +303,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiNsDeleteSubtree (
ACPI_HANDLE StartHandle)
{
@@ -440,7 +315,7 @@
UINT32 Level;
- ACPI_FUNCTION_TRACE ("NsDeleteSubtree");
+ ACPI_FUNCTION_TRACE (NsDeleteSubtree);
ParentHandle = StartHandle;
@@ -528,7 +403,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsUnloadNameSpace");
+ ACPI_FUNCTION_TRACE (NsUnloadNameSpace);
/* Parameter validation */
@@ -549,6 +424,6 @@
return_ACPI_STATUS (Status);
}
-
+#endif
#endif
Index: pstree.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/pstree.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/pstree.c -L sys/contrib/dev/acpica/pstree.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/pstree.c
+++ sys/contrib/dev/acpica/pstree.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pstree - Parser op tree manipulation/traversal/search
- * $Revision: 42 $
+ * $Revision: 1.51 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,14 @@
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("pstree")
+/* Local prototypes */
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+ACPI_PARSE_OBJECT *
+AcpiPsGetChild (
+ ACPI_PARSE_OBJECT *op);
+#endif
+
/*******************************************************************************
*
@@ -132,7 +140,7 @@
* PARAMETERS: Op - Get an argument for this op
* Argn - Nth argument to get
*
- * RETURN: The argument (as an Op object). NULL if argument does not exist
+ * RETURN: The argument (as an Op object). NULL if argument does not exist
*
* DESCRIPTION: Get the specified op's argument.
*
@@ -219,7 +227,7 @@
{
/* Invalid opcode */
- ACPI_REPORT_ERROR (("PsAppendArg: Invalid AML Opcode: 0x%2.2X\n",
+ ACPI_ERROR ((AE_INFO, "Invalid AML Opcode: 0x%2.2X",
Op->Common.AmlOpcode));
return;
}
@@ -233,7 +241,6 @@
return;
}
-
/* Append the argument to the linked argument list */
if (Op->Common.Value.Arg)
@@ -247,7 +254,6 @@
}
PrevArg->Common.Next = Arg;
}
-
else
{
/* No argument list, this will be the first argument */
@@ -255,82 +261,15 @@
Op->Common.Value.Arg = Arg;
}
-
/* Set the parent in this arg and any args linked after it */
while (Arg)
{
Arg->Common.Parent = Op;
Arg = Arg->Common.Next;
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiPsGetChild
- *
- * PARAMETERS: Op - Get the child of this Op
- *
- * RETURN: Child Op, Null if none is found.
- *
- * DESCRIPTION: Get op's children or NULL if none
- *
- ******************************************************************************/
-
-ACPI_PARSE_OBJECT *
-AcpiPsGetChild (
- ACPI_PARSE_OBJECT *Op)
-{
- ACPI_PARSE_OBJECT *Child = NULL;
-
-
- ACPI_FUNCTION_ENTRY ();
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_SCOPE_OP:
- case AML_ELSE_OP:
- case AML_DEVICE_OP:
- case AML_THERMAL_ZONE_OP:
- case AML_INT_METHODCALL_OP:
-
- Child = AcpiPsGetArg (Op, 0);
- break;
-
-
- case AML_BUFFER_OP:
- case AML_PACKAGE_OP:
- case AML_METHOD_OP:
- case AML_IF_OP:
- case AML_WHILE_OP:
- case AML_FIELD_OP:
-
- Child = AcpiPsGetArg (Op, 1);
- break;
-
-
- case AML_POWER_RES_OP:
- case AML_INDEX_FIELD_OP:
-
- Child = AcpiPsGetArg (Op, 2);
- break;
-
-
- case AML_PROCESSOR_OP:
- case AML_BANK_FIELD_OP:
-
- Child = AcpiPsGetArg (Op, 3);
- break;
-
-
- default:
- /* All others have no children */
- break;
+ Op->Common.ArgListLength++;
}
-
- return (Child);
}
@@ -366,7 +305,7 @@
return (NULL);
}
- /* look for an argument or child */
+ /* Look for an argument or child */
Next = AcpiPsGetArg (Op, 0);
if (Next)
@@ -374,7 +313,7 @@
return (Next);
}
- /* look for a sibling */
+ /* Look for a sibling */
Next = Op->Common.Next;
if (Next)
@@ -382,7 +321,7 @@
return (Next);
}
- /* look for a sibling of parent */
+ /* Look for a sibling of parent */
Parent = Op->Common.Parent;
@@ -396,14 +335,14 @@
if (Arg == Origin)
{
- /* reached parent of origin, end search */
+ /* Reached parent of origin, end search */
return (NULL);
}
if (Parent->Common.Next)
{
- /* found sibling of parent */
+ /* Found sibling of parent */
return (Parent->Common.Next);
}
@@ -416,3 +355,73 @@
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetChild
+ *
+ * PARAMETERS: Op - Get the child of this Op
+ *
+ * RETURN: Child Op, Null if none is found.
+ *
+ * DESCRIPTION: Get op's children or NULL if none
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+AcpiPsGetChild (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Child = NULL;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_SCOPE_OP:
+ case AML_ELSE_OP:
+ case AML_DEVICE_OP:
+ case AML_THERMAL_ZONE_OP:
+ case AML_INT_METHODCALL_OP:
+
+ Child = AcpiPsGetArg (Op, 0);
+ break;
+
+
+ case AML_BUFFER_OP:
+ case AML_PACKAGE_OP:
+ case AML_METHOD_OP:
+ case AML_IF_OP:
+ case AML_WHILE_OP:
+ case AML_FIELD_OP:
+
+ Child = AcpiPsGetArg (Op, 1);
+ break;
+
+
+ case AML_POWER_RES_OP:
+ case AML_INDEX_FIELD_OP:
+
+ Child = AcpiPsGetArg (Op, 2);
+ break;
+
+
+ case AML_PROCESSOR_OP:
+ case AML_BANK_FIELD_OP:
+
+ Child = AcpiPsGetArg (Op, 3);
+ break;
+
+
+ default:
+ /* All others have no children */
+ break;
+ }
+
+ return (Child);
+}
+#endif
+
+
Index: psopcode.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/psopcode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/psopcode.c -L sys/contrib/dev/acpica/psopcode.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/psopcode.c
+++ sys/contrib/dev/acpica/psopcode.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psopcode - Parser/Interpreter opcode information table
- * $Revision: 83 $
+ * $Revision: 1.99 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +117,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/acopcode.h>
#include <contrib/dev/acpica/amlcode.h>
@@ -124,21 +125,7 @@
ACPI_MODULE_NAME ("psopcode")
-#define _UNK 0x6B
-/*
- * Reserved ASCII characters. Do not use any of these for
- * internal opcodes, since they are used to differentiate
- * name strings from AML opcodes
- */
-#define _ASC 0x6C
-#define _NAM 0x6C
-#define _PFX 0x6D
-#define _UNKNOWN_OPCODE 0x02 /* An example unknown opcode */
-
-#define MAX_EXTENDED_OPCODE 0x88
-#define NUM_EXTENDED_OPCODE (MAX_EXTENDED_OPCODE + 1)
-#define MAX_INTERNAL_OPCODE
-#define NUM_INTERNAL_OPCODE (MAX_INTERNAL_OPCODE + 1)
+const UINT8 AcpiGbl_ArgumentCount[] = {0,1,1,1,1,2,2,2,2,3,3,6};
/*******************************************************************************
@@ -152,274 +139,9 @@
*
******************************************************************************/
-
-/*
- * All AML opcodes and the parse-time arguments for each. Used by the AML parser Each list is compressed
- * into a 32-bit number and stored in the master opcode table at the end of this file.
- */
-
-
-#define ARGP_ACCESSFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_ACQUIRE_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_WORDDATA)
-#define ARGP_ADD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_ALIAS_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_NAME)
-#define ARGP_ARG0 ARG_NONE
-#define ARGP_ARG1 ARG_NONE
-#define ARGP_ARG2 ARG_NONE
-#define ARGP_ARG3 ARG_NONE
-#define ARGP_ARG4 ARG_NONE
-#define ARGP_ARG5 ARG_NONE
-#define ARGP_ARG6 ARG_NONE
-#define ARGP_BANK_FIELD_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_TERMARG, ARGP_BYTEDATA, ARGP_FIELDLIST)
-#define ARGP_BIT_AND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BIT_NAND_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BIT_NOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BIT_NOT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BIT_OR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BIT_XOR_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_BREAK_OP ARG_NONE
-#define ARGP_BREAK_POINT_OP ARG_NONE
-#define ARGP_BUFFER_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_BYTELIST)
-#define ARGP_BYTE_OP ARGP_LIST1 (ARGP_BYTEDATA)
-#define ARGP_BYTELIST_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_CONCAT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_CONCAT_RES_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_COND_REF_OF_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SUPERNAME)
-#define ARGP_CONTINUE_OP ARG_NONE
-#define ARGP_COPY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_SIMPLENAME)
-#define ARGP_CREATE_BIT_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_CREATE_BYTE_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_CREATE_DWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_CREATE_FIELD_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_CREATE_QWORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_CREATE_WORD_FIELD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_NAME)
-#define ARGP_DATA_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_DEBUG_OP ARG_NONE
-#define ARGP_DECREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_DEREF_OF_OP ARGP_LIST1 (ARGP_TERMARG)
-#define ARGP_DEVICE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
-#define ARGP_DIVIDE_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET, ARGP_TARGET)
-#define ARGP_DWORD_OP ARGP_LIST1 (ARGP_DWORDDATA)
-#define ARGP_ELSE_OP ARGP_LIST2 (ARGP_PKGLENGTH, ARGP_TERMLIST)
-#define ARGP_EVENT_OP ARGP_LIST1 (ARGP_NAME)
-#define ARGP_FATAL_OP ARGP_LIST3 (ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_TERMARG)
-#define ARGP_FIELD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_BYTEDATA, ARGP_FIELDLIST)
-#define ARGP_FIND_SET_LEFT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_FIND_SET_RIGHT_BIT_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_FROM_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_IF_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
-#define ARGP_INCREMENT_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_INDEX_FIELD_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAMESTRING, ARGP_NAMESTRING,ARGP_BYTEDATA, ARGP_FIELDLIST)
-#define ARGP_INDEX_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_LAND_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LGREATER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LGREATEREQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LLESS_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LLESSEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LNOT_OP ARGP_LIST1 (ARGP_TERMARG)
-#define ARGP_LNOTEQUAL_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LOAD_OP ARGP_LIST2 (ARGP_NAMESTRING, ARGP_SUPERNAME)
-#define ARGP_LOAD_TABLE_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_LOCAL0 ARG_NONE
-#define ARGP_LOCAL1 ARG_NONE
-#define ARGP_LOCAL2 ARG_NONE
-#define ARGP_LOCAL3 ARG_NONE
-#define ARGP_LOCAL4 ARG_NONE
-#define ARGP_LOCAL5 ARG_NONE
-#define ARGP_LOCAL6 ARG_NONE
-#define ARGP_LOCAL7 ARG_NONE
-#define ARGP_LOR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_MATCH_OP ARGP_LIST6 (ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_METHOD_OP ARGP_LIST4 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMLIST)
-#define ARGP_METHODCALL_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_MID_OP ARGP_LIST4 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_MOD_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_MULTIPLY_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_MUTEX_OP ARGP_LIST2 (ARGP_NAME, ARGP_BYTEDATA)
-#define ARGP_NAME_OP ARGP_LIST2 (ARGP_NAME, ARGP_DATAOBJ)
-#define ARGP_NAMEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_NAMEPATH_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_NOOP_OP ARG_NONE
-#define ARGP_NOTIFY_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
-#define ARGP_ONE_OP ARG_NONE
-#define ARGP_ONES_OP ARG_NONE
-#define ARGP_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_BYTEDATA, ARGP_DATAOBJLIST)
-#define ARGP_POWER_RES_OP ARGP_LIST5 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_WORDDATA, ARGP_OBJLIST)
-#define ARGP_PROCESSOR_OP ARGP_LIST6 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_BYTEDATA, ARGP_DWORDDATA, ARGP_BYTEDATA, ARGP_OBJLIST)
-#define ARGP_QWORD_OP ARGP_LIST1 (ARGP_QWORDDATA)
-#define ARGP_REF_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_REGION_OP ARGP_LIST4 (ARGP_NAME, ARGP_BYTEDATA, ARGP_TERMARG, ARGP_TERMARG)
-#define ARGP_RELEASE_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_RESERVEDFIELD_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_RESET_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_RETURN_OP ARGP_LIST1 (ARGP_TERMARG)
-#define ARGP_REVISION_OP ARG_NONE
-#define ARGP_SCOPE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_TERMLIST)
-#define ARGP_SHIFT_LEFT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_SHIFT_RIGHT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_SIGNAL_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_SIZE_OF_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_SLEEP_OP ARGP_LIST1 (ARGP_TERMARG)
-#define ARGP_STALL_OP ARGP_LIST1 (ARGP_TERMARG)
-#define ARGP_STATICSTRING_OP ARGP_LIST1 (ARGP_NAMESTRING)
-#define ARGP_STORE_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_SUPERNAME)
-#define ARGP_STRING_OP ARGP_LIST1 (ARGP_CHARLIST)
-#define ARGP_SUBTRACT_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_THERMAL_ZONE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_NAME, ARGP_OBJLIST)
-#define ARGP_TIMER_OP ARG_NONE
-#define ARGP_TO_BCD_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_TO_BUFFER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_TO_DEC_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_TO_HEX_STR_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_TO_INTEGER_OP ARGP_LIST2 (ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_TO_STRING_OP ARGP_LIST3 (ARGP_TERMARG, ARGP_TERMARG, ARGP_TARGET)
-#define ARGP_TYPE_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_UNLOAD_OP ARGP_LIST1 (ARGP_SUPERNAME)
-#define ARGP_VAR_PACKAGE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_DATAOBJLIST)
-#define ARGP_WAIT_OP ARGP_LIST2 (ARGP_SUPERNAME, ARGP_TERMARG)
-#define ARGP_WHILE_OP ARGP_LIST3 (ARGP_PKGLENGTH, ARGP_TERMARG, ARGP_TERMLIST)
-#define ARGP_WORD_OP ARGP_LIST1 (ARGP_WORDDATA)
-#define ARGP_ZERO_OP ARG_NONE
-
-
-/*
- * All AML opcodes and the runtime arguments for each. Used by the AML interpreter Each list is compressed
- * into a 32-bit number and stored in the master opcode table at the end of this file.
- *
- * (Used by PrepOperands procedure and the ASL Compiler)
- */
-
-
-#define ARGI_ACCESSFIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_ACQUIRE_OP ARGI_LIST2 (ARGI_MUTEX, ARGI_INTEGER)
-#define ARGI_ADD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_ALIAS_OP ARGI_INVALID_OPCODE
-#define ARGI_ARG0 ARG_NONE
-#define ARGI_ARG1 ARG_NONE
-#define ARGI_ARG2 ARG_NONE
-#define ARGI_ARG3 ARG_NONE
-#define ARGI_ARG4 ARG_NONE
-#define ARGI_ARG5 ARG_NONE
-#define ARGI_ARG6 ARG_NONE
-#define ARGI_BANK_FIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_BIT_AND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_BIT_NAND_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_BIT_NOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_BIT_NOT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_BIT_OR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_BIT_XOR_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_BREAK_OP ARG_NONE
-#define ARGI_BREAK_POINT_OP ARG_NONE
-#define ARGI_BUFFER_OP ARGI_LIST1 (ARGI_INTEGER)
-#define ARGI_BYTE_OP ARGI_INVALID_OPCODE
-#define ARGI_BYTELIST_OP ARGI_INVALID_OPCODE
-#define ARGI_CONCAT_OP ARGI_LIST3 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA, ARGI_TARGETREF)
-#define ARGI_CONCAT_RES_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_BUFFER, ARGI_TARGETREF)
-#define ARGI_COND_REF_OF_OP ARGI_LIST2 (ARGI_OBJECT_REF, ARGI_TARGETREF)
-#define ARGI_CONTINUE_OP ARGI_INVALID_OPCODE
-#define ARGI_COPY_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_SIMPLE_TARGET)
-#define ARGI_CREATE_BIT_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_CREATE_BYTE_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_CREATE_DWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_CREATE_FIELD_OP ARGI_LIST4 (ARGI_BUFFER, ARGI_INTEGER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_CREATE_QWORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_CREATE_WORD_FIELD_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_REFERENCE)
-#define ARGI_DATA_REGION_OP ARGI_LIST3 (ARGI_STRING, ARGI_STRING, ARGI_STRING)
-#define ARGI_DEBUG_OP ARG_NONE
-#define ARGI_DECREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
-#define ARGI_DEREF_OF_OP ARGI_LIST1 (ARGI_REF_OR_STRING)
-#define ARGI_DEVICE_OP ARGI_INVALID_OPCODE
-#define ARGI_DIVIDE_OP ARGI_LIST4 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF, ARGI_TARGETREF)
-#define ARGI_DWORD_OP ARGI_INVALID_OPCODE
-#define ARGI_ELSE_OP ARGI_INVALID_OPCODE
-#define ARGI_EVENT_OP ARGI_INVALID_OPCODE
-#define ARGI_FATAL_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_FIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_FIND_SET_LEFT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_FIND_SET_RIGHT_BIT_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_FROM_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_IF_OP ARGI_INVALID_OPCODE
-#define ARGI_INCREMENT_OP ARGI_LIST1 (ARGI_INTEGER_REF)
-#define ARGI_INDEX_FIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_INDEX_OP ARGI_LIST3 (ARGI_COMPLEXOBJ, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_LAND_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_LEQUAL_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
-#define ARGI_LGREATER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
-#define ARGI_LGREATEREQUAL_OP ARGI_INVALID_OPCODE
-#define ARGI_LLESS_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_COMPUTEDATA)
-#define ARGI_LLESSEQUAL_OP ARGI_INVALID_OPCODE
-#define ARGI_LNOT_OP ARGI_LIST1 (ARGI_INTEGER)
-#define ARGI_LNOTEQUAL_OP ARGI_INVALID_OPCODE
-#define ARGI_LOAD_OP ARGI_LIST2 (ARGI_REGION_OR_FIELD,ARGI_TARGETREF)
-#define ARGI_LOAD_TABLE_OP ARGI_LIST6 (ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_STRING, ARGI_ANYTYPE)
-#define ARGI_LOCAL0 ARG_NONE
-#define ARGI_LOCAL1 ARG_NONE
-#define ARGI_LOCAL2 ARG_NONE
-#define ARGI_LOCAL3 ARG_NONE
-#define ARGI_LOCAL4 ARG_NONE
-#define ARGI_LOCAL5 ARG_NONE
-#define ARGI_LOCAL6 ARG_NONE
-#define ARGI_LOCAL7 ARG_NONE
-#define ARGI_LOR_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_MATCH_OP ARGI_LIST6 (ARGI_PACKAGE, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_METHOD_OP ARGI_INVALID_OPCODE
-#define ARGI_METHODCALL_OP ARGI_INVALID_OPCODE
-#define ARGI_MID_OP ARGI_LIST4 (ARGI_BUFFER_OR_STRING,ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_MOD_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_MULTIPLY_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_MUTEX_OP ARGI_INVALID_OPCODE
-#define ARGI_NAME_OP ARGI_INVALID_OPCODE
-#define ARGI_NAMEDFIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_NAMEPATH_OP ARGI_INVALID_OPCODE
-#define ARGI_NOOP_OP ARG_NONE
-#define ARGI_NOTIFY_OP ARGI_LIST2 (ARGI_DEVICE_REF, ARGI_INTEGER)
-#define ARGI_ONE_OP ARG_NONE
-#define ARGI_ONES_OP ARG_NONE
-#define ARGI_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
-#define ARGI_POWER_RES_OP ARGI_INVALID_OPCODE
-#define ARGI_PROCESSOR_OP ARGI_INVALID_OPCODE
-#define ARGI_QWORD_OP ARGI_INVALID_OPCODE
-#define ARGI_REF_OF_OP ARGI_LIST1 (ARGI_OBJECT_REF)
-#define ARGI_REGION_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_INTEGER)
-#define ARGI_RELEASE_OP ARGI_LIST1 (ARGI_MUTEX)
-#define ARGI_RESERVEDFIELD_OP ARGI_INVALID_OPCODE
-#define ARGI_RESET_OP ARGI_LIST1 (ARGI_EVENT)
-#define ARGI_RETURN_OP ARGI_INVALID_OPCODE
-#define ARGI_REVISION_OP ARG_NONE
-#define ARGI_SCOPE_OP ARGI_INVALID_OPCODE
-#define ARGI_SHIFT_LEFT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_SHIFT_RIGHT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_SIGNAL_OP ARGI_LIST1 (ARGI_EVENT)
-#define ARGI_SIZE_OF_OP ARGI_LIST1 (ARGI_REFERENCE) /* Force delay of operand resolution */
-#define ARGI_SLEEP_OP ARGI_LIST1 (ARGI_INTEGER)
-#define ARGI_STALL_OP ARGI_LIST1 (ARGI_INTEGER)
-#define ARGI_STATICSTRING_OP ARGI_INVALID_OPCODE
-#define ARGI_STORE_OP ARGI_LIST2 (ARGI_ANYTYPE, ARGI_TARGETREF)
-#define ARGI_STRING_OP ARGI_INVALID_OPCODE
-#define ARGI_SUBTRACT_OP ARGI_LIST3 (ARGI_INTEGER, ARGI_INTEGER, ARGI_TARGETREF)
-#define ARGI_THERMAL_ZONE_OP ARGI_INVALID_OPCODE
-#define ARGI_TIMER_OP ARG_NONE
-#define ARGI_TO_BCD_OP ARGI_LIST2 (ARGI_INTEGER, ARGI_FIXED_TARGET)
-#define ARGI_TO_BUFFER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
-#define ARGI_TO_DEC_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
-#define ARGI_TO_HEX_STR_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
-#define ARGI_TO_INTEGER_OP ARGI_LIST2 (ARGI_COMPUTEDATA,ARGI_FIXED_TARGET)
-#define ARGI_TO_STRING_OP ARGI_LIST3 (ARGI_BUFFER, ARGI_INTEGER, ARGI_FIXED_TARGET)
-#define ARGI_TYPE_OP ARGI_LIST1 (ARGI_REFERENCE) /* Force delay of operand resolution */
-#define ARGI_UNLOAD_OP ARGI_LIST1 (ARGI_DDBHANDLE)
-#define ARGI_VAR_PACKAGE_OP ARGI_LIST1 (ARGI_INTEGER)
-#define ARGI_WAIT_OP ARGI_LIST2 (ARGI_EVENT, ARGI_INTEGER)
-#define ARGI_WHILE_OP ARGI_INVALID_OPCODE
-#define ARGI_WORD_OP ARGI_INVALID_OPCODE
-#define ARGI_ZERO_OP ARG_NONE
-
-
/*
* Summary of opcode types/flags
- */
-
-/******************************************************************************
+ *
Opcodes that have associated namespace objects (AML_NSOBJECT flag)
@@ -533,14 +255,13 @@
AML_CREATE_DWORD_FIELD_OP
AML_CREATE_QWORD_FIELD_OP
-******************************************************************************/
+ ******************************************************************************/
/*
- * Master Opcode information table. A summary of everything we know about each opcode, all in one place.
+ * Master Opcode information table. A summary of everything we know about each
+ * opcode, all in one place.
*/
-
-
const ACPI_OPCODE_INFO AcpiGbl_AmlOpInfo[AML_NUM_OPCODES] =
{
/*! [Begin] no source code translation */
@@ -594,14 +315,14 @@
/* 2D */ ACPI_OP ("FindSetRightBit", ARGP_FIND_SET_RIGHT_BIT_OP,ARGI_FIND_SET_RIGHT_BIT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_1T_1R, AML_FLAGS_EXEC_1A_1T_1R | AML_CONSTANT),
/* 2E */ ACPI_OP ("DerefOf", ARGP_DEREF_OF_OP, ARGI_DEREF_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
/* 2F */ ACPI_OP ("Notify", ARGP_NOTIFY_OP, ARGI_NOTIFY_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_0R, AML_FLAGS_EXEC_2A_0T_0R),
-/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
-/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
+/* 30 */ ACPI_OP ("SizeOf", ARGP_SIZE_OF_OP, ARGI_SIZE_OF_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
+/* 31 */ ACPI_OP ("Index", ARGP_INDEX_OP, ARGI_INDEX_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R),
/* 32 */ ACPI_OP ("Match", ARGP_MATCH_OP, ARGI_MATCH_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_6A_0T_1R, AML_FLAGS_EXEC_6A_0T_1R | AML_CONSTANT),
/* 33 */ ACPI_OP ("CreateDWordField", ARGP_CREATE_DWORD_FIELD_OP,ARGI_CREATE_DWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 34 */ ACPI_OP ("CreateWordField", ARGP_CREATE_WORD_FIELD_OP, ARGI_CREATE_WORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 35 */ ACPI_OP ("CreateByteField", ARGP_CREATE_BYTE_FIELD_OP, ARGI_CREATE_BYTE_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
/* 36 */ ACPI_OP ("CreateBitField", ARGP_CREATE_BIT_FIELD_OP, ARGI_CREATE_BIT_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
-/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R),
+/* 37 */ ACPI_OP ("ObjectType", ARGP_TYPE_OP, ARGI_TYPE_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_NO_OPERAND_RESOLVE),
/* 38 */ ACPI_OP ("LAnd", ARGP_LAND_OP, ARGI_LAND_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
/* 39 */ ACPI_OP ("LOr", ARGP_LOR_OP, ARGI_LOR_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_0T_1R, AML_FLAGS_EXEC_2A_0T_1R | AML_LOGICAL_NUMERIC | AML_CONSTANT),
/* 3A */ ACPI_OP ("LNot", ARGP_LNOT_OP, ARGI_LNOT_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_1A_0T_1R, AML_FLAGS_EXEC_1A_0T_1R | AML_CONSTANT),
@@ -666,7 +387,7 @@
/* ACPI 2.0 opcodes */
/* 6E */ ACPI_OP ("QwordConst", ARGP_QWORD_OP, ARGI_QWORD_OP, ACPI_TYPE_INTEGER, AML_CLASS_ARGUMENT, AML_TYPE_LITERAL, AML_CONSTANT),
-/* 6F */ ACPI_OP ("Package /*Var*/", ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
+/* 6F */ ACPI_OP ("Package", /* Var */ ARGP_VAR_PACKAGE_OP, ARGI_VAR_PACKAGE_OP, ACPI_TYPE_PACKAGE, AML_CLASS_CREATE, AML_TYPE_CREATE_OBJECT, AML_HAS_ARGS | AML_DEFER),
/* 70 */ ACPI_OP ("ConcatenateResTemplate", ARGP_CONCAT_RES_OP, ARGI_CONCAT_RES_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 71 */ ACPI_OP ("Mod", ARGP_MOD_OP, ARGI_MOD_OP, ACPI_TYPE_ANY, AML_CLASS_EXECUTE, AML_TYPE_EXEC_2A_1T_1R, AML_FLAGS_EXEC_2A_1T_1R | AML_CONSTANT),
/* 72 */ ACPI_OP ("CreateQWordField", ARGP_CREATE_QWORD_FIELD_OP,ARGI_CREATE_QWORD_FIELD_OP, ACPI_TYPE_BUFFER_FIELD, AML_CLASS_CREATE, AML_TYPE_CREATE_FIELD, AML_HAS_ARGS | AML_NSOBJECT | AML_NSNODE | AML_DEFER | AML_CREATE),
@@ -766,8 +487,7 @@
*
* PARAMETERS: Opcode - The AML opcode
*
- * RETURN: A pointer to the info about the opcode. NULL if the opcode was
- * not found in the table.
+ * RETURN: A pointer to the info about the opcode.
*
* DESCRIPTION: Find AML opcode description based on the opcode.
* NOTE: This procedure must ALWAYS return a valid pointer!
@@ -778,40 +498,31 @@
AcpiPsGetOpcodeInfo (
UINT16 Opcode)
{
- ACPI_FUNCTION_NAME ("PsGetOpcodeInfo");
+ ACPI_FUNCTION_NAME (PsGetOpcodeInfo);
/*
* Detect normal 8-bit opcode or extended 16-bit opcode
*/
- switch ((UINT8) (Opcode >> 8))
+ if (!(Opcode & 0xFF00))
{
- case 0:
-
/* Simple (8-bit) opcode: 0-255, can't index beyond table */
return (&AcpiGbl_AmlOpInfo [AcpiGbl_ShortOpIndex [(UINT8) Opcode]]);
+ }
- case AML_EXTOP:
-
- /* Extended (16-bit, prefix+opcode) opcode */
-
- if (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE)
- {
- return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
- }
-
- /* Else fall through to error case below */
- /*lint -fallthrough */
-
- default:
+ if (((Opcode & 0xFF00) == AML_EXTENDED_OPCODE) &&
+ (((UINT8) Opcode) <= MAX_EXTENDED_OPCODE))
+ {
+ /* Valid extended (16-bit) opcode */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown AML opcode [%4.4X]\n", Opcode));
- break;
+ return (&AcpiGbl_AmlOpInfo [AcpiGbl_LongOpIndex [(UINT8) Opcode]]);
}
+ /* Unknown AML opcode */
- /* Default is "unknown opcode" */
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Unknown AML opcode [%4.4X]\n", Opcode));
return (&AcpiGbl_AmlOpInfo [_UNK]);
}
@@ -846,8 +557,33 @@
return (Op->Name);
#else
- return ("AE_NOT_CONFIGURED");
+ return ("OpcodeName unavailable");
#endif
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsGetArgumentCount
+ *
+ * PARAMETERS: OpType - Type associated with the AML opcode
+ *
+ * RETURN: Argument count
+ *
+ * DESCRIPTION: Obtain the number of expected arguments for an AML opcode
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiPsGetArgumentCount (
+ UINT32 OpType)
+{
+
+ if (OpType <= AML_TYPE_EXEC_6A_0T_1R)
+ {
+ return (AcpiGbl_ArgumentCount[OpType]);
+ }
+
+ return (0);
+}
Index: nssearch.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nssearch.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nssearch.c -L sys/contrib/dev/acpica/nssearch.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nssearch.c
+++ sys/contrib/dev/acpica/nssearch.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nssearch - Namespace search
- * $Revision: 103 $
+ * $Revision: 1.121 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,19 +123,28 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nssearch")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiNsSearchParentTree (
+ UINT32 TargetName,
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_OBJECT_TYPE Type,
+ ACPI_NAMESPACE_NODE **ReturnNode);
+
/*******************************************************************************
*
- * FUNCTION: AcpiNsSearchNode
+ * FUNCTION: AcpiNsSearchOneScope
*
- * PARAMETERS: *TargetName - Ascii ACPI name to search for
- * *Node - Starting node where search will begin
- * Type - Object type to match
- * **ReturnNode - Where the matched Named obj is returned
+ * PARAMETERS: TargetName - Ascii ACPI name to search for
+ * ParentNode - Starting node where search will begin
+ * Type - Object type to match
+ * ReturnNode - Where the matched Named obj is returned
*
* RETURN: Status
*
- * DESCRIPTION: Search a single level of the namespace. Performs a
+ * DESCRIPTION: Search a single level of the namespace. Performs a
* simple search of the specified level, and does not add
* entries or search parents.
*
@@ -145,23 +154,28 @@
*
* All namespace searching is linear in this implementation, but
* could be easily modified to support any improved search
- * algorithm. However, the linear search was chosen for simplicity
+ * algorithm. However, the linear search was chosen for simplicity
* and because the trees are small and the other interpreter
* execution overhead is relatively high.
*
+ * Note: CPU execution analysis has shown that the AML interpreter spends
+ * a very small percentage of its time searching the namespace. Therefore,
+ * the linear search seems to be sufficient, as there would seem to be
+ * little value in improving the search.
+ *
******************************************************************************/
ACPI_STATUS
-AcpiNsSearchNode (
+AcpiNsSearchOneScope (
UINT32 TargetName,
- ACPI_NAMESPACE_NODE *Node,
+ ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OBJECT_TYPE Type,
ACPI_NAMESPACE_NODE **ReturnNode)
{
- ACPI_NAMESPACE_NODE *NextNode;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("NsSearchNode");
+ ACPI_FUNCTION_TRACE (NsSearchOneScope);
#ifdef ACPI_DEBUG_OUTPUT
@@ -169,15 +183,15 @@
{
char *ScopeName;
- ScopeName = AcpiNsGetExternalPathname (Node);
+ ScopeName = AcpiNsGetExternalPathname (ParentNode);
if (ScopeName)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching %s (%p) For [%4.4s] (%s)\n",
- ScopeName, Node, (char *) &TargetName,
+ ScopeName, ParentNode, ACPI_CAST_PTR (char, &TargetName),
AcpiUtGetTypeName (Type)));
- ACPI_MEM_FREE (ScopeName);
+ ACPI_FREE (ScopeName);
}
}
#endif
@@ -186,29 +200,29 @@
* Search for name at this namespace level, which is to say that we
* must search for the name among the children of this object
*/
- NextNode = Node->Child;
- while (NextNode)
+ Node = ParentNode->Child;
+ while (Node)
{
/* Check for match against the name */
- if (NextNode->Name.Integer == TargetName)
+ if (Node->Name.Integer == TargetName)
{
/* Resolve a control method alias if any */
- if (AcpiNsGetType (NextNode) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
+ if (AcpiNsGetType (Node) == ACPI_TYPE_LOCAL_METHOD_ALIAS)
{
- NextNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, NextNode->Object);
+ Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Node->Object);
}
- /*
- * Found matching entry.
- */
+ /* Found matching entry */
+
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Name [%4.4s] (%s) %p found in scope [%4.4s] %p\n",
- (char *) &TargetName, AcpiUtGetTypeName (NextNode->Type),
- NextNode, AcpiUtGetNodeName (Node), Node));
+ ACPI_CAST_PTR (char, &TargetName),
+ AcpiUtGetTypeName (Node->Type),
+ Node, AcpiUtGetNodeName (ParentNode), ParentNode));
- *ReturnNode = NextNode;
+ *ReturnNode = Node;
return_ACPI_STATUS (AE_OK);
}
@@ -216,7 +230,7 @@
* The last entry in the list points back to the parent,
* so a flag is used to indicate the end-of-list
*/
- if (NextNode->Flags & ANOBJ_END_OF_PEER_LIST)
+ if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
{
/* Searched entire list, we are done */
@@ -225,15 +239,15 @@
/* Didn't match name, move on to the next peer object */
- NextNode = NextNode->Peer;
+ Node = Node->Peer;
}
/* Searched entire namespace level, not found */
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Name [%4.4s] (%s) not found in search in scope [%4.4s] %p first child %p\n",
- (char *) &TargetName, AcpiUtGetTypeName (Type),
- AcpiUtGetNodeName (Node), Node, Node->Child));
+ ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type),
+ AcpiUtGetNodeName (ParentNode), ParentNode, ParentNode->Child));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -243,22 +257,22 @@
*
* FUNCTION: AcpiNsSearchParentTree
*
- * PARAMETERS: *TargetName - Ascii ACPI name to search for
- * *Node - Starting node where search will begin
- * Type - Object type to match
- * **ReturnNode - Where the matched Node is returned
+ * PARAMETERS: TargetName - Ascii ACPI name to search for
+ * Node - Starting node where search will begin
+ * Type - Object type to match
+ * ReturnNode - Where the matched Node is returned
*
* RETURN: Status
*
* DESCRIPTION: Called when a name has not been found in the current namespace
- * level. Before adding it or giving up, ACPI scope rules require
+ * level. Before adding it or giving up, ACPI scope rules require
* searching enclosing scopes in cases identified by AcpiNsLocal().
*
* "A name is located by finding the matching name in the current
* name space, and then in the parent name space. If the parent
* name space does not contain the name, the search continues
* recursively until either the name is found or the name space
- * does not have a parent (the root of the name space). This
+ * does not have a parent (the root of the name space). This
* indicates that the name is not found" (From ACPI Specification,
* section 5.3)
*
@@ -275,7 +289,7 @@
ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_FUNCTION_TRACE ("NsSearchParentTree");
+ ACPI_FUNCTION_TRACE (NsSearchParentTree);
ParentNode = AcpiNsGetParentNode (Node);
@@ -287,7 +301,7 @@
if (!ParentNode)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES, "[%4.4s] has no parent\n",
- (char *) &TargetName));
+ ACPI_CAST_PTR (char, &TargetName)));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -295,7 +309,7 @@
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"[%4.4s] type [%s] must be local to this scope (no parent search)\n",
- (char *) &TargetName, AcpiUtGetTypeName (Type)));
+ ACPI_CAST_PTR (char, &TargetName), AcpiUtGetTypeName (Type)));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -303,7 +317,7 @@
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Searching parent [%4.4s] for [%4.4s]\n",
- AcpiUtGetNodeName (ParentNode), (char *) &TargetName));
+ AcpiUtGetNodeName (ParentNode), ACPI_CAST_PTR (char, &TargetName)));
/*
* Search parents until target is found or we have backed up to the root
@@ -311,21 +325,19 @@
while (ParentNode)
{
/*
- * Search parent scope. Use TYPE_ANY because we don't care about the
+ * Search parent scope. Use TYPE_ANY because we don't care about the
* object type at this point, we only care about the existence of
- * the actual name we are searching for. Typechecking comes later.
+ * the actual name we are searching for. Typechecking comes later.
*/
- Status = AcpiNsSearchNode (TargetName, ParentNode,
- ACPI_TYPE_ANY, ReturnNode);
+ Status = AcpiNsSearchOneScope (
+ TargetName, ParentNode, ACPI_TYPE_ANY, ReturnNode);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
}
- /*
- * Not found here, go up another level
- * (until we reach the root)
- */
+ /* Not found here, go up another level (until we reach the root) */
+
ParentNode = AcpiNsGetParentNode (ParentNode);
}
@@ -341,17 +353,17 @@
*
* PARAMETERS: TargetName - Ascii ACPI name to search for (4 chars)
* WalkState - Current state of the walk
- * *Node - Starting node where search will begin
+ * Node - Starting node where search will begin
* InterpreterMode - Add names only in ACPI_MODE_LOAD_PASS_x.
* Otherwise,search only.
* Type - Object type to match
* Flags - Flags describing the search restrictions
- * **ReturnNode - Where the Node is returned
+ * ReturnNode - Where the Node is returned
*
* RETURN: Status
*
* DESCRIPTION: Search for a name segment in a single namespace level,
- * optionally adding it if it is not found. If the passed
+ * optionally adding it if it is not found. If the passed
* Type is not Any and the type previously stored in the
* entry was Any (i.e. unknown), update the stored type.
*
@@ -374,34 +386,52 @@
ACPI_NAMESPACE_NODE *NewNode;
- ACPI_FUNCTION_TRACE ("NsSearchAndEnter");
+ ACPI_FUNCTION_TRACE (NsSearchAndEnter);
/* Parameter validation */
if (!Node || !TargetName || !ReturnNode)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null param: Node %p Name %X ReturnNode %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Null parameter: Node %p Name %X ReturnNode %p",
Node, TargetName, ReturnNode));
-
- ACPI_REPORT_ERROR (("NsSearchAndEnter: Null parameter\n"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Name must consist of printable characters */
-
+ /*
+ * Name must consist of valid ACPI characters. We will repair the name if
+ * necessary because we don't want to abort because of this, but we want
+ * all namespace names to be printable. A warning message is appropriate.
+ *
+ * This issue came up because there are in fact machines that exhibit
+ * this problem, and we want to be able to enable ACPI support for them,
+ * even though there are a few bad names.
+ */
if (!AcpiUtValidAcpiName (TargetName))
{
- ACPI_REPORT_ERROR (("NsSearchAndEnter: Bad character in ACPI Name: %X\n",
- TargetName));
- return_ACPI_STATUS (AE_BAD_CHARACTER);
+ TargetName = AcpiUtRepairName (ACPI_CAST_PTR (char, &TargetName));
+
+ /* Report warning only if in strict mode or debug mode */
+
+ if (!AcpiGbl_EnableInterpreterSlack)
+ {
+ ACPI_WARNING ((AE_INFO,
+ "Found bad character(s) in name, repaired: [%4.4s]\n",
+ ACPI_CAST_PTR (char, &TargetName)));
+ }
+ else
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
+ "Found bad character(s) in name, repaired: [%4.4s]\n",
+ ACPI_CAST_PTR (char, &TargetName)));
+ }
}
/* Try to find the name in the namespace level specified by the caller */
*ReturnNode = ACPI_ENTRY_NOT_FOUND;
- Status = AcpiNsSearchNode (TargetName, Node, Type, ReturnNode);
+ Status = AcpiNsSearchOneScope (TargetName, Node, Type, ReturnNode);
if (Status != AE_NOT_FOUND)
{
/*
@@ -414,18 +444,16 @@
Status = AE_ALREADY_EXISTS;
}
- /*
- * Either found it or there was an error
- * -- finished either way
- */
+ /* Either found it or there was an error: finished either way */
+
return_ACPI_STATUS (Status);
}
/*
- * The name was not found. If we are NOT performing the first pass
+ * The name was not found. If we are NOT performing the first pass
* (name entry) of loading the namespace, search the parent tree (all the
* way to the root if necessary.) We don't want to perform the parent
- * search when the namespace is actually being loaded. We want to perform
+ * search when the namespace is actually being loaded. We want to perform
* the search when namespace references are being resolved (load pass 2)
* and during the execution phase.
*/
@@ -443,14 +471,13 @@
}
}
- /*
- * In execute mode, just search, never add names. Exit now.
- */
+ /* In execute mode, just search, never add names. Exit now */
+
if (InterpreterMode == ACPI_IMODE_EXECUTE)
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"%4.4s Not found in %p [Not adding]\n",
- (char *) &TargetName, Node));
+ ACPI_CAST_PTR (char, &TargetName), Node));
return_ACPI_STATUS (AE_NOT_FOUND);
}
@@ -463,11 +490,25 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
+#ifdef ACPI_ASL_COMPILER
+ /*
+ * Node is an object defined by an External() statement
+ */
+ if (Flags & ACPI_NS_EXTERNAL)
+ {
+ NewNode->Flags |= ANOBJ_IS_EXTERNAL;
+ }
+#endif
+
+ if (Flags & ACPI_NS_TEMPORARY)
+ {
+ NewNode->Flags |= ANOBJ_TEMPORARY;
+ }
+
/* Install the new object into the parent's list of children */
AcpiNsInstallNode (WalkState, Node, NewNode, Type);
*ReturnNode = NewNode;
-
return_ACPI_STATUS (AE_OK);
}
Index: exfldio.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exfldio.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exfldio.c -L sys/contrib/dev/acpica/exfldio.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exfldio.c
+++ sys/contrib/dev/acpica/exfldio.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exfldio - Aml Field I/O
- * $Revision: 111 $
+ * $Revision: 1.128 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,12 +127,31 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exfldio")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiExFieldDatumIo (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset,
+ ACPI_INTEGER *Value,
+ UINT32 ReadWrite);
+
+static BOOLEAN
+AcpiExRegisterOverflow (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_INTEGER Value);
+
+static ACPI_STATUS
+AcpiExSetupRegion (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset);
+
/*******************************************************************************
*
* FUNCTION: AcpiExSetupRegion
*
- * PARAMETERS: *ObjDesc - Field to be read or written
+ * PARAMETERS: ObjDesc - Field to be read or written
* FieldDatumByteOffset - Byte offset of this datum within the
* parent field
*
@@ -144,7 +163,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExSetupRegion (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 FieldDatumByteOffset)
@@ -153,7 +172,7 @@
ACPI_OPERAND_OBJECT *RgnDesc;
- ACPI_FUNCTION_TRACE_U32 ("ExSetupRegion", FieldDatumByteOffset);
+ ACPI_FUNCTION_TRACE_U32 (ExSetupRegion, FieldDatumByteOffset);
RgnDesc = ObjDesc->CommonField.RegionObj;
@@ -162,7 +181,7 @@
if (ACPI_GET_OBJECT_TYPE (RgnDesc) != ACPI_TYPE_REGION)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Needed Region, found type %X (%s)\n",
+ ACPI_ERROR ((AE_INFO, "Needed Region, found type %X (%s)",
ACPI_GET_OBJECT_TYPE (RgnDesc),
AcpiUtGetObjectTypeName (RgnDesc)));
@@ -182,6 +201,17 @@
}
}
+ /* Exit if Address/Length have been disallowed by the host OS */
+
+ if (RgnDesc->Common.Flags & AOPOBJ_INVALID)
+ {
+ return_ACPI_STATUS (AE_AML_ILLEGAL_ADDRESS);
+ }
+
+ /*
+ * Exit now for SMBus address space, it has a non-linear address space
+ * and the request cannot be directly validated
+ */
if (RgnDesc->Region.SpaceId == ACPI_ADR_SPACE_SMBUS)
{
/* SMBus has a non-linear address space */
@@ -208,9 +238,10 @@
* length of one field datum (access width) must fit within the region.
* (Region length is specified in bytes)
*/
- if (RgnDesc->Region.Length < (ObjDesc->CommonField.BaseByteOffset
- + FieldDatumByteOffset
- + ObjDesc->CommonField.AccessByteWidth))
+ if (RgnDesc->Region.Length <
+ (ObjDesc->CommonField.BaseByteOffset +
+ FieldDatumByteOffset +
+ ObjDesc->CommonField.AccessByteWidth))
{
if (AcpiGbl_EnableInterpreterSlack)
{
@@ -220,10 +251,10 @@
* access width boundary.
*/
if (ACPI_ROUND_UP (RgnDesc->Region.Length,
- ObjDesc->CommonField.AccessByteWidth) >=
+ ObjDesc->CommonField.AccessByteWidth) >=
(ObjDesc->CommonField.BaseByteOffset +
- (ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth +
- FieldDatumByteOffset))
+ (ACPI_NATIVE_UINT) ObjDesc->CommonField.AccessByteWidth +
+ FieldDatumByteOffset))
{
return_ACPI_STATUS (AE_OK);
}
@@ -236,23 +267,25 @@
* than the region itself. For example, a region of length one
* byte, and a field with Dword access specified.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] access width (%d bytes) too large for region [%4.4s] (length %X)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.AccessByteWidth,
- AcpiUtGetNodeName (RgnDesc->Region.Node), RgnDesc->Region.Length));
+ AcpiUtGetNodeName (RgnDesc->Region.Node),
+ RgnDesc->Region.Length));
}
/*
* Offset rounded up to next multiple of field width
* exceeds region length, indicate an error
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Field [%4.4s] Base+Offset+Width %X+%X+%X is beyond end of region [%4.4s] (length %X)",
AcpiUtGetNodeName (ObjDesc->CommonField.Node),
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset, ObjDesc->CommonField.AccessByteWidth,
- AcpiUtGetNodeName (RgnDesc->Region.Node), RgnDesc->Region.Length));
+ AcpiUtGetNodeName (RgnDesc->Region.Node),
+ RgnDesc->Region.Length));
return_ACPI_STATUS (AE_AML_REGION_LIMIT);
}
@@ -265,10 +298,10 @@
*
* FUNCTION: AcpiExAccessRegion
*
- * PARAMETERS: *ObjDesc - Field to be read
+ * PARAMETERS: ObjDesc - Field to be read
* FieldDatumByteOffset - Byte offset of this datum within the
* parent field
- * *Value - Where to store value (must at least
+ * Value - Where to store value (must at least
* the size of ACPI_INTEGER)
* Function - Read or Write flag plus other region-
* dependent flags
@@ -291,7 +324,7 @@
ACPI_PHYSICAL_ADDRESS Address;
- ACPI_FUNCTION_TRACE ("ExAccessRegion");
+ ACPI_FUNCTION_TRACE (ExAccessRegion);
/*
@@ -312,9 +345,9 @@
* 3) The current offset into the field
*/
RgnDesc = ObjDesc->CommonField.RegionObj;
- Address = RgnDesc->Region.Address
- + ObjDesc->CommonField.BaseByteOffset
- + FieldDatumByteOffset;
+ Address = RgnDesc->Region.Address +
+ ObjDesc->CommonField.BaseByteOffset +
+ FieldDatumByteOffset;
if ((Function & ACPI_IO_MASK) == ACPI_READ)
{
@@ -326,32 +359,33 @@
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_BFIELD,
- " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %8.8X%8.8X\n",
+ " Region [%s:%X], Width %X, ByteBase %X, Offset %X at %p\n",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId,
ObjDesc->CommonField.AccessByteWidth,
ObjDesc->CommonField.BaseByteOffset,
FieldDatumByteOffset,
- ACPI_FORMAT_UINT64 (Address)));
+ (void *) Address));
/* Invoke the appropriate AddressSpace/OpRegion handler */
Status = AcpiEvAddressSpaceDispatch (RgnDesc, Function,
- Address, ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
+ Address,
+ ACPI_MUL_8 (ObjDesc->CommonField.AccessByteWidth), Value);
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_IMPLEMENTED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Region %s(%X) not implemented\n",
+ ACPI_ERROR ((AE_INFO,
+ "Region %s(%X) not implemented",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
else if (Status == AE_NOT_EXIST)
{
- ACPI_REPORT_ERROR ((
- "Region %s(%X) has no handler\n",
+ ACPI_ERROR ((AE_INFO,
+ "Region %s(%X) has no handler",
AcpiUtGetRegionName (RgnDesc->Region.SpaceId),
RgnDesc->Region.SpaceId));
}
@@ -365,7 +399,7 @@
*
* FUNCTION: AcpiExRegisterOverflow
*
- * PARAMETERS: *ObjDesc - Register(Field) to be written
+ * PARAMETERS: ObjDesc - Register(Field) to be written
* Value - Value to be stored
*
* RETURN: TRUE if value overflows the field, FALSE otherwise
@@ -378,7 +412,7 @@
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
AcpiExRegisterOverflow (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_INTEGER Value)
@@ -412,10 +446,10 @@
*
* FUNCTION: AcpiExFieldDatumIo
*
- * PARAMETERS: *ObjDesc - Field to be read
+ * PARAMETERS: ObjDesc - Field to be read
* FieldDatumByteOffset - Byte offset of this datum within the
* parent field
- * *Value - Where to store value (must be 64 bits)
+ * Value - Where to store value (must be 64 bits)
* ReadWrite - Read or Write flag
*
* RETURN: Status
@@ -426,7 +460,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExFieldDatumIo (
ACPI_OPERAND_OBJECT *ObjDesc,
UINT32 FieldDatumByteOffset,
@@ -437,7 +471,7 @@
ACPI_INTEGER LocalValue;
- ACPI_FUNCTION_TRACE_U32 ("ExFieldDatumIo", FieldDatumByteOffset);
+ ACPI_FUNCTION_TRACE_U32 (ExFieldDatumIo, FieldDatumByteOffset);
if (ReadWrite == ACPI_READ)
@@ -445,7 +479,9 @@
if (!Value)
{
LocalValue = 0;
- Value = &LocalValue; /* To support reads without saving return value */
+
+ /* To support reads without saving return value */
+ Value = &LocalValue;
}
/* Clear the entire return buffer first, [Very Important!] */
@@ -458,8 +494,10 @@
*
* BufferField - Read/write from/to a Buffer
* RegionField - Read/write from/to a Operation Region.
- * BankField - Write to a Bank Register, then read/write from/to an OpRegion
- * IndexField - Write to an Index Register, then read/write from/to a Data Register
+ * BankField - Write to a Bank Register, then read/write from/to an
+ * OperationRegion
+ * IndexField - Write to an Index Register, then read/write from/to a
+ * Data Register
*/
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
@@ -483,10 +521,11 @@
* Copy the data from the source buffer.
* Length is the field width in bytes.
*/
- ACPI_MEMCPY (Value, (ObjDesc->BufferField.BufferObj)->Buffer.Pointer
- + ObjDesc->BufferField.BaseByteOffset
- + FieldDatumByteOffset,
- ObjDesc->CommonField.AccessByteWidth);
+ ACPI_MEMCPY (Value,
+ (ObjDesc->BufferField.BufferObj)->Buffer.Pointer +
+ ObjDesc->BufferField.BaseByteOffset +
+ FieldDatumByteOffset,
+ ObjDesc->CommonField.AccessByteWidth);
}
else
{
@@ -494,10 +533,10 @@
* Copy the data to the target buffer.
* Length is the field width in bytes.
*/
- ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer
- + ObjDesc->BufferField.BaseByteOffset
- + FieldDatumByteOffset,
- Value, ObjDesc->CommonField.AccessByteWidth);
+ ACPI_MEMCPY ((ObjDesc->BufferField.BufferObj)->Buffer.Pointer +
+ ObjDesc->BufferField.BaseByteOffset +
+ FieldDatumByteOffset,
+ Value, ObjDesc->CommonField.AccessByteWidth);
}
Status = AE_OK;
@@ -506,10 +545,12 @@
case ACPI_TYPE_LOCAL_BANK_FIELD:
- /* Ensure that the BankValue is not beyond the capacity of the register */
-
+ /*
+ * Ensure that the BankValue is not beyond the capacity of
+ * the register
+ */
if (AcpiExRegisterOverflow (ObjDesc->BankField.BankObj,
- (ACPI_INTEGER) ObjDesc->BankField.Value))
+ (ACPI_INTEGER) ObjDesc->BankField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@@ -519,8 +560,8 @@
* (itself a RegionField) before we can access the data.
*/
Status = AcpiExInsertIntoField (ObjDesc->BankField.BankObj,
- &ObjDesc->BankField.Value,
- sizeof (ObjDesc->BankField.Value));
+ &ObjDesc->BankField.Value,
+ sizeof (ObjDesc->BankField.Value));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -540,17 +581,19 @@
* Operation Region.
*/
Status = AcpiExAccessRegion (ObjDesc, FieldDatumByteOffset, Value,
- ReadWrite);
+ ReadWrite);
break;
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- /* Ensure that the IndexValue is not beyond the capacity of the register */
-
+ /*
+ * Ensure that the IndexValue is not beyond the capacity of
+ * the register
+ */
if (AcpiExRegisterOverflow (ObjDesc->IndexField.IndexObj,
- (ACPI_INTEGER) ObjDesc->IndexField.Value))
+ (ACPI_INTEGER) ObjDesc->IndexField.Value))
{
return_ACPI_STATUS (AE_AML_REGISTER_LIMIT);
}
@@ -560,41 +603,40 @@
FieldDatumByteOffset += ObjDesc->IndexField.Value;
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "Write to Index Register: Value %8.8X\n",
- FieldDatumByteOffset));
+ "Write to Index Register: Value %8.8X\n",
+ FieldDatumByteOffset));
Status = AcpiExInsertIntoField (ObjDesc->IndexField.IndexObj,
- &FieldDatumByteOffset,
- sizeof (FieldDatumByteOffset));
+ &FieldDatumByteOffset,
+ sizeof (FieldDatumByteOffset));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "I/O to Data Register: ValuePtr %p\n",
- Value));
+ "I/O to Data Register: ValuePtr %p\n", Value));
if (ReadWrite == ACPI_READ)
{
/* Read the datum from the DataRegister */
Status = AcpiExExtractFromField (ObjDesc->IndexField.DataObj,
- Value, sizeof (ACPI_INTEGER));
+ Value, sizeof (ACPI_INTEGER));
}
else
{
/* Write the datum to the DataRegister */
Status = AcpiExInsertIntoField (ObjDesc->IndexField.DataObj,
- Value, sizeof (ACPI_INTEGER));
+ Value, sizeof (ACPI_INTEGER));
}
break;
default:
- ACPI_REPORT_ERROR (("Wrong object type in field I/O %X\n",
+ ACPI_ERROR ((AE_INFO, "Wrong object type in field I/O %X",
ACPI_GET_OBJECT_TYPE (ObjDesc)));
Status = AE_AML_INTERNAL;
break;
@@ -604,15 +646,17 @@
{
if (ReadWrite == ACPI_READ)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Read %8.8X%8.8X, Width %d\n",
- ACPI_FORMAT_UINT64 (*Value),
- ObjDesc->CommonField.AccessByteWidth));
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Value Read %8.8X%8.8X, Width %d\n",
+ ACPI_FORMAT_UINT64 (*Value),
+ ObjDesc->CommonField.AccessByteWidth));
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD, "Value Written %8.8X%8.8X, Width %d\n",
- ACPI_FORMAT_UINT64 (*Value),
- ObjDesc->CommonField.AccessByteWidth));
+ ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
+ "Value Written %8.8X%8.8X, Width %d\n",
+ ACPI_FORMAT_UINT64 (*Value),
+ ObjDesc->CommonField.AccessByteWidth));
}
}
@@ -624,8 +668,10 @@
*
* FUNCTION: AcpiExWriteWithUpdateRule
*
- * PARAMETERS: *ObjDesc - Field to be set
- * Value - Value to store
+ * PARAMETERS: ObjDesc - Field to be written
+ * Mask - bitmask within field datum
+ * FieldValue - Value to write
+ * FieldDatumByteOffset - Offset of datum within field
*
* RETURN: Status
*
@@ -645,7 +691,7 @@
ACPI_INTEGER CurrentValue;
- ACPI_FUNCTION_TRACE_U32 ("ExWriteWithUpdateRule", Mask);
+ ACPI_FUNCTION_TRACE_U32 (ExWriteWithUpdateRule, Mask);
/* Start with the new bits */
@@ -673,7 +719,7 @@
* the field, and merge with the new field value.
*/
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
- &CurrentValue, ACPI_READ);
+ &CurrentValue, ACPI_READ);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -699,8 +745,8 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "WriteWithUpdateRule: Unknown UpdateRule setting: %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown UpdateRule value: %X",
(ObjDesc->CommonField.FieldFlags & AML_FIELD_UPDATE_RULE_MASK)));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -717,7 +763,7 @@
/* Write the merged value */
Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
- &MergedValue, ACPI_WRITE);
+ &MergedValue, ACPI_WRITE);
return_ACPI_STATUS (Status);
}
@@ -725,213 +771,6 @@
/*******************************************************************************
*
- * FUNCTION: AcpiExGetBufferDatum
- *
- * PARAMETERS: Datum - Where the Datum is returned
- * Buffer - Raw field buffer
- * BufferLength - Entire length (used for big-endian only)
- * ByteGranularity - 1/2/4/8 Granularity of the field
- * (aka Datum Size)
- * BufferOffset - Datum offset into the buffer
- *
- * RETURN: none
- *
- * DESCRIPTION: Get a datum from the buffer according to the buffer field
- * byte granularity
- *
- ******************************************************************************/
-
-void
-AcpiExGetBufferDatum (
- ACPI_INTEGER *Datum,
- void *Buffer,
- UINT32 BufferLength,
- UINT32 ByteGranularity,
- UINT32 BufferOffset)
-{
- UINT32 Index;
-
-
- ACPI_FUNCTION_TRACE_U32 ("ExGetBufferDatum", ByteGranularity);
-
-
- /* Get proper index into buffer (handles big/little endian) */
-
- Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity);
-
- /* Move the requested number of bytes */
-
- switch (ByteGranularity)
- {
- case ACPI_FIELD_BYTE_GRANULARITY:
-
- *Datum = ((UINT8 *) Buffer) [Index];
- break;
-
- case ACPI_FIELD_WORD_GRANULARITY:
-
- ACPI_MOVE_16_TO_64 (Datum, &(((UINT16 *) Buffer) [Index]));
- break;
-
- case ACPI_FIELD_DWORD_GRANULARITY:
-
- ACPI_MOVE_32_TO_64 (Datum, &(((UINT32 *) Buffer) [Index]));
- break;
-
- case ACPI_FIELD_QWORD_GRANULARITY:
-
- ACPI_MOVE_64_TO_64 (Datum, &(((UINT64 *) Buffer) [Index]));
- break;
-
- default:
- /* Should not get here */
- break;
- }
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiExSetBufferDatum
- *
- * PARAMETERS: MergedDatum - Value to store
- * Buffer - Receiving buffer
- * BufferLength - Entire length (used for big-endian only)
- * ByteGranularity - 1/2/4/8 Granularity of the field
- * (aka Datum Size)
- * BufferOffset - Datum offset into the buffer
- *
- * RETURN: none
- *
- * DESCRIPTION: Store the merged datum to the buffer according to the
- * byte granularity
- *
- ******************************************************************************/
-
-void
-AcpiExSetBufferDatum (
- ACPI_INTEGER MergedDatum,
- void *Buffer,
- UINT32 BufferLength,
- UINT32 ByteGranularity,
- UINT32 BufferOffset)
-{
- UINT32 Index;
-
-
- ACPI_FUNCTION_TRACE_U32 ("ExSetBufferDatum", ByteGranularity);
-
-
- /* Get proper index into buffer (handles big/little endian) */
-
- Index = ACPI_BUFFER_INDEX (BufferLength, BufferOffset, ByteGranularity);
-
- /* Move the requested number of bytes */
-
- switch (ByteGranularity)
- {
- case ACPI_FIELD_BYTE_GRANULARITY:
-
- ((UINT8 *) Buffer) [Index] = (UINT8) MergedDatum;
- break;
-
- case ACPI_FIELD_WORD_GRANULARITY:
-
- ACPI_MOVE_64_TO_16 (&(((UINT16 *) Buffer)[Index]), &MergedDatum);
- break;
-
- case ACPI_FIELD_DWORD_GRANULARITY:
-
- ACPI_MOVE_64_TO_32 (&(((UINT32 *) Buffer)[Index]), &MergedDatum);
- break;
-
- case ACPI_FIELD_QWORD_GRANULARITY:
-
- ACPI_MOVE_64_TO_64 (&(((UINT64 *) Buffer)[Index]), &MergedDatum);
- break;
-
- default:
- /* Should not get here */
- break;
- }
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiExCommonBufferSetup
- *
- * PARAMETERS: ObjDesc - Field object
- * BufferLength - Length of caller's buffer
- * DatumCount - Where the DatumCount is returned
- *
- * RETURN: Status, DatumCount
- *
- * DESCRIPTION: Common code to validate the incoming buffer size and compute
- * the number of field "datums" that must be read or written.
- * A "datum" is the smallest unit that can be read or written
- * to the field, it is either 1,2,4, or 8 bytes.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExCommonBufferSetup (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 BufferLength,
- UINT32 *DatumCount)
-{
- UINT32 ByteFieldLength;
- UINT32 ActualByteFieldLength;
-
-
- ACPI_FUNCTION_TRACE ("ExCommonBufferSetup");
-
-
- /*
- * Incoming buffer must be at least as long as the field, we do not
- * allow "partial" field reads/writes. We do not care if the buffer is
- * larger than the field, this typically happens when an integer is
- * read/written to a field that is actually smaller than an integer.
- */
- ByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (
- ObjDesc->CommonField.BitLength);
- if (ByteFieldLength > BufferLength)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "Field size %X (bytes) is too large for buffer (%X)\n",
- ByteFieldLength, BufferLength));
-
- return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
- }
-
- /*
- * Create "actual" field byte count (minimum number of bytes that
- * must be read), then convert to datum count (minimum number
- * of datum-sized units that must be read)
- */
- ActualByteFieldLength = ACPI_ROUND_BITS_UP_TO_BYTES (
- ObjDesc->CommonField.StartFieldBitOffset +
- ObjDesc->CommonField.BitLength);
-
-
- *DatumCount = ACPI_ROUND_UP_TO (ActualByteFieldLength,
- ObjDesc->CommonField.AccessByteWidth);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_BFIELD,
- "BufferBytes %X, ActualBytes %X, Datums %X, ByteGran %X\n",
- ByteFieldLength, ActualByteFieldLength,
- *DatumCount, ObjDesc->CommonField.AccessByteWidth));
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiExExtractFromField
*
* PARAMETERS: ObjDesc - Field to be read
@@ -951,139 +790,111 @@
UINT32 BufferLength)
{
ACPI_STATUS Status;
- UINT32 FieldDatumByteOffset;
- UINT32 BufferDatumOffset;
- ACPI_INTEGER PreviousRawDatum = 0;
- ACPI_INTEGER ThisRawDatum = 0;
- ACPI_INTEGER MergedDatum = 0;
+ ACPI_INTEGER RawDatum;
+ ACPI_INTEGER MergedDatum;
+ UINT32 FieldOffset = 0;
+ UINT32 BufferOffset = 0;
+ UINT32 BufferTailBits;
UINT32 DatumCount;
+ UINT32 FieldDatumCount;
UINT32 i;
- ACPI_FUNCTION_TRACE ("ExExtractFromField");
+ ACPI_FUNCTION_TRACE (ExExtractFromField);
- /* Validate buffer, compute number of datums */
+ /* Validate target buffer and clear it */
- Status = AcpiExCommonBufferSetup (ObjDesc, BufferLength, &DatumCount);
- if (ACPI_FAILURE (Status))
+ if (BufferLength <
+ ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
{
- return_ACPI_STATUS (Status);
- }
+ ACPI_ERROR ((AE_INFO,
+ "Field size %X (bits) is too large for buffer (%X)",
+ ObjDesc->CommonField.BitLength, BufferLength));
- /*
- * Clear the caller's buffer (the whole buffer length as given)
- * This is very important, especially in the cases where the buffer
- * is longer than the size of the field.
- */
+ return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ }
ACPI_MEMSET (Buffer, 0, BufferLength);
- FieldDatumByteOffset = 0;
- BufferDatumOffset= 0;
-
- /* Read the entire field */
-
- for (i = 0; i < DatumCount; i++)
- {
- Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
- &ThisRawDatum, ACPI_READ);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* We might actually be done if the request fits in one datum */
-
- if ((DatumCount == 1) &&
- (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))
- {
- /* 1) Shift the valid data bits down to start at bit 0 */
+ /* Compute the number of datums (access width data items) */
- MergedDatum = (ThisRawDatum >> ObjDesc->CommonField.StartFieldBitOffset);
+ DatumCount = ACPI_ROUND_UP_TO (
+ ObjDesc->CommonField.BitLength,
+ ObjDesc->CommonField.AccessBitWidth);
+ FieldDatumCount = ACPI_ROUND_UP_TO (
+ ObjDesc->CommonField.BitLength +
+ ObjDesc->CommonField.StartFieldBitOffset,
+ ObjDesc->CommonField.AccessBitWidth);
- /* 2) Mask off any upper unused bits (bits not part of the field) */
+ /* Priming read from the field */
- if (ObjDesc->CommonField.EndBufferValidBits)
- {
- MergedDatum &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndBufferValidBits);
- }
-
- /* Store the datum to the caller buffer */
+ Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset, &RawDatum, ACPI_READ);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset;
- AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
- ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset);
+ /* Read the rest of the field */
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Special handling for the last datum to ignore extra bits */
+ for (i = 1; i < FieldDatumCount; i++)
+ {
+ /* Get next input datum from the field */
- if ((i >= (DatumCount -1)) &&
- (ObjDesc->CommonField.EndFieldValidBits))
+ FieldOffset += ObjDesc->CommonField.AccessByteWidth;
+ Status = AcpiExFieldDatumIo (ObjDesc, FieldOffset,
+ &RawDatum, ACPI_READ);
+ if (ACPI_FAILURE (Status))
{
- /*
- * This is the last iteration of the loop. We need to clear
- * any unused bits (bits that are not part of this field) before
- * we store the final merged datum into the caller buffer.
- */
- ThisRawDatum &=
- ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
+ return_ACPI_STATUS (Status);
}
/*
- * Create the (possibly) merged datum to be stored to the caller buffer
+ * Merge with previous datum if necessary.
+ *
+ * Note: Before the shift, check if the shift value will be larger than
+ * the integer size. If so, there is no need to perform the operation.
+ * This avoids the differences in behavior between different compilers
+ * concerning shift values larger than the target data width.
*/
- if (ObjDesc->CommonField.StartFieldBitOffset == 0)
+ if ((ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
{
- /* Field is not skewed and we can just copy the datum */
-
- AcpiExSetBufferDatum (ThisRawDatum, Buffer, BufferLength,
- ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset);
- BufferDatumOffset++;
+ MergedDatum |= RawDatum <<
+ (ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset);
}
- else
- {
- /* Not aligned -- on the first iteration, just save the datum */
-
- if (i != 0)
- {
- /*
- * Put together the appropriate bits of the two raw data to make a
- * single complete field datum
- *
- * 1) Normalize the first datum down to bit 0
- */
- MergedDatum = (PreviousRawDatum >> ObjDesc->CommonField.StartFieldBitOffset);
-
- /* 2) Insert the second datum "above" the first datum */
- MergedDatum |= (ThisRawDatum << ObjDesc->CommonField.DatumValidBits);
+ if (i == DatumCount)
+ {
+ break;
+ }
- AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
- ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset);
- BufferDatumOffset++;
- }
+ /* Write merged datum to target buffer */
- /*
- * Save the raw datum that was just acquired since it may contain bits
- * of the *next* field datum
- */
- PreviousRawDatum = ThisRawDatum;
- }
+ ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
+ ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
+ BufferLength - BufferOffset));
- FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth;
+ BufferOffset += ObjDesc->CommonField.AccessByteWidth;
+ MergedDatum = RawDatum >> ObjDesc->CommonField.StartFieldBitOffset;
}
- /* For non-aligned case, there is one last datum to insert */
+ /* Mask off any extra bits in the last datum */
- if (ObjDesc->CommonField.StartFieldBitOffset != 0)
+ BufferTailBits = ObjDesc->CommonField.BitLength %
+ ObjDesc->CommonField.AccessBitWidth;
+ if (BufferTailBits)
{
- MergedDatum = (ThisRawDatum >> ObjDesc->CommonField.StartFieldBitOffset);
-
- AcpiExSetBufferDatum (MergedDatum, Buffer, BufferLength,
- ObjDesc->CommonField.AccessByteWidth, BufferDatumOffset);
+ MergedDatum &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
}
+ /* Write the last datum to the buffer */
+
+ ACPI_MEMCPY (((char *) Buffer) + BufferOffset, &MergedDatum,
+ ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
+ BufferLength - BufferOffset));
+
return_ACPI_STATUS (AE_OK);
}
@@ -1109,181 +920,136 @@
UINT32 BufferLength)
{
ACPI_STATUS Status;
- UINT32 FieldDatumByteOffset;
- UINT32 DatumOffset;
ACPI_INTEGER Mask;
+ ACPI_INTEGER WidthMask;
ACPI_INTEGER MergedDatum;
- ACPI_INTEGER PreviousRawDatum;
- ACPI_INTEGER ThisRawDatum;
+ ACPI_INTEGER RawDatum = 0;
+ UINT32 FieldOffset = 0;
+ UINT32 BufferOffset = 0;
+ UINT32 BufferTailBits;
UINT32 DatumCount;
+ UINT32 FieldDatumCount;
+ UINT32 i;
- ACPI_FUNCTION_TRACE ("ExInsertIntoField");
+ ACPI_FUNCTION_TRACE (ExInsertIntoField);
- /* Validate buffer, compute number of datums */
+ /* Validate input buffer */
- Status = AcpiExCommonBufferSetup (ObjDesc, BufferLength, &DatumCount);
- if (ACPI_FAILURE (Status))
+ if (BufferLength <
+ ACPI_ROUND_BITS_UP_TO_BYTES (ObjDesc->CommonField.BitLength))
{
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Break the request into up to three parts (similar to an I/O request):
- * 1) non-aligned part at start
- * 2) aligned part in middle
- * 3) non-aligned part at the end
- */
- FieldDatumByteOffset = 0;
- DatumOffset= 0;
+ ACPI_ERROR ((AE_INFO,
+ "Field size %X (bits) is too large for buffer (%X)",
+ ObjDesc->CommonField.BitLength, BufferLength));
- /* Get a single datum from the caller's buffer */
-
- AcpiExGetBufferDatum (&PreviousRawDatum, Buffer, BufferLength,
- ObjDesc->CommonField.AccessByteWidth, DatumOffset);
+ return_ACPI_STATUS (AE_BUFFER_OVERFLOW);
+ }
/*
- * Part1:
- * Write a partial field datum if field does not begin on a datum boundary
- * Note: The code in this section also handles the aligned case
- *
- * Construct Mask with 1 bits where the field is, 0 bits elsewhere
- * (Only the bottom 5 bits of BitLength are valid for a shift operation)
- *
- * Mask off bits that are "below" the field (if any)
+ * Create the bitmasks used for bit insertion.
+ * Note: This if/else is used to bypass compiler differences with the
+ * shift operator
*/
- Mask = ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
-
- /* If the field fits in one datum, may need to mask upper bits */
-
- if ((ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM) &&
- ObjDesc->CommonField.EndFieldValidBits)
+ if (ObjDesc->CommonField.AccessBitWidth == ACPI_INTEGER_BIT_SIZE)
{
- /* There are bits above the field, mask them off also */
-
- Mask &= ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
+ WidthMask = ACPI_INTEGER_MAX;
+ }
+ else
+ {
+ WidthMask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.AccessBitWidth);
}
- /* Shift and mask the value into the field position */
+ Mask = WidthMask &
+ ACPI_MASK_BITS_BELOW (ObjDesc->CommonField.StartFieldBitOffset);
- MergedDatum = (PreviousRawDatum << ObjDesc->CommonField.StartFieldBitOffset);
- MergedDatum &= Mask;
+ /* Compute the number of datums (access width data items) */
- /* Apply the update rule (if necessary) and write the datum to the field */
+ DatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength,
+ ObjDesc->CommonField.AccessBitWidth);
- Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum,
- FieldDatumByteOffset);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ FieldDatumCount = ACPI_ROUND_UP_TO (ObjDesc->CommonField.BitLength +
+ ObjDesc->CommonField.StartFieldBitOffset,
+ ObjDesc->CommonField.AccessBitWidth);
- /* We just wrote the first datum */
+ /* Get initial Datum from the input buffer */
- DatumOffset++;
+ ACPI_MEMCPY (&RawDatum, Buffer,
+ ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
+ BufferLength - BufferOffset));
- /* If the entire field fits within one datum, we are done. */
+ MergedDatum = RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
- if ((DatumCount == 1) &&
- (ObjDesc->CommonField.Flags & AOPOBJ_SINGLE_DATUM))
- {
- return_ACPI_STATUS (AE_OK);
- }
+ /* Write the entire field */
- /*
- * Part2:
- * Write the aligned data.
- *
- * We don't need to worry about the update rule for these data, because
- * all of the bits in each datum are part of the field.
- *
- * The last datum must be special cased because it might contain bits
- * that are not part of the field -- therefore the "update rule" must be
- * applied in Part3 below.
- */
- while (DatumOffset < DatumCount)
+ for (i = 1; i < FieldDatumCount; i++)
{
- FieldDatumByteOffset += ObjDesc->CommonField.AccessByteWidth;
-
- /*
- * Get the next raw buffer datum. It may contain bits of the previous
- * field datum
- */
- AcpiExGetBufferDatum (&ThisRawDatum, Buffer, BufferLength,
- ObjDesc->CommonField.AccessByteWidth, DatumOffset);
+ /* Write merged datum to the target field */
- /* Create the field datum based on the field alignment */
-
- if (ObjDesc->CommonField.StartFieldBitOffset != 0)
+ MergedDatum &= Mask;
+ Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask,
+ MergedDatum, FieldOffset);
+ if (ACPI_FAILURE (Status))
{
- /*
- * Put together appropriate bits of the two raw buffer data to make
- * a single complete field datum
- */
- MergedDatum =
- (PreviousRawDatum >> ObjDesc->CommonField.DatumValidBits) |
- (ThisRawDatum << ObjDesc->CommonField.StartFieldBitOffset);
+ return_ACPI_STATUS (Status);
}
- else
- {
- /* Field began aligned on datum boundary */
- MergedDatum = ThisRawDatum;
- }
+ FieldOffset += ObjDesc->CommonField.AccessByteWidth;
/*
- * Special handling for the last datum if the field does NOT end on
- * a datum boundary. Update Rule must be applied to the bits outside
- * the field.
+ * Start new output datum by merging with previous input datum
+ * if necessary.
+ *
+ * Note: Before the shift, check if the shift value will be larger than
+ * the integer size. If so, there is no need to perform the operation.
+ * This avoids the differences in behavior between different compilers
+ * concerning shift values larger than the target data width.
*/
- DatumOffset++;
- if ((DatumOffset == DatumCount) &&
- (ObjDesc->CommonField.EndFieldValidBits))
+ if ((ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset) < ACPI_INTEGER_BIT_SIZE)
{
- /*
- * If there are dangling non-aligned bits, perform one more merged write
- * Else - field is aligned at the end, no need for any more writes
- */
-
- /*
- * Part3:
- * This is the last datum and the field does not end on a datum boundary.
- * Build the partial datum and write with the update rule.
- *
- * Mask off the unused bits above (after) the end-of-field
- */
- Mask = ACPI_MASK_BITS_ABOVE (ObjDesc->CommonField.EndFieldValidBits);
- MergedDatum &= Mask;
-
- /* Write the last datum with the update rule */
-
- Status = AcpiExWriteWithUpdateRule (ObjDesc, Mask, MergedDatum,
- FieldDatumByteOffset);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ MergedDatum = RawDatum >>
+ (ObjDesc->CommonField.AccessBitWidth -
+ ObjDesc->CommonField.StartFieldBitOffset);
}
else
{
- /* Normal (aligned) case -- write the completed datum */
+ MergedDatum = 0;
+ }
- Status = AcpiExFieldDatumIo (ObjDesc, FieldDatumByteOffset,
- &MergedDatum, ACPI_WRITE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ Mask = WidthMask;
+
+ if (i == DatumCount)
+ {
+ break;
}
- /*
- * Save the most recent datum since it may contain bits of the *next*
- * field datum. Update current byte offset.
- */
- PreviousRawDatum = ThisRawDatum;
+ /* Get the next input datum from the buffer */
+
+ BufferOffset += ObjDesc->CommonField.AccessByteWidth;
+ ACPI_MEMCPY (&RawDatum, ((char *) Buffer) + BufferOffset,
+ ACPI_MIN(ObjDesc->CommonField.AccessByteWidth,
+ BufferLength - BufferOffset));
+ MergedDatum |= RawDatum << ObjDesc->CommonField.StartFieldBitOffset;
}
+ /* Mask off any extra bits in the last datum */
+
+ BufferTailBits = (ObjDesc->CommonField.BitLength +
+ ObjDesc->CommonField.StartFieldBitOffset) %
+ ObjDesc->CommonField.AccessBitWidth;
+ if (BufferTailBits)
+ {
+ Mask &= ACPI_MASK_BITS_ABOVE (BufferTailBits);
+ }
+
+ /* Write the last datum to the field */
+
+ MergedDatum &= Mask;
+ Status = AcpiExWriteWithUpdateRule (ObjDesc,
+ Mask, MergedDatum, FieldOffset);
+
return_ACPI_STATUS (Status);
}
Index: achware.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/achware.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/achware.h -L sys/contrib/dev/acpica/achware.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/achware.h
+++ sys/contrib/dev/acpica/achware.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: achware.h -- hardware specific interfaces
- * $Revision: 73 $
+ * $Revision: 1.83 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,24 +119,24 @@
/* PM Timer ticks per second (HZ) */
-#define PM_TIMER_FREQUENCY 3579545
+#define PM_TIMER_FREQUENCY 3579545
-/* Prototypes */
+/* Values for the _SST reserved method */
+#define ACPI_SST_INDICATOR_OFF 0
+#define ACPI_SST_WORKING 1
+#define ACPI_SST_WAKING 2
+#define ACPI_SST_SLEEPING 3
+#define ACPI_SST_SLEEP_CONTEXT 4
-ACPI_STATUS
-AcpiHwInitialize (
- void);
-ACPI_STATUS
-AcpiHwShutdown (
- void);
+/* Prototypes */
-ACPI_STATUS
-AcpiHwInitializeSystemInfo (
- void);
+/*
+ * hwacpi - high level functions
+ */
ACPI_STATUS
AcpiHwSetMode (
UINT32 Mode);
@@ -145,12 +145,10 @@
AcpiHwGetMode (
void);
-UINT32
-AcpiHwGetModeCapabilities (
- void);
-
-/* Register I/O Prototypes */
+/*
+ * hwregs - ACPI Register I/O
+ */
ACPI_BIT_REGISTER_INFO *
AcpiHwGetBitRegisterInfo (
UINT32 RegisterId);
@@ -181,11 +179,12 @@
ACPI_STATUS
AcpiHwClearAcpiStatus (
- UINT32 Flags);
-
+ void);
-/* GPE support */
+/*
+ * hwgpe - GPE support
+ */
ACPI_STATUS
AcpiHwWriteGpeEnableReg (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
@@ -211,29 +210,25 @@
ACPI_STATUS
AcpiHwDisableAllGpes (
- UINT32 Flags);
+ void);
ACPI_STATUS
AcpiHwEnableAllRuntimeGpes (
- UINT32 Flags);
+ void);
ACPI_STATUS
AcpiHwEnableAllWakeupGpes (
- UINT32 Flags);
+ void);
ACPI_STATUS
AcpiHwEnableRuntimeGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock);
-ACPI_STATUS
-AcpiHwEnableWakeupGpeBlock (
- ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
- ACPI_GPE_BLOCK_INFO *GpeBlock);
-
-
-/* ACPI Timer prototypes */
+/*
+ * hwtimer - ACPI Timer prototypes
+ */
ACPI_STATUS
AcpiGetTimerResolution (
UINT32 *Resolution);
Index: dmresrcl.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmresrcl.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmresrcl.c -L sys/contrib/dev/acpica/dmresrcl.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmresrcl.c
+++ sys/contrib/dev/acpica/dmresrcl.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrcl.c - "Large" Resource Descriptor disassembly
- * $Revision: 12 $
+ * $Revision: 1.37 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,343 @@
ACPI_MODULE_NAME ("dbresrcl")
+/* Common names for address and memory descriptors */
+
+static char *AcpiDmAddressNames[] =
+{
+ "Granularity",
+ "Range Minimum",
+ "Range Maximum",
+ "Translation Offset",
+ "Length"
+};
+
+static char *AcpiDmMemoryNames[] =
+{
+ "Range Minimum",
+ "Range Maximum",
+ "Alignment",
+ "Length"
+};
+
+
+/* Local prototypes */
+
+static void
+AcpiDmSpaceFlags (
+ UINT8 Flags);
+
+static void
+AcpiDmIoFlags (
+ UINT8 Flags);
+
+static void
+AcpiDmIoFlags2 (
+ UINT8 SpecificFlags);
+
+static void
+AcpiDmMemoryFlags (
+ UINT8 Flags,
+ UINT8 SpecificFlags);
+
+static void
+AcpiDmMemoryFlags2 (
+ UINT8 SpecificFlags);
+
+static void
+AcpiDmResourceSource (
+ AML_RESOURCE *Resource,
+ ACPI_SIZE MinimumLength,
+ UINT32 Length);
+
+static void
+AcpiDmAddressFields (
+ void *Source,
+ UINT8 Type,
+ UINT32 Level);
+
+static void
+AcpiDmAddressPrefix (
+ UINT8 Type);
+
+static void
+AcpiDmAddressCommon (
+ AML_RESOURCE *Resource,
+ UINT8 Type,
+ UINT32 Level);
+
+static void
+AcpiDmAddressFlags (
+ AML_RESOURCE *Resource);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMemoryFields
+ *
+ * PARAMETERS: Source - Pointer to the contiguous data fields
+ * Type - 16 or 32 (bit)
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode fields common to Memory24 and Memory32 descriptors
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmMemoryFields (
+ void *Source,
+ UINT8 Type,
+ UINT32 Level)
+{
+ ACPI_NATIVE_UINT i;
+
+
+ for (i = 0; i < 4; i++)
+ {
+ AcpiDmIndent (Level + 1);
+
+ switch (Type)
+ {
+ case 16:
+ AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
+ AcpiDmMemoryNames[i]);
+ break;
+
+ case 32:
+ AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
+ AcpiDmMemoryNames[i]);
+ break;
+
+ default:
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddressFields
+ *
+ * PARAMETERS: Source - Pointer to the contiguous data fields
+ * Type - 16, 32, or 64 (bit)
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode fields common to address descriptors
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddressFields (
+ void *Source,
+ UINT8 Type,
+ UINT32 Level)
+{
+ ACPI_NATIVE_UINT i;
+
+
+ AcpiOsPrintf ("\n");
+
+ for (i = 0; i < 5; i++)
+ {
+ AcpiDmIndent (Level + 1);
+
+ switch (Type)
+ {
+ case 16:
+ AcpiDmDumpInteger16 (ACPI_CAST_PTR (UINT16, Source)[i],
+ AcpiDmAddressNames[i]);
+ break;
+
+ case 32:
+ AcpiDmDumpInteger32 (ACPI_CAST_PTR (UINT32, Source)[i],
+ AcpiDmAddressNames[i]);
+ break;
+
+ case 64:
+ AcpiDmDumpInteger64 (ACPI_CAST_PTR (UINT64, Source)[i],
+ AcpiDmAddressNames[i]);
+ break;
+
+ default:
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddressPrefix
+ *
+ * PARAMETERS: Type - Descriptor type
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Emit name prefix representing the address descriptor type
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddressPrefix (
+ UINT8 Type)
+{
+
+ switch (Type)
+ {
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
+ AcpiOsPrintf ("Word");
+ break;
+
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
+ AcpiOsPrintf ("DWord");
+ break;
+
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
+ AcpiOsPrintf ("QWord");
+ break;
+
+ case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
+ AcpiOsPrintf ("Extended");
+ break;
+
+ default:
+ return;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddressCommon
+ *
+ * PARAMETERS: Resource - Raw AML descriptor
+ * Type - Descriptor type
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Emit common name and flag fields common to address descriptors
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddressCommon (
+ AML_RESOURCE *Resource,
+ UINT8 Type,
+ UINT32 Level)
+{
+ UINT8 ResourceType;
+ UINT8 SpecificFlags;
+ UINT8 Flags;
+
+
+ ResourceType = Resource->Address.ResourceType;
+ SpecificFlags = Resource->Address.SpecificFlags;
+ Flags = Resource->Address.Flags;
+
+ AcpiDmIndent (Level);
+
+ /* Validate ResourceType */
+
+ if ((ResourceType > 2) && (ResourceType < 0xC0))
+ {
+ AcpiOsPrintf ("/**** Invalid Resource Type: 0x%X ****/", ResourceType);
+ return;
+ }
+
+ /* Prefix is either Word, DWord, QWord, or Extended */
+
+ AcpiDmAddressPrefix (Type);
+
+ /* Resource Types above 0xC0 are vendor-defined */
+
+ if (ResourceType > 2)
+ {
+ AcpiOsPrintf ("Space (0x%2.2X, ", ResourceType);
+ AcpiDmSpaceFlags (Flags);
+ AcpiOsPrintf (" 0x%2.2X,", SpecificFlags);
+ return;
+ }
+
+ /* This is either a Memory, IO, or BusNumber descriptor (0,1,2) */
+
+ AcpiOsPrintf ("%s (", AcpiGbl_WordDecode [ResourceType & 0x3]);
+
+ /* Decode the general and type-specific flags */
+
+ if (ResourceType == ACPI_MEMORY_RANGE)
+ {
+ AcpiDmMemoryFlags (Flags, SpecificFlags);
+ }
+ else /* IO range or BusNumberRange */
+ {
+ AcpiDmIoFlags (Flags);
+ if (ResourceType == ACPI_IO_RANGE)
+ {
+ AcpiOsPrintf (" %s,", AcpiGbl_RngDecode [SpecificFlags & 0x3]);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddressFlags
+ *
+ * PARAMETERS: Resource - Raw AML descriptor
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Emit flags common to address descriptors
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddressFlags (
+ AML_RESOURCE *Resource)
+{
+
+ if (Resource->Address.ResourceType == ACPI_IO_RANGE)
+ {
+ AcpiDmIoFlags2 (Resource->Address.SpecificFlags);
+ }
+ else if (Resource->Address.ResourceType == ACPI_MEMORY_RANGE)
+ {
+ AcpiDmMemoryFlags2 (Resource->Address.SpecificFlags);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmSpaceFlags
+ *
+ * PARAMETERS: Flags - Flag byte to be decoded
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode the flags specific to Space Address space descriptors
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmSpaceFlags (
+ UINT8 Flags)
+{
+
+ AcpiOsPrintf ("%s, %s, %s, %s,",
+ AcpiGbl_ConsumeDecode [(Flags & 1)],
+ AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
+ AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
+ AcpiGbl_MaxDecode [(Flags & 0x8) >> 3]);
+}
+
+
/*******************************************************************************
*
* FUNCTION: AcpiDmIoFlags
@@ -137,7 +474,7 @@
*
******************************************************************************/
-void
+static void
AcpiDmIoFlags (
UINT8 Flags)
{
@@ -145,7 +482,37 @@
AcpiGbl_ConsumeDecode [(Flags & 1)],
AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
- AcpiGbl_DECDecode [(Flags & 0x2) >> 1]);
+ AcpiGbl_DecDecode [(Flags & 0x2) >> 1]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmIoFlags2
+ *
+ * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode the flags specific to IO Address space descriptors
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmIoFlags2 (
+ UINT8 SpecificFlags)
+{
+
+ AcpiOsPrintf (", %s",
+ AcpiGbl_TtpDecode [(SpecificFlags & 0x10) >> 4]);
+
+ /* TRS is only used if TTP is TypeTranslation */
+
+ if (SpecificFlags & 0x10)
+ {
+ AcpiOsPrintf (", %s",
+ AcpiGbl_TrsDecode [(SpecificFlags & 0x20) >> 5]);
+ }
}
@@ -162,18 +529,106 @@
*
******************************************************************************/
-void
+static void
AcpiDmMemoryFlags (
UINT8 Flags,
UINT8 SpecificFlags)
{
+
AcpiOsPrintf ("%s, %s, %s, %s, %s, %s,",
AcpiGbl_ConsumeDecode [(Flags & 1)],
- AcpiGbl_DECDecode [(Flags & 0x2) >> 1],
+ AcpiGbl_DecDecode [(Flags & 0x2) >> 1],
AcpiGbl_MinDecode [(Flags & 0x4) >> 2],
AcpiGbl_MaxDecode [(Flags & 0x8) >> 3],
- AcpiGbl_MEMDecode [(SpecificFlags & 0x6) >> 1],
- AcpiGbl_RWDecode [(SpecificFlags & 0x1)]);
+ AcpiGbl_MemDecode [(SpecificFlags & 0x6) >> 1],
+ AcpiGbl_RwDecode [(SpecificFlags & 0x1)]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmMemoryFlags2
+ *
+ * PARAMETERS: SpecificFlags - "Specific" flag byte to be decoded
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode flags specific to Memory Address Space descriptors
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmMemoryFlags2 (
+ UINT8 SpecificFlags)
+{
+
+ AcpiOsPrintf (", %s, %s",
+ AcpiGbl_MtpDecode [(SpecificFlags & 0x18) >> 3],
+ AcpiGbl_TtpDecode [(SpecificFlags & 0x20) >> 5]);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmResourceSource
+ *
+ * PARAMETERS: Resource - Raw AML descriptor
+ * MinimumLength - descriptor length without optional fields
+ * ResourceLength
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump optional ResourceSource fields of an address descriptor
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmResourceSource (
+ AML_RESOURCE *Resource,
+ ACPI_SIZE MinimumTotalLength,
+ UINT32 ResourceLength)
+{
+ UINT8 *AmlResourceSource;
+ UINT32 TotalLength;
+
+
+ TotalLength = ResourceLength + sizeof (AML_RESOURCE_LARGE_HEADER);
+
+ /* Check if the optional ResourceSource fields are present */
+
+ if (TotalLength <= MinimumTotalLength)
+ {
+ /* The two optional fields are not used */
+
+ AcpiOsPrintf (",, ");
+ return;
+ }
+
+ /* Get a pointer to the ResourceSource */
+
+ AmlResourceSource = ACPI_ADD_PTR (UINT8, Resource, MinimumTotalLength);
+
+ /*
+ * Always emit the ResourceSourceIndex (Byte)
+ *
+ * NOTE: Some ASL compilers always create a 0 byte (in the AML) for the
+ * Index even if the String does not exist. Although this is in violation
+ * of the ACPI specification, it is very important to emit ASL code that
+ * can be compiled back to the identical AML. There may be fields and/or
+ * indexes into the resource template buffer that are compiled to absolute
+ * offsets, and these will be broken if the AML length is changed.
+ */
+ AcpiOsPrintf ("0x%2.2X,", (UINT32) AmlResourceSource[0]);
+
+ /* Make sure that the ResourceSource string exists before dumping it */
+
+ if (TotalLength > (MinimumTotalLength + 1))
+ {
+ AcpiOsPrintf (" ");
+ AcpiUtPrintString ((char *) &AmlResourceSource[1], ACPI_UINT8_MAX);
+ }
+
+ AcpiOsPrintf (", ");
}
@@ -193,55 +648,31 @@
void
AcpiDmWordDescriptor (
- ASL_WORD_ADDRESS_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
- AcpiDmIndent (Level);
- AcpiOsPrintf ("%s (",
- AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
+ /* Dump resource name and flags */
- AcpiDmIoFlags (Resource->Flags);
+ AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS16, Level);
- if ((Resource->ResourceType & 0x3) == 1)
- {
- AcpiOsPrintf (" %s,",
- AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
- }
+ /* Dump the 5 contiguous WORD values */
- /* The WORD values */
+ AcpiDmAddressFields (&Resource->Address16.Granularity, 16, Level);
+
+ /* The ResourceSource fields are optional */
- AcpiOsPrintf ("\n");
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%4.4X,\n",
- (UINT32) Resource->Granularity);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%4.4X,\n",
- (UINT32) Resource->AddressMin);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%4.4X,\n",
- (UINT32) Resource->AddressMax);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%4.4X,\n",
- (UINT32) Resource->TranslationOffset);
AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%4.4X",
- (UINT32) Resource->AddressLength);
+ AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS16), Length);
- /* Optional fields */
+ /* Insert a descriptor name */
- if (Length > 13)
- {
- AcpiOsPrintf (", 0x%2.2X",
- (UINT32) Resource->OptionalFields[0]);
- }
+ AcpiDmDescriptorName ();
- if (Length > 14)
- {
- AcpiOsPrintf (", %s",
- &Resource->OptionalFields[1]);
- }
+ /* Type-specific flags */
+
+ AcpiDmAddressFlags (Resource);
AcpiOsPrintf (")\n");
}
@@ -262,57 +693,31 @@
void
AcpiDmDwordDescriptor (
- ASL_DWORD_ADDRESS_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
- AcpiDmIndent (Level);
- AcpiOsPrintf ("D%s (",
- AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
+ /* Dump resource name and flags */
- if ((Resource->ResourceType & 0x3) == 1)
- {
- AcpiDmIoFlags (Resource->Flags);
- AcpiOsPrintf (" %s,",
- AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
- }
- else
- {
- AcpiDmMemoryFlags (Resource->Flags, Resource->SpecificFlags);
- }
+ AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS32, Level);
- /* The DWORD values */
+ /* Dump the 5 contiguous DWORD values */
+
+ AcpiDmAddressFields (&Resource->Address32.Granularity, 32, Level);
+
+ /* The ResourceSource fields are optional */
- AcpiOsPrintf ("\n");
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X,\n",
- Resource->Granularity);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X,\n",
- Resource->AddressMin);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X,\n",
- Resource->AddressMax);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X,\n",
- Resource->TranslationOffset);
AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X",
- Resource->AddressLength);
+ AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS32), Length);
- /* Optional fields */
+ /* Insert a descriptor name */
- if (Length > 23)
- {
- AcpiOsPrintf (", 0x%2.2X",
- Resource->OptionalFields[0]);
- }
- if (Length > 24)
- {
- AcpiOsPrintf (", %s",
- &Resource->OptionalFields[1]);
- }
+ AcpiDmDescriptorName ();
+
+ /* Type-specific flags */
+
+ AcpiDmAddressFlags (Resource);
AcpiOsPrintf (")\n");
}
@@ -333,62 +738,78 @@
void
AcpiDmQwordDescriptor (
- ASL_QWORD_ADDRESS_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
- AcpiDmIndent (Level);
- AcpiOsPrintf ("Q%s (",
- AcpiGbl_WordDecode [(Resource->ResourceType & 3)]);
+ /* Dump resource name and flags */
- if ((Resource->ResourceType & 0x3) == 1)
- {
- AcpiDmIoFlags (Resource->Flags);
- AcpiOsPrintf (" %s,",
- AcpiGbl_RNGDecode [(Resource->SpecificFlags & 0x3)]);
- }
- else
- {
- AcpiDmMemoryFlags (Resource->Flags, Resource->SpecificFlags);
- }
+ AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_ADDRESS64, Level);
- /* The QWORD values */
+ /* Dump the 5 contiguous QWORD values */
- AcpiOsPrintf ("\n");
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X%8.8X,\n",
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->Granularity)));
+ AcpiDmAddressFields (&Resource->Address64.Granularity, 64, Level);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X%8.8X,\n",
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->AddressMin)));
+ /* The ResourceSource fields are optional */
AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X%8.8X,\n",
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->AddressMax)));
+ AcpiDmResourceSource (Resource, sizeof (AML_RESOURCE_ADDRESS64), Length);
- AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X%8.8X,\n",
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->TranslationOffset)));
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+
+ /* Type-specific flags */
+
+ AcpiDmAddressFlags (Resource);
+ AcpiOsPrintf (")\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmExtendedDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Extended Address Space descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmExtendedDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ /* Dump resource name and flags */
+
+ AcpiDmAddressCommon (Resource, ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64, Level);
+
+ /* Dump the 5 contiguous QWORD values */
+
+ AcpiDmAddressFields (&Resource->ExtAddress64.Granularity, 64, Level);
+
+ /* Extra field for this descriptor only */
AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X%8.8X",
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->AddressLength)));
+ AcpiDmDumpInteger64 (Resource->ExtAddress64.TypeSpecific,
+ "Type-Specific Attributes");
- /* Optional fields */
+ /* Insert a descriptor name */
- if (Length > 43)
- {
- AcpiOsPrintf (", 0x%2.2X",
- Resource->OptionalFields[0]);
- }
- if (Length > 44)
- {
- AcpiOsPrintf (", %s",
- &Resource->OptionalFields[1]);
- }
+ AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
+
+ /* Type-specific flags */
+ AcpiDmAddressFlags (Resource);
AcpiOsPrintf (")\n");
}
@@ -409,18 +830,26 @@
void
AcpiDmMemory24Descriptor (
- ASL_MEMORY_24_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
+ /* Dump name and read/write flag */
+
AcpiDmIndent (Level);
- AcpiOsPrintf ("Memory24 (%s, 0x%4.4X, 0x%4.4X, 0x%4.4X, 0x%4.4X)\n",
- AcpiGbl_RWDecode [Resource->Information & 1],
- (UINT32) Resource->AddressMin,
- (UINT32) Resource->AddressMax,
- (UINT32) Resource->Alignment,
- (UINT32) Resource->RangeLength);
+ AcpiOsPrintf ("Memory24 (%s,\n",
+ AcpiGbl_RwDecode [Resource->Memory24.Flags & 1]);
+
+ /* Dump the 4 contiguous WORD values */
+
+ AcpiDmMemoryFields (&Resource->Memory24.Minimum, 16, Level);
+
+ /* Insert a descriptor name */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
}
@@ -440,24 +869,32 @@
void
AcpiDmMemory32Descriptor (
- ASL_MEMORY_32_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
+ /* Dump name and read/write flag */
+
AcpiDmIndent (Level);
- AcpiOsPrintf ("Memory32 (%s, 0x%8.8X, 0x%8.8X, 0x%8.8X, 0x%8.8X)\n",
- AcpiGbl_RWDecode [Resource->Information & 1],
- Resource->AddressMin,
- Resource->AddressMax,
- Resource->Alignment,
- Resource->RangeLength);
+ AcpiOsPrintf ("Memory32 (%s,\n",
+ AcpiGbl_RwDecode [Resource->Memory32.Flags & 1]);
+
+ /* Dump the 4 contiguous DWORD values */
+
+ AcpiDmMemoryFields (&Resource->Memory32.Minimum, 32, Level);
+
+ /* Insert a descriptor name */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
}
/*******************************************************************************
*
- * FUNCTION: AcpiDmFixedMem32Descriptor
+ * FUNCTION: AcpiDmFixedMemory32Descriptor
*
* PARAMETERS: Resource - Pointer to the resource descriptor
* Length - Length of the descriptor in bytes
@@ -470,17 +907,29 @@
******************************************************************************/
void
-AcpiDmFixedMem32Descriptor (
- ASL_FIXED_MEMORY_32_DESC *Resource,
+AcpiDmFixedMemory32Descriptor (
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
+ /* Dump name and read/write flag */
+
AcpiDmIndent (Level);
- AcpiOsPrintf ("Memory32Fixed (%s, 0x%8.8X, 0x%8.8X)\n",
- AcpiGbl_RWDecode [Resource->Information & 1],
- Resource->BaseAddress,
- Resource->RangeLength);
+ AcpiOsPrintf ("Memory32Fixed (%s,\n",
+ AcpiGbl_RwDecode [Resource->FixedMemory32.Flags & 1]);
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger32 (Resource->FixedMemory32.Address, "Address Base");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger32 (Resource->FixedMemory32.AddressLength, "Address Length");
+
+ /* Insert a descriptor name */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
}
@@ -500,20 +949,43 @@
void
AcpiDmGenericRegisterDescriptor (
- ASL_GENERAL_REGISTER_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
AcpiDmIndent (Level);
AcpiOsPrintf ("Register (");
+ AcpiDmAddressSpace (Resource->GenericReg.AddressSpaceId);
+ AcpiOsPrintf ("\n");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger8 (Resource->GenericReg.BitWidth, "Bit Width");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger8 (Resource->GenericReg.BitOffset, "Bit Offset");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger64 (Resource->GenericReg.Address, "Address");
+
+ /* Optional field for ACPI 3.0 */
+
+ AcpiDmIndent (Level + 1);
+ if (Resource->GenericReg.AccessSize)
+ {
+ AcpiOsPrintf ("0x%2.2X, // %s\n",
+ Resource->GenericReg.AccessSize, "Access Size");
+ AcpiDmIndent (Level + 1);
+ }
+ else
+ {
+ AcpiOsPrintf (",");
+ }
- AcpiDmAddressSpace (Resource->AddressSpaceId);
+ /* DescriptorName was added for ACPI 3.0+ */
- AcpiOsPrintf ("0x%2.2X, 0x%2.2X, 0x%8.8X%8.8X)\n",
- (UINT32) Resource->BitWidth,
- (UINT32) Resource->BitOffset,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Resource->Address)));
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
}
@@ -533,42 +1005,44 @@
void
AcpiDmInterruptDescriptor (
- ASL_EXTENDED_XRUPT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
UINT32 i;
- UINT8 *Rover;
AcpiDmIndent (Level);
- AcpiOsPrintf ("Interrupt (%s, %s, %s, %s",
- AcpiGbl_ConsumeDecode [(Resource->Flags & 1)],
- AcpiGbl_HEDecode [(Resource->Flags >> 1) & 1],
- AcpiGbl_LLDecode [(Resource->Flags >> 2) & 1],
- AcpiGbl_SHRDecode [(Resource->Flags >> 3) & 1]);
-
- /* Resource Index/Source, optional -- at end of descriptor */
-
- if (Resource->Length > (UINT16) (4 * Resource->TableLength) + 2)
- {
- /* Get a pointer past the interrupt values */
+ AcpiOsPrintf ("Interrupt (%s, %s, %s, %s, ",
+ AcpiGbl_ConsumeDecode [(Resource->ExtendedIrq.Flags & 1)],
+ AcpiGbl_HeDecode [(Resource->ExtendedIrq.Flags >> 1) & 1],
+ AcpiGbl_LlDecode [(Resource->ExtendedIrq.Flags >> 2) & 1],
+ AcpiGbl_ShrDecode [(Resource->ExtendedIrq.Flags >> 3) & 1]);
+
+ /*
+ * The ResourceSource fields are optional and appear after the interrupt
+ * list. Must compute length based on length of the list. First xrupt
+ * is included in the struct (reason for -1 below)
+ */
+ AcpiDmResourceSource (Resource,
+ sizeof (AML_RESOURCE_EXTENDED_IRQ) +
+ (Resource->ExtendedIrq.InterruptCount - 1) * sizeof (UINT32),
+ Resource->ExtendedIrq.ResourceLength);
- Rover = ((UINT8 *) Resource) + ((4 * Resource->TableLength) + 5);
+ /* Insert a descriptor name */
- /* Resource Index */
- /* Resource Source */
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
- AcpiOsPrintf (", 0x%X, \"%s\"", (UINT32) Rover[0], (char *) &Rover[1]);
- }
+ /* Dump the interrupt list */
- AcpiOsPrintf (")\n");
AcpiDmIndent (Level);
AcpiOsPrintf ("{\n");
- for (i = 0; i < Resource->TableLength; i++)
+ for (i = 0; i < Resource->ExtendedIrq.InterruptCount; i++)
{
AcpiDmIndent (Level + 1);
- AcpiOsPrintf ("0x%8.8X,\n", (UINT32) Resource->InterruptNumber[i]);
+ AcpiOsPrintf ("0x%8.8X,\n",
+ (UINT32) Resource->ExtendedIrq.Interrupts[i]);
}
AcpiDmIndent (Level);
@@ -578,36 +1052,74 @@
/*******************************************************************************
*
- * FUNCTION: AcpiDmVendorLargeDescriptor
+ * FUNCTION: AcpiDmVendorCommon
*
- * PARAMETERS: Resource - Pointer to the resource descriptor
- * Length - Length of the descriptor in bytes
+ * PARAMETERS: Name - Descriptor name suffix
+ * ByteData - Pointer to the vendor byte data
+ * Length - Length of the byte data
* Level - Current source code indentation level
*
* RETURN: None
*
- * DESCRIPTION: Decode a Vendor Large descriptor
+ * DESCRIPTION: Decode a Vendor descriptor, both Large and Small
*
******************************************************************************/
void
-AcpiDmVendorLargeDescriptor (
- ASL_LARGE_VENDOR_DESC *Resource,
+AcpiDmVendorCommon (
+ char *Name,
+ UINT8 *ByteData,
UINT32 Length,
UINT32 Level)
{
+ /* Dump macro name */
+
AcpiDmIndent (Level);
- AcpiOsPrintf ("VendorLong ()\n");
- AcpiDmIndent (Level);
+ AcpiOsPrintf ("Vendor%s (", Name);
+
+ /* Insert a descriptor name */
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (") // Length = 0x%.2X\n", Length);
+
+ /* Dump the vendor bytes */
+
+ AcpiDmIndent (Level);
AcpiOsPrintf ("{\n");
- AcpiDmDisasmByteList (Level + 1, (UINT8 *) Resource->VendorDefined, Length);
+ AcpiDmDisasmByteList (Level + 1, ByteData, Length);
+
AcpiDmIndent (Level);
AcpiOsPrintf ("}\n");
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmVendorLargeDescriptor
+ *
+ * PARAMETERS: Resource - Pointer to the resource descriptor
+ * Length - Length of the descriptor in bytes
+ * Level - Current source code indentation level
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Decode a Vendor Large descriptor
+ *
+ ******************************************************************************/
+
+void
+AcpiDmVendorLargeDescriptor (
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level)
+{
+
+ AcpiDmVendorCommon ("Long ",
+ ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_LARGE_HEADER)),
+ Length, Level);
+}
+
#endif
Index: exutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exutils.c -L sys/contrib/dev/acpica/exutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exutils.c
+++ sys/contrib/dev/acpica/exutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exutils - interpreter/scanner utilities
- * $Revision: 112 $
+ * $Revision: 1.129 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -141,35 +141,82 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exutils")
+/* Local prototypes */
-#ifndef ACPI_NO_METHOD_EXECUTION
+static UINT32
+AcpiExDigitsNeeded (
+ ACPI_INTEGER Value,
+ UINT32 Base);
+
+#ifndef ACPI_NO_METHOD_EXECUTION
/*******************************************************************************
*
* FUNCTION: AcpiExEnterInterpreter
*
* PARAMETERS: None
*
- * DESCRIPTION: Enter the interpreter execution region. Failure to enter
- * the interpreter region is a fatal system error
+ * RETURN: None
+ *
+ * DESCRIPTION: Enter the interpreter execution region. Failure to enter
+ * the interpreter region is a fatal system error. Used in
+ * conjunction with ExitInterpreter.
*
******************************************************************************/
-ACPI_STATUS
-AcpiExEnterInterpreter (void)
+void
+AcpiExEnterInterpreter (
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExEnterInterpreter");
+ ACPI_FUNCTION_TRACE (ExEnterInterpreter);
- Status = AcpiUtAcquireMutex (ACPI_MTX_EXECUTE);
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not acquire interpreter mutex\n"));
+ ACPI_ERROR ((AE_INFO, "Could not acquire AML Interpreter mutex"));
}
- return_ACPI_STATUS (Status);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExReacquireInterpreter
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Reacquire the interpreter execution region from within the
+ * interpreter code. Failure to enter the interpreter region is a
+ * fatal system error. Used in conjuction with
+ * RelinquishInterpreter
+ *
+ ******************************************************************************/
+
+void
+AcpiExReacquireInterpreter (
+ void)
+{
+ ACPI_FUNCTION_TRACE (ExReacquireInterpreter);
+
+
+ /*
+ * If the global serialized flag is set, do not release the interpreter,
+ * since it was not actually released by AcpiExRelinquishInterpreter.
+ * This forces the interpreter to be single threaded.
+ */
+ if (!AcpiGbl_AllMethodsSerialized)
+ {
+ AcpiExEnterInterpreter ();
+ }
+
+ return_VOID;
}
@@ -179,33 +226,71 @@
*
* PARAMETERS: None
*
- * DESCRIPTION: Exit the interpreter execution region
+ * RETURN: None
*
- * Cases where the interpreter is unlocked:
- * 1) Completion of the execution of a control method
- * 2) Method blocked on a Sleep() AML opcode
- * 3) Method blocked on an Acquire() AML opcode
- * 4) Method blocked on a Wait() AML opcode
- * 5) Method blocked to acquire the global lock
- * 6) Method blocked to execute a serialized control method that is
- * already executing
- * 7) About to invoke a user-installed opregion handler
+ * DESCRIPTION: Exit the interpreter execution region. This is the top level
+ * routine used to exit the interpreter when all processing has
+ * been completed.
*
******************************************************************************/
void
-AcpiExExitInterpreter (void)
+AcpiExExitInterpreter (
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExExitInterpreter");
+ ACPI_FUNCTION_TRACE (ExExitInterpreter);
- Status = AcpiUtReleaseMutex (ACPI_MTX_EXECUTE);
+ Status = AcpiUtReleaseMutex (ACPI_MTX_INTERPRETER);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not release interpreter mutex\n"));
+ ACPI_ERROR ((AE_INFO, "Could not release AML Interpreter mutex"));
+ }
+
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExRelinquishInterpreter
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Exit the interpreter execution region, from within the
+ * interpreter - before attempting an operation that will possibly
+ * block the running thread.
+ *
+ * Cases where the interpreter is unlocked internally
+ * 1) Method to be blocked on a Sleep() AML opcode
+ * 2) Method to be blocked on an Acquire() AML opcode
+ * 3) Method to be blocked on a Wait() AML opcode
+ * 4) Method to be blocked to acquire the global lock
+ * 5) Method to be blocked waiting to execute a serialized control method
+ * that is currently executing
+ * 6) About to invoke a user-installed opregion handler
+ *
+ ******************************************************************************/
+
+void
+AcpiExRelinquishInterpreter (
+ void)
+{
+ ACPI_FUNCTION_TRACE (ExRelinquishInterpreter);
+
+
+ /*
+ * If the global serialized flag is set, do not release the interpreter.
+ * This forces the interpreter to be single threaded.
+ */
+ if (!AcpiGbl_AllMethodsSerialized)
+ {
+ AcpiExExitInterpreter ();
}
return_VOID;
@@ -220,8 +305,8 @@
*
* RETURN: none
*
- * DESCRIPTION: Truncate a number to 32-bits if the currently executing method
- * belongs to a 32-bit ACPI table.
+ * DESCRIPTION: Truncate an ACPI Integer to 32 bits if the execution mode is
+ * 32-bit, as determined by the revision of the DSDT.
*
******************************************************************************/
@@ -235,9 +320,10 @@
/*
* Object must be a valid number and we must be executing
- * a control method
+ * a control method. NS node could be there for AML_INT_NAMEPATH_OP.
*/
if ((!ObjDesc) ||
+ (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND) ||
(ACPI_GET_OBJECT_TYPE (ObjDesc) != ACPI_TYPE_INTEGER))
{
return;
@@ -261,44 +347,42 @@
* PARAMETERS: FieldFlags - Flags with Lock rule:
* AlwaysLock or NeverLock
*
- * RETURN: TRUE/FALSE indicating whether the lock was actually acquired
+ * RETURN: None
*
- * DESCRIPTION: Obtain the global lock and keep track of this fact via two
- * methods. A global variable keeps the state of the lock, and
- * the state is returned to the caller.
+ * DESCRIPTION: Obtain the ACPI hardware Global Lock, only if the field
+ * flags specifiy that it is to be obtained before field access.
*
******************************************************************************/
-BOOLEAN
+void
AcpiExAcquireGlobalLock (
UINT32 FieldFlags)
{
- BOOLEAN Locked = FALSE;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExAcquireGlobalLock");
+ ACPI_FUNCTION_TRACE (ExAcquireGlobalLock);
- /* Only attempt lock if the AlwaysLock bit is set */
+ /* Only use the lock if the AlwaysLock bit is set */
- if (FieldFlags & AML_FIELD_LOCK_RULE_MASK)
+ if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK))
{
- /* We should attempt to get the lock, wait forever */
+ return_VOID;
+ }
+
+ /* Attempt to get the global lock, wait forever */
- Status = AcpiEvAcquireGlobalLock (ACPI_WAIT_FOREVER);
- if (ACPI_SUCCESS (Status))
- {
- Locked = TRUE;
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not acquire Global Lock, %s\n",
- AcpiFormatException (Status)));
- }
+ Status = AcpiExAcquireMutexObject (ACPI_WAIT_FOREVER,
+ AcpiGbl_GlobalLockMutex, AcpiOsGetThreadId ());
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not acquire Global Lock"));
}
- return_VALUE (Locked);
+ return_VOID;
}
@@ -306,39 +390,41 @@
*
* FUNCTION: AcpiExReleaseGlobalLock
*
- * PARAMETERS: LockedByMe - Return value from corresponding call to
- * AcquireGlobalLock.
+ * PARAMETERS: FieldFlags - Flags with Lock rule:
+ * AlwaysLock or NeverLock
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Release the global lock if it is locked.
+ * DESCRIPTION: Release the ACPI hardware Global Lock
*
******************************************************************************/
void
AcpiExReleaseGlobalLock (
- BOOLEAN LockedByMe)
+ UINT32 FieldFlags)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExReleaseGlobalLock");
+ ACPI_FUNCTION_TRACE (ExReleaseGlobalLock);
- /* Only attempt unlock if the caller locked it */
+ /* Only use the lock if the AlwaysLock bit is set */
- if (LockedByMe)
+ if (!(FieldFlags & AML_FIELD_LOCK_RULE_MASK))
{
- /* OK, now release the lock */
+ return_VOID;
+ }
- Status = AcpiEvReleaseGlobalLock ();
- if (ACPI_FAILURE (Status))
- {
- /* Report the error, but there isn't much else we can do */
+ /* Release the global lock */
+
+ Status = AcpiExReleaseMutexObject (AcpiGbl_GlobalLockMutex);
+ if (ACPI_FAILURE (Status))
+ {
+ /* Report the error, but there isn't much else we can do */
- ACPI_REPORT_ERROR (("Could not release ACPI Global Lock, %s\n",
- AcpiFormatException (Status)));
- }
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not release Global Lock"));
}
return_VOID;
@@ -352,11 +438,14 @@
* PARAMETERS: Value - Value to be represented
* Base - Base of representation
*
- * RETURN: the number of digits needed to represent Value in Base
+ * RETURN: The number of digits.
+ *
+ * DESCRIPTION: Calculate the number of digits needed to represent the Value
+ * in the given Base (Radix)
*
******************************************************************************/
-UINT32
+static UINT32
AcpiExDigitsNeeded (
ACPI_INTEGER Value,
UINT32 Base)
@@ -365,14 +454,14 @@
ACPI_INTEGER CurrentValue;
- ACPI_FUNCTION_TRACE ("ExDigitsNeeded");
+ ACPI_FUNCTION_TRACE (ExDigitsNeeded);
/* ACPI_INTEGER is unsigned, so we don't worry about a '-' prefix */
if (Value == 0)
{
- return_VALUE (1);
+ return_UINT32 (1);
}
CurrentValue = Value;
@@ -386,7 +475,7 @@
NumDigits++;
}
- return_VALUE (NumDigits);
+ return_UINT32 (NumDigits);
}
@@ -397,6 +486,8 @@
* PARAMETERS: NumericId - EISA ID to be converted
* OutString - Where to put the converted string (8 bytes)
*
+ * RETURN: None
+ *
* DESCRIPTION: Convert a numeric EISA ID to string representation
*
******************************************************************************/
@@ -434,7 +525,10 @@
* PARAMETERS: Value - Value to be converted
* OutString - Where to put the converted string (8 bytes)
*
- * RETURN: Convert a number to string representation
+ * RETURN: None, string
+ *
+ * DESCRIPTION: Convert a number to string representation. Assumes string
+ * buffer is large enough to hold the string.
*
******************************************************************************/
Index: exdump.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exdump.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exdump.c -L sys/contrib/dev/acpica/exdump.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exdump.c
+++ sys/contrib/dev/acpica/exdump.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exdump - Interpreter debug output routines
- * $Revision: 176 $
+ * $Revision: 1.202 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,23 +125,414 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exdump")
-
/*
* The following routines are used for debug output only
*/
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
-/*****************************************************************************
+/* Local prototypes */
+
+static void
+AcpiExOutString (
+ char *Title,
+ char *Value);
+
+static void
+AcpiExOutPointer (
+ char *Title,
+ void *Value);
+
+static void
+AcpiExDumpObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_EXDUMP_INFO *Info);
+
+static void
+AcpiExDumpReferenceObj (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+static void
+AcpiExDumpPackageObj (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 Level,
+ UINT32 Index);
+
+
+/*******************************************************************************
+ *
+ * Object Descriptor info tables
+ *
+ * Note: The first table entry must be an INIT opcode and must contain
+ * the table length (number of table entries)
+ *
+ ******************************************************************************/
+
+static ACPI_EXDUMP_INFO AcpiExDumpInteger[2] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpInteger), NULL},
+ {ACPI_EXD_UINT64, ACPI_EXD_OFFSET (Integer.Value), "Value"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpString[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpString), NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (String.Length), "Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (String.Pointer), "Pointer"},
+ {ACPI_EXD_STRING, 0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpBuffer[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBuffer), NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Buffer.Length), "Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Pointer), "Pointer"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Buffer.Node), "Parent Node"},
+ {ACPI_EXD_BUFFER, 0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpPackage[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPackage), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Package.Flags), "Flags"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Package.Count), "Elements"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Package.Elements), "Element List"},
+ {ACPI_EXD_PACKAGE, 0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpDevice[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpDevice), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.Handler), "Handler"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Device.DeviceNotify), "Device Notify"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpEvent[2] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpEvent), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Event.OsSemaphore), "OsSemaphore"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpMethod[8] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMethod), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ParamCount), "ParamCount"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.SyncLevel), "Sync Level"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.Mutex), "Mutex"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.OwnerId), "Owner Id"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Method.ThreadCount), "Thread Count"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Method.AmlLength), "Aml Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Method.AmlStart), "Aml Start"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpMutex[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpMutex), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Mutex.SyncLevel), "Sync Level"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OwnerThread), "Owner Thread"},
+ {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Mutex.AcquisitionDepth), "Acquire Depth"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Mutex.OsMutex), "OsMutex"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpRegion[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegion), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.SpaceId), "Space Id"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Region.Flags), "Flags"},
+ {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Region.Address), "Address"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Region.Length), "Length"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Handler), "Handler"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Region.Next), "Next"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpPower[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpPower), NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.SystemLevel), "System Level"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (PowerResource.ResourceOrder), "Resource Order"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (PowerResource.DeviceNotify), "Device Notify"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpProcessor[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpProcessor), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Processor.ProcId), "Processor ID"},
+ {ACPI_EXD_UINT8 , ACPI_EXD_OFFSET (Processor.Length), "Length"},
+ {ACPI_EXD_ADDRESS, ACPI_EXD_OFFSET (Processor.Address), "Address"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Processor.Handler), "Handler"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpThermal[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpThermal), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.SystemNotify), "System Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.DeviceNotify), "Device Notify"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (ThermalZone.Handler), "Handler"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpBufferField[3] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBufferField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BufferField.BufferObj), "Buffer Object"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpRegionField[3] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpRegionField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Field.RegionObj), "Region Object"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpBankField[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (BankField.Value), "Value"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.RegionObj), "Region Object"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (BankField.BankObj), "Bank Object"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpIndexField[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpBankField), NULL},
+ {ACPI_EXD_FIELD, 0, NULL},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (IndexField.Value), "Value"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.IndexObj), "Index Object"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (IndexField.DataObj), "Data Object"}
+};
+
+
+static ACPI_EXDUMP_INFO AcpiExDumpReference[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpReference), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Reference.TargetType), "Target Type"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (Reference.Offset), "Offset"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Object), "Object Desc"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Node), "Node"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Reference.Where), "Where"},
+ {ACPI_EXD_REFERENCE,0, NULL}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpAddressHandler[6] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpAddressHandler), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (AddressSpace.SpaceId), "Space Id"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Next), "Next"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.RegionList), "Region List"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Node), "Node"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (AddressSpace.Context), "Context"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpNotify[3] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNotify), NULL},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Node), "Node"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (Notify.Context), "Context"}
+};
+
+
+/* Miscellaneous tables */
+
+static ACPI_EXDUMP_INFO AcpiExDumpCommon[4] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpCommon), NULL},
+ {ACPI_EXD_TYPE , 0, NULL},
+ {ACPI_EXD_UINT16, ACPI_EXD_OFFSET (Common.ReferenceCount), "Reference Count"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (Common.Flags), "Flags"}
+};
+
+
+static ACPI_EXDUMP_INFO AcpiExDumpFieldCommon[7] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpFieldCommon), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.FieldFlags), "Field Flags"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.AccessByteWidth), "Access Byte Width"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BitLength), "Bit Length"},
+ {ACPI_EXD_UINT8, ACPI_EXD_OFFSET (CommonField.StartFieldBitOffset),"Field Bit Offset"},
+ {ACPI_EXD_UINT32, ACPI_EXD_OFFSET (CommonField.BaseByteOffset), "Base Byte Offset"},
+ {ACPI_EXD_POINTER, ACPI_EXD_OFFSET (CommonField.Node), "Parent Node"}
+};
+
+static ACPI_EXDUMP_INFO AcpiExDumpNode[5] =
+{
+ {ACPI_EXD_INIT, ACPI_EXD_TABLE_SIZE (AcpiExDumpNode), NULL},
+ {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (Flags), "Flags"},
+ {ACPI_EXD_UINT8, ACPI_EXD_NSOFFSET (OwnerId), "Owner Id"},
+ {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Child), "Child List"},
+ {ACPI_EXD_POINTER, ACPI_EXD_NSOFFSET (Peer), "Next Peer"}
+};
+
+
+/* Dispatch table, indexed by object type */
+
+static ACPI_EXDUMP_INFO *AcpiExDumpInfo[] =
+{
+ NULL,
+ AcpiExDumpInteger,
+ AcpiExDumpString,
+ AcpiExDumpBuffer,
+ AcpiExDumpPackage,
+ NULL,
+ AcpiExDumpDevice,
+ AcpiExDumpEvent,
+ AcpiExDumpMethod,
+ AcpiExDumpMutex,
+ AcpiExDumpRegion,
+ AcpiExDumpPower,
+ AcpiExDumpProcessor,
+ AcpiExDumpThermal,
+ AcpiExDumpBufferField,
+ NULL,
+ NULL,
+ AcpiExDumpRegionField,
+ AcpiExDumpBankField,
+ AcpiExDumpIndexField,
+ AcpiExDumpReference,
+ NULL,
+ NULL,
+ AcpiExDumpNotify,
+ AcpiExDumpAddressHandler,
+ NULL,
+ NULL,
+ NULL
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDumpObject
+ *
+ * PARAMETERS: ObjDesc - Descriptor to dump
+ * Info - Info table corresponding to this object
+ * type
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Walk the info table for this object
+ *
+ ******************************************************************************/
+
+static void
+AcpiExDumpObject (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_EXDUMP_INFO *Info)
+{
+ UINT8 *Target;
+ char *Name;
+ UINT8 Count;
+
+
+ if (!Info)
+ {
+ AcpiOsPrintf (
+ "ExDumpObject: Display not implemented for object type %s\n",
+ AcpiUtGetObjectTypeName (ObjDesc));
+ return;
+ }
+
+ /* First table entry must contain the table length (# of table entries) */
+
+ Count = Info->Offset;
+
+ while (Count)
+ {
+ Target = ACPI_ADD_PTR (UINT8, ObjDesc, Info->Offset);
+ Name = Info->Name;
+
+ switch (Info->Opcode)
+ {
+ case ACPI_EXD_INIT:
+ break;
+
+ case ACPI_EXD_TYPE:
+ AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
+ break;
+
+ case ACPI_EXD_UINT8:
+
+ AcpiOsPrintf ("%20s : %2.2X\n", Name, *Target);
+ break;
+
+ case ACPI_EXD_UINT16:
+
+ AcpiOsPrintf ("%20s : %4.4X\n", Name, ACPI_GET16 (Target));
+ break;
+
+ case ACPI_EXD_UINT32:
+
+ AcpiOsPrintf ("%20s : %8.8X\n", Name, ACPI_GET32 (Target));
+ break;
+
+ case ACPI_EXD_UINT64:
+
+ AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
+ ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_EXD_POINTER:
+ case ACPI_EXD_ADDRESS:
+
+ AcpiExOutPointer (Name, *ACPI_CAST_PTR (void *, Target));
+ break;
+
+ case ACPI_EXD_STRING:
+
+ AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_EXD_BUFFER:
+
+ ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
+ break;
+
+ case ACPI_EXD_PACKAGE:
+
+ /* Dump the package contents */
+
+ AcpiOsPrintf ("\nPackage Contents:\n");
+ AcpiExDumpPackageObj (ObjDesc, 0, 0);
+ break;
+
+ case ACPI_EXD_FIELD:
+
+ AcpiExDumpObject (ObjDesc, AcpiExDumpFieldCommon);
+ break;
+
+ case ACPI_EXD_REFERENCE:
+
+ AcpiExOutString ("Opcode",
+ (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
+ AcpiExDumpReferenceObj (ObjDesc);
+ break;
+
+ default:
+ AcpiOsPrintf ("**** Invalid table opcode [%X] ****\n", Info->Opcode);
+ return;
+ }
+
+ Info++;
+ Count--;
+ }
+}
+
+
+/*******************************************************************************
*
* FUNCTION: AcpiExDumpOperand
*
- * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
+ * PARAMETERS: *ObjDesc - Pointer to entry to be dumped
+ * Depth - Current nesting depth
*
* RETURN: None
*
* DESCRIPTION: Dump an operand object
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiExDumpOperand (
@@ -152,7 +543,7 @@
UINT32 Index;
- ACPI_FUNCTION_NAME ("ExDumpOperand")
+ ACPI_FUNCTION_NAME (ExDumpOperand)
if (!((ACPI_LV_EXEC & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
@@ -162,16 +553,15 @@
if (!ObjDesc)
{
- /*
- * This could be a null element of a package
- */
+ /* This could be a null element of a package */
+
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Null Object Descriptor\n"));
return;
}
if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p is a NS Node: ", ObjDesc));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p Namespace Node: ", ObjDesc));
ACPI_DUMP_ENTRY (ObjDesc, ACPI_LV_EXEC);
return;
}
@@ -197,6 +587,7 @@
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%p ", ObjDesc));
}
+ /* Decode object type */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
@@ -210,14 +601,6 @@
break;
- case AML_NAME_OP:
-
- ACPI_DUMP_PATHNAME (ObjDesc->Reference.Object,
- "Reference: Name: ", ACPI_LV_INFO, _COMPONENT);
- ACPI_DUMP_ENTRY (ObjDesc->Reference.Object, ACPI_LV_INFO);
- break;
-
-
case AML_INDEX_OP:
AcpiOsPrintf ("Reference: Index %p\n",
@@ -288,7 +671,7 @@
case ACPI_TYPE_BUFFER:
- AcpiOsPrintf ("Buffer len %X @ %p \n",
+ AcpiOsPrintf ("Buffer len %X @ %p\n",
ObjDesc->Buffer.Length, ObjDesc->Buffer.Pointer);
Length = ObjDesc->Buffer.Length;
@@ -366,7 +749,9 @@
case ACPI_TYPE_STRING:
AcpiOsPrintf ("String length %X @ %p ",
- ObjDesc->String.Length, ObjDesc->String.Pointer);
+ ObjDesc->String.Length,
+ ObjDesc->String.Pointer);
+
AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
AcpiOsPrintf ("\n");
break;
@@ -382,10 +767,13 @@
AcpiOsPrintf (
"RegionField: Bits=%X AccWidth=%X Lock=%X Update=%X at byte=%X bit=%X of below:\n",
- ObjDesc->Field.BitLength, ObjDesc->Field.AccessByteWidth,
+ ObjDesc->Field.BitLength,
+ ObjDesc->Field.AccessByteWidth,
ObjDesc->Field.FieldFlags & AML_FIELD_LOCK_RULE_MASK,
ObjDesc->Field.FieldFlags & AML_FIELD_UPDATE_RULE_MASK,
- ObjDesc->Field.BaseByteOffset, ObjDesc->Field.StartFieldBitOffset);
+ ObjDesc->Field.BaseByteOffset,
+ ObjDesc->Field.StartFieldBitOffset);
+
AcpiExDumpOperand (ObjDesc->Field.RegionObj, Depth+1);
break;
@@ -399,17 +787,19 @@
case ACPI_TYPE_BUFFER_FIELD:
AcpiOsPrintf (
- "BufferField: %X bits at byte %X bit %X of \n",
- ObjDesc->BufferField.BitLength, ObjDesc->BufferField.BaseByteOffset,
+ "BufferField: %X bits at byte %X bit %X of\n",
+ ObjDesc->BufferField.BitLength,
+ ObjDesc->BufferField.BaseByteOffset,
ObjDesc->BufferField.StartFieldBitOffset);
if (!ObjDesc->BufferField.BufferObj)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL* \n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*NULL*\n"));
}
- else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) != ACPI_TYPE_BUFFER)
+ else if (ACPI_GET_OBJECT_TYPE (ObjDesc->BufferField.BufferObj) !=
+ ACPI_TYPE_BUFFER)
{
- AcpiOsPrintf ("*not a Buffer* \n");
+ AcpiOsPrintf ("*not a Buffer*\n");
}
else
{
@@ -426,10 +816,10 @@
case ACPI_TYPE_METHOD:
- AcpiOsPrintf (
- "Method(%X) @ %p:%X\n",
+ AcpiOsPrintf ("Method(%X) @ %p:%X\n",
ObjDesc->Method.ParamCount,
- ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength);
+ ObjDesc->Method.AmlStart,
+ ObjDesc->Method.AmlLength);
break;
@@ -474,7 +864,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExDumpOperands
*
@@ -488,7 +878,7 @@
*
* DESCRIPTION: Dump the object stack
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiExDumpOperands (
@@ -503,7 +893,7 @@
ACPI_NATIVE_UINT i;
- ACPI_FUNCTION_NAME ("ExDumpOperands");
+ ACPI_FUNCTION_NAME (ExDumpOperands);
if (!Ident)
@@ -533,15 +923,15 @@
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "************* Stack dump from %s(%d), %s\n",
+ "************* Operand Stack dump from %s(%d), %s\n",
ModuleName, LineNumber, Note));
return;
}
-/*****************************************************************************
+/*******************************************************************************
*
- * FUNCTION: AcpiExOut*
+ * FUNCTION: AcpiExOut* functions
*
* PARAMETERS: Title - Descriptive text
* Value - Value to be displayed
@@ -550,9 +940,9 @@
* reduce the number of format strings required and keeps them
* all in one place for easy modification.
*
- ****************************************************************************/
+ ******************************************************************************/
-void
+static void
AcpiExOutString (
char *Title,
char *Value)
@@ -560,7 +950,7 @@
AcpiOsPrintf ("%20s : %s\n", Title, Value);
}
-void
+static void
AcpiExOutPointer (
char *Title,
void *Value)
@@ -568,41 +958,20 @@
AcpiOsPrintf ("%20s : %p\n", Title, Value);
}
-void
-AcpiExOutInteger (
- char *Title,
- UINT32 Value)
-{
- AcpiOsPrintf ("%20s : %X\n", Title, Value);
-}
-
-void
-AcpiExOutAddress (
- char *Title,
- ACPI_PHYSICAL_ADDRESS Value)
-{
-
-#if ACPI_MACHINE_WIDTH == 16
- AcpiOsPrintf ("%20s : %p\n", Title, Value);
-#else
- AcpiOsPrintf ("%20s : %8.8X%8.8X\n", Title, ACPI_FORMAT_UINT64 (Value));
-#endif
-}
-
-/*****************************************************************************
+/*******************************************************************************
*
- * FUNCTION: AcpiExDumpNode
+ * FUNCTION: AcpiExDumpNamespaceNode
*
- * PARAMETERS: *Node - Descriptor to dump
- * Flags - Force display
+ * PARAMETERS: Node - Descriptor to dump
+ * Flags - Force display if TRUE
*
* DESCRIPTION: Dumps the members of the given.Node
*
- ****************************************************************************/
+ ******************************************************************************/
void
-AcpiExDumpNode (
+AcpiExDumpNamespaceNode (
ACPI_NAMESPACE_NODE *Node,
UINT32 Flags)
{
@@ -620,281 +989,227 @@
AcpiOsPrintf ("%20s : %4.4s\n", "Name", AcpiUtGetNodeName (Node));
AcpiExOutString ("Type", AcpiUtGetTypeName (Node->Type));
- AcpiExOutInteger ("Flags", Node->Flags);
- AcpiExOutInteger ("Owner Id", Node->OwnerId);
- AcpiExOutInteger ("Reference Count", Node->ReferenceCount);
AcpiExOutPointer ("Attached Object", AcpiNsGetAttachedObject (Node));
- AcpiExOutPointer ("ChildList", Node->Child);
- AcpiExOutPointer ("NextPeer", Node->Peer);
AcpiExOutPointer ("Parent", AcpiNsGetParentNode (Node));
+
+ AcpiExDumpObject (ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node),
+ AcpiExDumpNode);
}
-/*****************************************************************************
+/*******************************************************************************
*
- * FUNCTION: AcpiExDumpObjectDescriptor
+ * FUNCTION: AcpiExDumpReferenceObj
*
- * PARAMETERS: *Object - Descriptor to dump
- * Flags - Force display
+ * PARAMETERS: Object - Descriptor to dump
*
- * DESCRIPTION: Dumps the members of the object descriptor given.
+ * DESCRIPTION: Dumps a reference object
*
- ****************************************************************************/
+ ******************************************************************************/
-void
-AcpiExDumpObjectDescriptor (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 Flags)
+static void
+AcpiExDumpReferenceObj (
+ ACPI_OPERAND_OBJECT *ObjDesc)
{
- UINT32 i;
-
+ ACPI_BUFFER RetBuf;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("ExDumpObjectDescriptor");
+ RetBuf.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
- if (!Flags)
+ if (ObjDesc->Reference.Opcode == AML_INT_NAMEPATH_OP)
{
- if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
+ AcpiOsPrintf ("Named Object %p ", ObjDesc->Reference.Node);
+
+ Status = AcpiNsHandleToPathname (ObjDesc->Reference.Node, &RetBuf);
+ if (ACPI_FAILURE (Status))
{
- return_VOID;
+ AcpiOsPrintf ("Could not convert name to pathname\n");
+ }
+ else
+ {
+ AcpiOsPrintf ("%s\n", (char *) RetBuf.Pointer);
+ ACPI_FREE (RetBuf.Pointer);
}
}
-
- if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
+ else if (ObjDesc->Reference.Object)
{
- AcpiExDumpNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
- AcpiOsPrintf ("\nAttached Object (%p):\n",
- ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
- AcpiExDumpObjectDescriptor (
- ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
- return_VOID;
+ AcpiOsPrintf ("\nReferenced Object: %p\n", ObjDesc->Reference.Object);
}
+}
- if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDumpPackageObj
+ *
+ * PARAMETERS: ObjDesc - Descriptor to dump
+ * Level - Indentation Level
+ * Index - Package index for this object
+ *
+ * DESCRIPTION: Dumps the elements of the package
+ *
+ ******************************************************************************/
+
+static void
+AcpiExDumpPackageObj (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 Level,
+ UINT32 Index)
+{
+ UINT32 i;
+
+
+ /* Indentation and index output */
+
+ if (Level > 0)
{
- AcpiOsPrintf (
- "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
- ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
- return_VOID;
+ for (i = 0; i < Level; i++)
+ {
+ AcpiOsPrintf (" ");
+ }
+
+ AcpiOsPrintf ("[%.2d] ", Index);
}
- /* Common Fields */
+ AcpiOsPrintf ("%p ", ObjDesc);
- AcpiExOutString ("Type", AcpiUtGetObjectTypeName (ObjDesc));
- AcpiExOutInteger ("Reference Count", ObjDesc->Common.ReferenceCount);
- AcpiExOutInteger ("Flags", ObjDesc->Common.Flags);
+ /* Null package elements are allowed */
- /* Object-specific Fields */
+ if (!ObjDesc)
+ {
+ AcpiOsPrintf ("[Null Object]\n");
+ return;
+ }
+
+ /* Packages may only contain a few object types */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
case ACPI_TYPE_INTEGER:
- AcpiOsPrintf ("%20s : %8.8X%8.8X\n", "Value",
- ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
+ AcpiOsPrintf ("[Integer] = %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
case ACPI_TYPE_STRING:
- AcpiExOutInteger ("Length", ObjDesc->String.Length);
-
- AcpiOsPrintf ("%20s : %p ", "Pointer", ObjDesc->String.Pointer);
- AcpiUtPrintString (ObjDesc->String.Pointer, ACPI_UINT8_MAX);
+ AcpiOsPrintf ("[String] Value: ");
+ for (i = 0; i < ObjDesc->String.Length; i++)
+ {
+ AcpiOsPrintf ("%c", ObjDesc->String.Pointer[i]);
+ }
AcpiOsPrintf ("\n");
break;
case ACPI_TYPE_BUFFER:
- AcpiExOutInteger ("Length", ObjDesc->Buffer.Length);
- AcpiExOutPointer ("Pointer", ObjDesc->Buffer.Pointer);
- ACPI_DUMP_BUFFER (ObjDesc->Buffer.Pointer, ObjDesc->Buffer.Length);
+ AcpiOsPrintf ("[Buffer] Length %.2X = ", ObjDesc->Buffer.Length);
+ if (ObjDesc->Buffer.Length)
+ {
+ AcpiUtDumpBuffer (ACPI_CAST_PTR (UINT8, ObjDesc->Buffer.Pointer),
+ ObjDesc->Buffer.Length, DB_DWORD_DISPLAY, _COMPONENT);
+ }
+ else
+ {
+ AcpiOsPrintf ("\n");
+ }
break;
case ACPI_TYPE_PACKAGE:
- AcpiExOutInteger ("Flags", ObjDesc->Package.Flags);
- AcpiExOutInteger ("Count", ObjDesc->Package.Count);
- AcpiExOutPointer ("Elements", ObjDesc->Package.Elements);
-
- /* Dump the package contents */
+ AcpiOsPrintf ("[Package] Contains %d Elements:\n",
+ ObjDesc->Package.Count);
- if (ObjDesc->Package.Count > 0)
+ for (i = 0; i < ObjDesc->Package.Count; i++)
{
- AcpiOsPrintf ("\nPackage Contents:\n");
- for (i = 0; i < ObjDesc->Package.Count; i++)
- {
- AcpiOsPrintf ("[%.3d] %p", i, ObjDesc->Package.Elements[i]);
- if (ObjDesc->Package.Elements[i])
- {
- AcpiOsPrintf (" %s",
- AcpiUtGetObjectTypeName (ObjDesc->Package.Elements[i]));
- }
- AcpiOsPrintf ("\n");
- }
+ AcpiExDumpPackageObj (ObjDesc->Package.Elements[i], Level+1, i);
}
break;
- case ACPI_TYPE_DEVICE:
-
- AcpiExOutPointer ("Handler", ObjDesc->Device.Handler);
- AcpiExOutPointer ("SystemNotify", ObjDesc->Device.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->Device.DeviceNotify);
- break;
-
-
- case ACPI_TYPE_EVENT:
-
- AcpiExOutPointer ("Semaphore", ObjDesc->Event.Semaphore);
- break;
-
-
- case ACPI_TYPE_METHOD:
-
- AcpiExOutInteger ("ParamCount", ObjDesc->Method.ParamCount);
- AcpiExOutInteger ("Concurrency", ObjDesc->Method.Concurrency);
- AcpiExOutPointer ("Semaphore", ObjDesc->Method.Semaphore);
- AcpiExOutInteger ("OwningId", ObjDesc->Method.OwningId);
- AcpiExOutInteger ("AmlLength", ObjDesc->Method.AmlLength);
- AcpiExOutPointer ("AmlStart", ObjDesc->Method.AmlStart);
- break;
-
-
- case ACPI_TYPE_MUTEX:
-
- AcpiExOutInteger ("SyncLevel", ObjDesc->Mutex.SyncLevel);
- AcpiExOutPointer ("OwnerThread", ObjDesc->Mutex.OwnerThread);
- AcpiExOutInteger ("AcquireDepth", ObjDesc->Mutex.AcquisitionDepth);
- AcpiExOutPointer ("Semaphore", ObjDesc->Mutex.Semaphore);
- break;
-
-
- case ACPI_TYPE_REGION:
-
- AcpiExOutInteger ("SpaceId", ObjDesc->Region.SpaceId);
- AcpiExOutInteger ("Flags", ObjDesc->Region.Flags);
- AcpiExOutAddress ("Address", ObjDesc->Region.Address);
- AcpiExOutInteger ("Length", ObjDesc->Region.Length);
- AcpiExOutPointer ("Handler", ObjDesc->Region.Handler);
- AcpiExOutPointer ("Next", ObjDesc->Region.Next);
- break;
-
-
- case ACPI_TYPE_POWER:
+ case ACPI_TYPE_LOCAL_REFERENCE:
- AcpiExOutInteger ("SystemLevel", ObjDesc->PowerResource.SystemLevel);
- AcpiExOutInteger ("ResourceOrder", ObjDesc->PowerResource.ResourceOrder);
- AcpiExOutPointer ("SystemNotify", ObjDesc->PowerResource.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->PowerResource.DeviceNotify);
+ AcpiOsPrintf ("[Object Reference] ");
+ AcpiExDumpReferenceObj (ObjDesc);
break;
- case ACPI_TYPE_PROCESSOR:
+ default:
- AcpiExOutInteger ("Processor ID", ObjDesc->Processor.ProcId);
- AcpiExOutInteger ("Length", ObjDesc->Processor.Length);
- AcpiExOutAddress ("Address", (ACPI_PHYSICAL_ADDRESS) ObjDesc->Processor.Address);
- AcpiExOutPointer ("SystemNotify", ObjDesc->Processor.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->Processor.DeviceNotify);
- AcpiExOutPointer ("Handler", ObjDesc->Processor.Handler);
+ AcpiOsPrintf ("[Unknown Type] %X\n", ACPI_GET_OBJECT_TYPE (ObjDesc));
break;
+ }
+}
- case ACPI_TYPE_THERMAL:
-
- AcpiExOutPointer ("SystemNotify", ObjDesc->ThermalZone.SystemNotify);
- AcpiExOutPointer ("DeviceNotify", ObjDesc->ThermalZone.DeviceNotify);
- AcpiExOutPointer ("Handler", ObjDesc->ThermalZone.Handler);
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExDumpObjectDescriptor
+ *
+ * PARAMETERS: ObjDesc - Descriptor to dump
+ * Flags - Force display if TRUE
+ *
+ * DESCRIPTION: Dumps the members of the object descriptor given.
+ *
+ ******************************************************************************/
+void
+AcpiExDumpObjectDescriptor (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 Flags)
+{
+ ACPI_FUNCTION_TRACE (ExDumpObjectDescriptor);
- case ACPI_TYPE_BUFFER_FIELD:
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
- AcpiExOutInteger ("FieldFlags", ObjDesc->CommonField.FieldFlags);
- AcpiExOutInteger ("AccessByteWidth",ObjDesc->CommonField.AccessByteWidth);
- AcpiExOutInteger ("BitLength", ObjDesc->CommonField.BitLength);
- AcpiExOutInteger ("FldBitOffset", ObjDesc->CommonField.StartFieldBitOffset);
- AcpiExOutInteger ("BaseByteOffset", ObjDesc->CommonField.BaseByteOffset);
- AcpiExOutInteger ("DatumValidBits", ObjDesc->CommonField.DatumValidBits);
- AcpiExOutInteger ("EndFldValidBits",ObjDesc->CommonField.EndFieldValidBits);
- AcpiExOutInteger ("EndBufValidBits",ObjDesc->CommonField.EndBufferValidBits);
- AcpiExOutPointer ("ParentNode", ObjDesc->CommonField.Node);
+ if (!ObjDesc)
+ {
+ return_VOID;
+ }
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ if (!Flags)
+ {
+ if (!((ACPI_LV_OBJECTS & AcpiDbgLevel) && (_COMPONENT & AcpiDbgLayer)))
{
- case ACPI_TYPE_BUFFER_FIELD:
- AcpiExOutPointer ("BufferObj", ObjDesc->BufferField.BufferObj);
- break;
-
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- AcpiExOutPointer ("RegionObj", ObjDesc->Field.RegionObj);
- break;
-
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- AcpiExOutInteger ("Value", ObjDesc->BankField.Value);
- AcpiExOutPointer ("RegionObj", ObjDesc->BankField.RegionObj);
- AcpiExOutPointer ("BankObj", ObjDesc->BankField.BankObj);
- break;
-
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
- AcpiExOutInteger ("Value", ObjDesc->IndexField.Value);
- AcpiExOutPointer ("Index", ObjDesc->IndexField.IndexObj);
- AcpiExOutPointer ("Data", ObjDesc->IndexField.DataObj);
- break;
-
- default:
- /* All object types covered above */
- break;
+ return_VOID;
}
- break;
-
-
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- AcpiExOutInteger ("TargetType", ObjDesc->Reference.TargetType);
- AcpiExOutString ("Opcode", (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name);
- AcpiExOutInteger ("Offset", ObjDesc->Reference.Offset);
- AcpiExOutPointer ("ObjDesc", ObjDesc->Reference.Object);
- AcpiExOutPointer ("Node", ObjDesc->Reference.Node);
- AcpiExOutPointer ("Where", ObjDesc->Reference.Where);
- break;
-
+ }
- case ACPI_TYPE_LOCAL_ADDRESS_HANDLER:
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiExDumpNamespaceNode ((ACPI_NAMESPACE_NODE *) ObjDesc, Flags);
- AcpiExOutInteger ("SpaceId", ObjDesc->AddressSpace.SpaceId);
- AcpiExOutPointer ("Next", ObjDesc->AddressSpace.Next);
- AcpiExOutPointer ("RegionList", ObjDesc->AddressSpace.RegionList);
- AcpiExOutPointer ("Node", ObjDesc->AddressSpace.Node);
- AcpiExOutPointer ("Context", ObjDesc->AddressSpace.Context);
- break;
+ AcpiOsPrintf ("\nAttached Object (%p):\n",
+ ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object);
+ AcpiExDumpObjectDescriptor (
+ ((ACPI_NAMESPACE_NODE *) ObjDesc)->Object, Flags);
+ return_VOID;
+ }
- case ACPI_TYPE_LOCAL_NOTIFY:
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) != ACPI_DESC_TYPE_OPERAND)
+ {
+ AcpiOsPrintf (
+ "ExDumpObjectDescriptor: %p is not an ACPI operand object: [%s]\n",
+ ObjDesc, AcpiUtGetDescriptorName (ObjDesc));
+ return_VOID;
+ }
- AcpiExOutPointer ("Node", ObjDesc->Notify.Node);
- AcpiExOutPointer ("Context", ObjDesc->Notify.Context);
- break;
+ if (ObjDesc->Common.Type > ACPI_TYPE_NS_NODE_MAX)
+ {
+ return_VOID;
+ }
+ /* Common Fields */
- case ACPI_TYPE_LOCAL_ALIAS:
- case ACPI_TYPE_LOCAL_METHOD_ALIAS:
- case ACPI_TYPE_LOCAL_EXTRA:
- case ACPI_TYPE_LOCAL_DATA:
- default:
+ AcpiExDumpObject (ObjDesc, AcpiExDumpCommon);
- AcpiOsPrintf (
- "ExDumpObjectDescriptor: Display not implemented for object type %s\n",
- AcpiUtGetObjectTypeName (ObjDesc));
- break;
- }
+ /* Object-specific fields */
+ AcpiExDumpObject (ObjDesc, AcpiExDumpInfo[ObjDesc->Common.Type]);
return_VOID;
}
Index: osunixxf.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/osunixxf.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/osunixxf.c -L sys/contrib/dev/acpica/osunixxf.c -u -r1.1.1.1 -r1.2
--- sys/contrib/dev/acpica/osunixxf.c
+++ sys/contrib/dev/acpica/osunixxf.c
@@ -8,7 +8,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -137,6 +137,10 @@
extern FILE *AcpiGbl_DebugFile;
FILE *AcpiGbl_OutputFile;
+ACPI_PHYSICAL_ADDRESS
+AeLocalGetRootPointer (
+ void);
+
/******************************************************************************
*
@@ -170,30 +174,20 @@
*
* FUNCTION: AcpiOsGetRootPointer
*
- * PARAMETERS: Flags - Logical or physical addressing mode
- * Address - Where the address is returned
+ * PARAMETERS: None
*
- * RETURN: Status
+ * RETURN: RSDP physical address
*
* DESCRIPTION: Gets the root pointer (RSDP)
*
*****************************************************************************/
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer (
- UINT32 Flags,
- ACPI_POINTER *Address)
+ void)
{
-#if 0
- /* The supporting code for this is not yet available.
- * Return to the old situation for now.
- */
- return (AeLocalGetRootPointer(Flags, Address));
-#else
- return (AE_OK);
-#endif
-
+ return (AeLocalGetRootPointer ());
}
@@ -254,11 +248,11 @@
*NewTable = NULL;
-#ifdef _ACPI_EXEC_APP
+#ifdef ACPI_EXEC_APP
/* This code exercises the table override mechanism in the core */
- if (!ACPI_STRNCMP (ExistingTable->Signature, DSDT_SIG, ACPI_NAME_SIZE))
+ if (ACPI_COMPARE_NAME (ExistingTable->Signature, ACPI_SIG_DSDT))
{
/* override DSDT with itself */
@@ -464,7 +458,6 @@
*
* PARAMETERS: where Physical address of memory to be mapped
* length How much memory to map
- * there Logical address of mapped memory
*
* RETURN: Pointer to mapped memory. Null on error.
*
@@ -472,15 +465,13 @@
*
*****************************************************************************/
-ACPI_STATUS
+void *
AcpiOsMapMemory (
ACPI_PHYSICAL_ADDRESS where,
- ACPI_SIZE length,
- void **there)
+ ACPI_SIZE length)
{
- *there = ACPI_TO_POINTER (where);
- return AE_OK;
+ return (ACPI_TO_POINTER ((ACPI_NATIVE_UINT) where));
}
@@ -658,7 +649,7 @@
ACPI_STATUS
AcpiOsCreateLock (
- ACPI_HANDLE *OutHandle)
+ ACPI_SPINLOCK *OutHandle)
{
return (AcpiOsCreateSemaphore (1, 1, OutHandle));
@@ -666,25 +657,25 @@
void
AcpiOsDeleteLock (
- ACPI_HANDLE Handle)
+ ACPI_SPINLOCK Handle)
{
AcpiOsDeleteSemaphore (Handle);
}
-void
+ACPI_CPU_FLAGS
AcpiOsAcquireLock (
- ACPI_HANDLE Handle,
- UINT32 Flags)
+ ACPI_HANDLE Handle)
{
AcpiOsWaitSemaphore (Handle, 1, 0xFFFF);
+ return (0);
}
void
AcpiOsReleaseLock (
- ACPI_HANDLE Handle,
- UINT32 Flags)
+ ACPI_SPINLOCK Handle,
+ ACPI_CPU_FLAGS Flags)
{
AcpiOsSignalSemaphore (Handle, 1);
}
@@ -741,21 +732,21 @@
/******************************************************************************
*
- * FUNCTION: AcpiOsQueueForExecution
+ * FUNCTION: AcpiOsExecute
*
- * PARAMETERS: Priority - Requested execution priority
+ * PARAMETERS: Type - Type of execution
* Function - Address of the function to execute
* Context - Passed as a parameter to the function
*
* RETURN: Status.
*
- * DESCRIPTION: Sleep at microsecond granularity
+ * DESCRIPTION: Execute a new thread
*
*****************************************************************************/
ACPI_STATUS
-AcpiOsQueueForExecution (
- UINT32 Priority,
+AcpiOsExecute (
+ ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context)
{
@@ -782,8 +773,6 @@
char *Msg)
{
- /* Print the message and do an INT 3 */
-
if (Msg)
{
AcpiOsPrintf ("AcpiOsBreakpoint: %s ****\n", Msg);
@@ -793,7 +782,6 @@
AcpiOsPrintf ("At AcpiOsBreakpoint ****\n");
}
-
return AE_OK;
}
@@ -877,6 +865,55 @@
/******************************************************************************
*
+ * FUNCTION: AcpiOsValidateInterface
+ *
+ * PARAMETERS: Interface - Requested interface to be validated
+ *
+ * RETURN: AE_OK if interface is supported, AE_SUPPORT otherwise
+ *
+ * DESCRIPTION: Match an interface string to the interfaces supported by the
+ * host. Strings originate from an AML call to the _OSI method.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsValidateInterface (
+ char *Interface)
+{
+
+ return (AE_SUPPORT);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AcpiOsValidateAddress
+ *
+ * PARAMETERS: SpaceId - ACPI space ID
+ * Address - Physical address
+ * Length - Address length
+ *
+ * RETURN: AE_OK if Address/Length is valid for the SpaceId. Otherwise,
+ * should return AE_AML_ILLEGAL_ADDRESS.
+ *
+ * DESCRIPTION: Validate a system address via the host OS. Used to validate
+ * the addresses accessed by AML operation regions.
+ *
+ *****************************************************************************/
+
+ACPI_STATUS
+AcpiOsValidateAddress (
+ UINT8 SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_SIZE Length)
+{
+
+ return (AE_OK);
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AcpiOsReadPciConfiguration
*
* PARAMETERS: PciId Seg/Bus/Dev
@@ -1066,7 +1103,7 @@
}
-UINT32
+ACPI_THREAD_ID
AcpiOsGetThreadId(void)
{
return getpid();
Index: amlcode.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/amlcode.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/amlcode.h -L sys/contrib/dev/acpica/amlcode.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/amlcode.h
+++ sys/contrib/dev/acpica/amlcode.h
@@ -3,7 +3,7 @@
* Name: amlcode.h - Definitions for AML, as included in "definition blocks"
* Declarations and definitions contained herein are derived
* directly from the ACPI specification.
- * $Revision: 77 $
+ * $Revision: 1.86 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -142,7 +142,7 @@
#define AML_MULTI_NAME_PREFIX_OP (UINT16) 0x2f
#define AML_NAME_CHAR_SUBSEQ (UINT16) 0x30
#define AML_NAME_CHAR_FIRST (UINT16) 0x41
-#define AML_OP_PREFIX (UINT16) 0x5b
+#define AML_EXTENDED_OP_PREFIX (UINT16) 0x5b
#define AML_ROOT_PREFIX (UINT16) 0x5c
#define AML_PARENT_PREFIX (UINT16) 0x5e
#define AML_LOCAL_OP (UINT16) 0x60
@@ -219,8 +219,7 @@
/* prefixed opcodes */
-#define AML_EXTOP (UINT16) 0x005b
-
+#define AML_EXTENDED_OPCODE (UINT16) 0x5b00 /* prefix for 2-byte opcodes */
#define AML_MUTEX_OP (UINT16) 0x5b01
#define AML_EVENT_OP (UINT16) 0x5b02
@@ -255,8 +254,10 @@
#define AML_DATA_REGION_OP (UINT16) 0x5b88 /* ACPI 2.0 */
-/* Bogus opcodes (they are actually two separate opcodes) */
-
+/*
+ * Combination opcodes (actually two one-byte opcodes)
+ * Used by the disassembler and iASL compiler
+ */
#define AML_LGREATEREQUAL_OP (UINT16) 0x9295
#define AML_LLESSEQUAL_OP (UINT16) 0x9294
#define AML_LNOTEQUAL_OP (UINT16) 0x9293
@@ -267,7 +268,6 @@
* Use only "Unknown" AML opcodes, don't attempt to use
* any valid ACPI ASCII values (A-Z, 0-9, '-')
*/
-
#define AML_INT_NAMEPATH_OP (UINT16) 0x002d
#define AML_INT_NAMEDFIELD_OP (UINT16) 0x0030
#define AML_INT_RESERVEDFIELD_OP (UINT16) 0x0031
@@ -287,7 +287,6 @@
* There can be up to 31 unique argument types
* Zero is reserved as end-of-list indicator
*/
-
#define ARGP_BYTEDATA 0x01
#define ARGP_BYTELIST 0x02
#define ARGP_CHARLIST 0x03
@@ -350,7 +349,8 @@
#define ARGI_DATAOBJECT 0x12 /* Buffer, String, package or reference to a Node - Used only by SizeOf operator*/
#define ARGI_COMPLEXOBJ 0x13 /* Buffer, String, or package (Used by INDEX op only) */
#define ARGI_REF_OR_STRING 0x14 /* Reference or String (Used by DEREFOF op only) */
-#define ARGI_REGION_OR_FIELD 0x15 /* Used by LOAD op only */
+#define ARGI_REGION_OR_BUFFER 0x15 /* Used by LOAD op only */
+#define ARGI_DATAREFOBJ 0x16
/* Note: types above can expand to 0x1F maximum */
@@ -367,7 +367,6 @@
/*
* opcode groups and types
*/
-
#define OPGRP_NAMED 0x01
#define OPGRP_FIELD 0x02
#define OPGRP_BYTELIST 0x04
@@ -393,6 +392,7 @@
#define AML_HAS_TARGET 0x0800
#define AML_HAS_ARGS 0x1000
#define AML_CONSTANT 0x2000
+#define AML_NO_OPERAND_RESOLVE 0x4000
/* Convenient flag groupings */
@@ -452,6 +452,12 @@
#define AML_TYPE_UNDEFINED 0x19
#define AML_TYPE_BOGUS 0x1A
+/* AML Package Length encodings */
+
+#define ACPI_AML_PACKAGE_TYPE1 0x40
+#define ACPI_AML_PACKAGE_TYPE2 0x4000
+#define ACPI_AML_PACKAGE_TYPE3 0x400000
+#define ACPI_AML_PACKAGE_TYPE4 0x40000000
/*
* Opcode classes
Index: actables.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/actables.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/actables.h -L sys/contrib/dev/acpica/actables.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/actables.h
+++ sys/contrib/dev/acpica/actables.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actables.h - ACPI table management
- * $Revision: 46 $
+ * $Revision: 1.64 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,189 +118,126 @@
#define __ACTABLES_H__
-/* Used in AcpiTbMapAcpiTable for size parameter if table header is to be used */
-
-#define SIZE_IN_HEADER 0
-
-
ACPI_STATUS
-AcpiTbHandleToObject (
- UINT16 TableId,
- ACPI_TABLE_DESC **TableDesc);
+AcpiAllocateRootTable (
+ UINT32 InitialTableCount);
/*
- * tbconvrt - Table conversion routines
+ * tbfadt - FADT parse/convert/validate
*/
+void
+AcpiTbParseFadt (
+ ACPI_NATIVE_UINT TableIndex,
+ UINT8 Flags);
-ACPI_STATUS
-AcpiTbConvertToXsdt (
- ACPI_TABLE_DESC *TableInfo);
-
-ACPI_STATUS
-AcpiTbConvertTableFadt (
- void);
-
-ACPI_STATUS
-AcpiTbBuildCommonFacs (
- ACPI_TABLE_DESC *TableInfo);
+void
+AcpiTbCreateLocalFadt (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length);
-UINT32
-AcpiTbGetTableCount (
- RSDP_DESCRIPTOR *RSDP,
- ACPI_TABLE_HEADER *RSDT);
/*
- * tbget - Table "get" routines
+ * tbfind - find ACPI table
*/
-
ACPI_STATUS
-AcpiTbGetTable (
- ACPI_POINTER *Address,
- ACPI_TABLE_DESC *TableInfo);
-
-ACPI_STATUS
-AcpiTbGetTableHeader (
- ACPI_POINTER *Address,
- ACPI_TABLE_HEADER *ReturnHeader);
+AcpiTbFindTable (
+ char *Signature,
+ char *OemId,
+ char *OemTableId,
+ ACPI_NATIVE_UINT *TableIndex);
-ACPI_STATUS
-AcpiTbGetTableBody (
- ACPI_POINTER *Address,
- ACPI_TABLE_HEADER *Header,
- ACPI_TABLE_DESC *TableInfo);
+/*
+ * tbinstal - Table removal and deletion
+ */
ACPI_STATUS
-AcpiTbGetThisTable (
- ACPI_POINTER *Address,
- ACPI_TABLE_HEADER *Header,
- ACPI_TABLE_DESC *TableInfo);
+AcpiTbResizeRootTableList (
+ void);
ACPI_STATUS
-AcpiTbTableOverride (
- ACPI_TABLE_HEADER *Header,
- ACPI_TABLE_DESC *TableInfo);
+AcpiTbVerifyTable (
+ ACPI_TABLE_DESC *TableDesc);
ACPI_STATUS
-AcpiTbGetTablePtr (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_TABLE_HEADER **TablePtrLoc);
+AcpiTbAddTable (
+ ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT *TableIndex);
ACPI_STATUS
-AcpiTbVerifyRsdp (
- ACPI_POINTER *Address);
+AcpiTbStoreTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ UINT8 Flags,
+ ACPI_NATIVE_UINT *TableIndex);
void
-AcpiTbGetRsdtAddress (
- ACPI_POINTER *OutAddress);
-
-ACPI_STATUS
-AcpiTbValidateRsdt (
- ACPI_TABLE_HEADER *TablePtr);
+AcpiTbDeleteTable (
+ ACPI_TABLE_DESC *TableDesc);
-ACPI_STATUS
-AcpiTbGetRequiredTables (
+void
+AcpiTbTerminate (
void);
-ACPI_STATUS
-AcpiTbGetPrimaryTable (
- ACPI_POINTER *Address,
- ACPI_TABLE_DESC *TableInfo);
+void
+AcpiTbDeleteNamespaceByOwner (
+ ACPI_NATIVE_UINT TableIndex);
ACPI_STATUS
-AcpiTbGetSecondaryTable (
- ACPI_POINTER *Address,
- ACPI_STRING Signature,
- ACPI_TABLE_DESC *TableInfo);
-
-/*
- * tbinstall - Table installation
- */
+AcpiTbAllocateOwnerId (
+ ACPI_NATIVE_UINT TableIndex);
ACPI_STATUS
-AcpiTbInstallTable (
- ACPI_TABLE_DESC *TableInfo);
+AcpiTbReleaseOwnerId (
+ ACPI_NATIVE_UINT TableIndex);
ACPI_STATUS
-AcpiTbMatchSignature (
- char *Signature,
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType);
+AcpiTbGetOwnerId (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_OWNER_ID *OwnerId);
-ACPI_STATUS
-AcpiTbRecognizeTable (
- ACPI_TABLE_DESC *TableInfo,
- UINT8 SearchType);
+BOOLEAN
+AcpiTbIsTableLoaded (
+ ACPI_NATIVE_UINT TableIndex);
-ACPI_STATUS
-AcpiTbInitTableDescriptor (
- ACPI_TABLE_TYPE TableType,
- ACPI_TABLE_DESC *TableInfo);
+void
+AcpiTbSetTableLoadedFlag (
+ ACPI_NATIVE_UINT TableIndex,
+ BOOLEAN IsLoaded);
/*
- * tbremove - Table removal and deletion
+ * tbutils - table manager utilities
*/
-
-void
-AcpiTbDeleteAllTables (
+BOOLEAN
+AcpiTbTablesLoaded (
void);
void
-AcpiTbDeleteTablesByType (
- ACPI_TABLE_TYPE Type);
-
-void
-AcpiTbDeleteSingleTable (
- ACPI_TABLE_DESC *TableDesc);
-
-ACPI_TABLE_DESC *
-AcpiTbUninstallTable (
- ACPI_TABLE_DESC *TableDesc);
+AcpiTbPrintTableHeader(
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_TABLE_HEADER *Header);
-
-/*
- * tbrsd - RSDP, RSDT utilities
- */
+UINT8
+AcpiTbChecksum (
+ UINT8 *Buffer,
+ ACPI_NATIVE_UINT Length);
ACPI_STATUS
-AcpiTbGetTableRsdt (
- void);
-
-UINT8 *
-AcpiTbScanMemoryForRsdp (
- UINT8 *StartAddress,
+AcpiTbVerifyChecksum (
+ ACPI_TABLE_HEADER *Table,
UINT32 Length);
-ACPI_STATUS
-AcpiTbFindRsdp (
- ACPI_TABLE_DESC *TableInfo,
- UINT32 Flags);
-
-
-/*
- * tbutils - common table utilities
- */
-
-ACPI_STATUS
-AcpiTbFindTable (
+void
+AcpiTbInstallTable (
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT8 Flags,
char *Signature,
- char *OemId,
- char *OemTableId,
- ACPI_TABLE_HEADER **TablePtr);
-
-ACPI_STATUS
-AcpiTbVerifyTableChecksum (
- ACPI_TABLE_HEADER *TableHeader);
-
-UINT8
-AcpiTbChecksum (
- void *Buffer,
- UINT32 Length);
+ ACPI_NATIVE_UINT TableIndex);
ACPI_STATUS
-AcpiTbValidateTableHeader (
- ACPI_TABLE_HEADER *TableHeader);
-
+AcpiTbParseRootTable (
+ ACPI_PHYSICAL_ADDRESS RsdpAddress,
+ UINT8 Flags);
#endif /* __ACTABLES_H__ */
Index: rscreate.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rscreate.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rscreate.c -L sys/contrib/dev/acpica/rscreate.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rscreate.c
+++ sys/contrib/dev/acpica/rscreate.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscreate - Create resource lists/tables
- * $Revision: 66 $
+ * $Revision: 1.78 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,10 +130,10 @@
*
* FUNCTION: AcpiRsCreateResourceList
*
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
- * OutputBuffer - Pointer to the user's buffer
+ * PARAMETERS: AmlBuffer - Pointer to the resource byte stream
+ * OutputBuffer - Pointer to the user's buffer
*
- * RETURN: Status - AE_OK if okay, else a valid ACPI_STATUS code
+ * RETURN: Status: AE_OK if okay, else a valid ACPI_STATUS code
* If OutputBuffer is not large enough, OutputBufferLength
* indicates how large OutputBuffer should be, else it
* indicates how may UINT8 elements of OutputBuffer are valid.
@@ -146,33 +146,33 @@
ACPI_STATUS
AcpiRsCreateResourceList (
- ACPI_OPERAND_OBJECT *ByteStreamBuffer,
+ ACPI_OPERAND_OBJECT *AmlBuffer,
ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
- UINT8 *ByteStreamStart;
+ UINT8 *AmlStart;
ACPI_SIZE ListSizeNeeded = 0;
- UINT32 ByteStreamBufferLength;
+ UINT32 AmlBufferLength;
+ void *Resource;
- ACPI_FUNCTION_TRACE ("RsCreateResourceList");
+ ACPI_FUNCTION_TRACE (RsCreateResourceList);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamBuffer = %p\n",
- ByteStreamBuffer));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlBuffer = %p\n",
+ AmlBuffer));
- /*
- * Params already validated, so we don't re-validate here
- */
- ByteStreamBufferLength = ByteStreamBuffer->Buffer.Length;
- ByteStreamStart = ByteStreamBuffer->Buffer.Pointer;
+ /* Params already validated, so we don't re-validate here */
+
+ AmlBufferLength = AmlBuffer->Buffer.Length;
+ AmlStart = AmlBuffer->Buffer.Pointer;
/*
- * Pass the ByteStreamBuffer into a module that can calculate
+ * Pass the AmlBuffer into a module that can calculate
* the buffer size needed for the linked list
*/
- Status = AcpiRsGetListLength (ByteStreamStart, ByteStreamBufferLength,
+ Status = AcpiRsGetListLength (AmlStart, AmlBufferLength,
&ListSizeNeeded);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Status=%X ListSizeNeeded=%X\n",
@@ -192,8 +192,9 @@
/* Do the conversion */
- Status = AcpiRsByteStreamToList (ByteStreamStart, ByteStreamBufferLength,
- OutputBuffer->Pointer);
+ Resource = OutputBuffer->Pointer;
+ Status = AcpiUtWalkAmlResources (AmlStart, AmlBufferLength,
+ AcpiRsConvertAmlToResources, &Resource);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -244,14 +245,13 @@
ACPI_BUFFER PathBuffer;
- ACPI_FUNCTION_TRACE ("RsCreatePciRoutingTable");
+ ACPI_FUNCTION_TRACE (RsCreatePciRoutingTable);
/* Params already validated, so we don't re-validate here */
- /*
- * Get the required buffer length
- */
+ /* Get the required buffer length */
+
Status = AcpiRsGetPciRoutingTableLength (PackageObject,
&BufferSizeNeeded);
if (ACPI_FAILURE (Status))
@@ -298,13 +298,12 @@
*/
UserPrt->Length = (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
- /*
- * Each element of the top-level package must also be a package
- */
+ /* Each element of the top-level package must also be a package */
+
if (ACPI_GET_OBJECT_TYPE (*TopObjectList) != ACPI_TYPE_PACKAGE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X]) Need sub-package, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X]) Need sub-package, found %s",
Index, AcpiUtGetObjectTypeName (*TopObjectList)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -313,8 +312,8 @@
if ((*TopObjectList)->Package.Count != 4)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X]) Need package of length 4, found length %d\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X]) Need package of length 4, found length %d",
Index, (*TopObjectList)->Package.Count));
return_ACPI_STATUS (AE_AML_PACKAGE_LIMIT);
}
@@ -326,9 +325,8 @@
*/
SubObjectList = (*TopObjectList)->Package.Elements;
- /*
- * 1) First subobject: Dereference the PRT.Address
- */
+ /* 1) First subobject: Dereference the PRT.Address */
+
ObjDesc = SubObjectList[0];
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
{
@@ -336,15 +334,14 @@
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Address) Need Integer, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Address) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
- /*
- * 2) Second subobject: Dereference the PRT.Pin
- */
+ /* 2) Second subobject: Dereference the PRT.Pin */
+
ObjDesc = SubObjectList[1];
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
{
@@ -352,79 +349,86 @@
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Pin) Need Integer, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Pin) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
/*
* 3) Third subobject: Dereference the PRT.SourceName
+ * The name may be unresolved (slack mode), so allow a null object
*/
ObjDesc = SubObjectList[2];
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ if (ObjDesc)
{
- case ACPI_TYPE_LOCAL_REFERENCE:
-
- if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP)
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Source) Need name, found reference op %X\n",
- Index, ObjDesc->Reference.Opcode));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
+ case ACPI_TYPE_LOCAL_REFERENCE:
- Node = ObjDesc->Reference.Node;
+ if (ObjDesc->Reference.Opcode != AML_INT_NAMEPATH_OP)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Source) Need name, found reference op %X",
+ Index, ObjDesc->Reference.Opcode));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
- /* Use *remaining* length of the buffer as max for pathname */
+ Node = ObjDesc->Reference.Node;
- PathBuffer.Length = OutputBuffer->Length -
- (UINT32) ((UINT8 *) UserPrt->Source -
- (UINT8 *) OutputBuffer->Pointer);
- PathBuffer.Pointer = UserPrt->Source;
+ /* Use *remaining* length of the buffer as max for pathname */
- Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
+ PathBuffer.Length = OutputBuffer->Length -
+ (UINT32) ((UINT8 *) UserPrt->Source -
+ (UINT8 *) OutputBuffer->Pointer);
+ PathBuffer.Pointer = UserPrt->Source;
- UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1; /* include null terminator */
- break;
+ Status = AcpiNsHandleToPathname ((ACPI_HANDLE) Node, &PathBuffer);
+ /* +1 to include null terminator */
- case ACPI_TYPE_STRING:
+ UserPrt->Length += (UINT32) ACPI_STRLEN (UserPrt->Source) + 1;
+ break;
- ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
- /* Add to the Length field the length of the string (add 1 for terminator) */
+ case ACPI_TYPE_STRING:
- UserPrt->Length += ObjDesc->String.Length + 1;
- break;
+ ACPI_STRCPY (UserPrt->Source, ObjDesc->String.Pointer);
+ /*
+ * Add to the Length field the length of the string
+ * (add 1 for terminator)
+ */
+ UserPrt->Length += ObjDesc->String.Length + 1;
+ break;
- case ACPI_TYPE_INTEGER:
- /*
- * If this is a number, then the Source Name is NULL, since the
- * entire buffer was zeroed out, we can leave this alone.
- *
- * Add to the Length field the length of the UINT32 NULL
- */
- UserPrt->Length += sizeof (UINT32);
- break;
+ case ACPI_TYPE_INTEGER:
+ /*
+ * If this is a number, then the Source Name is NULL, since the
+ * entire buffer was zeroed out, we can leave this alone.
+ *
+ * Add to the Length field the length of the UINT32 NULL
+ */
+ UserPrt->Length += sizeof (UINT32);
+ break;
- default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].Source) Need Ref/String/Integer, found %s\n",
- Index, AcpiUtGetObjectTypeName (ObjDesc)));
- return_ACPI_STATUS (AE_BAD_DATA);
+ default:
+
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].Source) Need Ref/String/Integer, found %s",
+ Index, AcpiUtGetObjectTypeName (ObjDesc)));
+ return_ACPI_STATUS (AE_BAD_DATA);
+ }
}
/* Now align the current length */
- UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BITS (UserPrt->Length);
+ UserPrt->Length = (UINT32) ACPI_ROUND_UP_TO_64BIT (UserPrt->Length);
+
+ /* 4) Fourth subobject: Dereference the PRT.SourceIndex */
- /*
- * 4) Fourth subobject: Dereference the PRT.SourceIndex
- */
ObjDesc = SubObjectList[3];
if (ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_INTEGER)
{
@@ -432,8 +436,8 @@
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "(PRT[%X].SourceIndex) Need Integer, found %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "(PRT[%X].SourceIndex) Need Integer, found %s",
Index, AcpiUtGetObjectTypeName (ObjDesc)));
return_ACPI_STATUS (AE_BAD_DATA);
}
@@ -451,7 +455,7 @@
/*******************************************************************************
*
- * FUNCTION: AcpiRsCreateByteStream
+ * FUNCTION: AcpiRsCreateAmlResources
*
* PARAMETERS: LinkedListBuffer - Pointer to the resource linked list
* OutputBuffer - Pointer to the user's buffer
@@ -468,15 +472,15 @@
******************************************************************************/
ACPI_STATUS
-AcpiRsCreateByteStream (
+AcpiRsCreateAmlResources (
ACPI_RESOURCE *LinkedListBuffer,
ACPI_BUFFER *OutputBuffer)
{
ACPI_STATUS Status;
- ACPI_SIZE ByteStreamSizeNeeded = 0;
+ ACPI_SIZE AmlSizeNeeded = 0;
- ACPI_FUNCTION_TRACE ("RsCreateByteStream");
+ ACPI_FUNCTION_TRACE (RsCreateAmlResources);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "LinkedListBuffer = %p\n",
@@ -488,11 +492,11 @@
* Pass the LinkedListBuffer into a module that calculates
* the buffer size needed for the byte stream.
*/
- Status = AcpiRsGetByteStreamLength (LinkedListBuffer,
- &ByteStreamSizeNeeded);
+ Status = AcpiRsGetAmlLength (LinkedListBuffer,
+ &AmlSizeNeeded);
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ByteStreamSizeNeeded=%X, %s\n",
- (UINT32) ByteStreamSizeNeeded, AcpiFormatException (Status)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "AmlSizeNeeded=%X, %s\n",
+ (UINT32) AmlSizeNeeded, AcpiFormatException (Status)));
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -500,7 +504,7 @@
/* Validate/Allocate/Clear caller buffer */
- Status = AcpiUtInitializeBuffer (OutputBuffer, ByteStreamSizeNeeded);
+ Status = AcpiUtInitializeBuffer (OutputBuffer, AmlSizeNeeded);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -508,7 +512,7 @@
/* Do the conversion */
- Status = AcpiRsListToByteStream (LinkedListBuffer, ByteStreamSizeNeeded,
+ Status = AcpiRsConvertResourcesToAml (LinkedListBuffer, AmlSizeNeeded,
OutputBuffer->Pointer);
if (ACPI_FAILURE (Status))
{
Index: hwsleep.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/hwsleep.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/hwsleep.c -L sys/contrib/dev/acpica/hwsleep.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/hwsleep.c
+++ sys/contrib/dev/acpica/hwsleep.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Name: hwsleep.c - ACPI Hardware Sleep/Wake Interface
- * $Revision: 70 $
+ * $Revision: 1.87 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,25 +116,13 @@
*****************************************************************************/
#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwsleep")
-#define METHOD_NAME__BFS "\\_BFS"
-#define METHOD_NAME__GTS "\\_GTS"
-#define METHOD_NAME__PTS "\\_PTS"
-#define METHOD_NAME__SST "\\_SI._SST"
-#define METHOD_NAME__WAK "\\_WAK"
-
-#define ACPI_SST_INDICATOR_OFF 0
-#define ACPI_SST_WORKING 1
-#define ACPI_SST_WAKING 2
-#define ACPI_SST_SLEEPING 3
-#define ACPI_SST_SLEEP_CONTEXT 4
-
-
-/******************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiSetFirmwareWakingVector
*
@@ -143,55 +131,76 @@
*
* RETURN: Status
*
- * DESCRIPTION: Access function for dFirmwareWakingVector field in FACS
+ * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS
*
******************************************************************************/
ACPI_STATUS
AcpiSetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS PhysicalAddress)
+ ACPI_PHYSICAL_ADDRESS PhysicalAddress)
{
+ ACPI_TABLE_FACS *Facs;
+ ACPI_STATUS Status;
+
- ACPI_FUNCTION_TRACE ("AcpiSetFirmwareWakingVector");
+ ACPI_FUNCTION_TRACE (AcpiSetFirmwareWakingVector);
+ /* Get the FACS */
+
+ Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
+ ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
/* Set the vector */
- if (AcpiGbl_CommonFACS.VectorWidth == 32)
+ if ((Facs->Length < 32) ||
+ (!(Facs->XFirmwareWakingVector)))
{
- *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector))
- = (UINT32) PhysicalAddress;
+ /*
+ * ACPI 1.0 FACS or short table or optional X_ field is zero
+ */
+ Facs->FirmwareWakingVector = (UINT32) PhysicalAddress;
}
else
{
- *AcpiGbl_CommonFACS.FirmwareWakingVector
- = PhysicalAddress;
+ /*
+ * ACPI 2.0 FACS with valid X_ field
+ */
+ Facs->XFirmwareWakingVector = PhysicalAddress;
}
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiSetFirmwareWakingVector)
-/******************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiGetFirmwareWakingVector
*
- * PARAMETERS: *PhysicalAddress - Output buffer where contents of
+ * PARAMETERS: *PhysicalAddress - Where the contents of
* the FirmwareWakingVector field of
- * the FACS will be stored.
+ * the FACS will be returned.
*
- * RETURN: Status
+ * RETURN: Status, vector
*
- * DESCRIPTION: Access function for FirmwareWakingVector field in FACS
+ * DESCRIPTION: Access function for the FirmwareWakingVector field in FACS
*
******************************************************************************/
ACPI_STATUS
AcpiGetFirmwareWakingVector (
- ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
+ ACPI_PHYSICAL_ADDRESS *PhysicalAddress)
{
+ ACPI_TABLE_FACS *Facs;
+ ACPI_STATUS Status;
+
- ACPI_FUNCTION_TRACE ("AcpiGetFirmwareWakingVector");
+ ACPI_FUNCTION_TRACE (AcpiGetFirmwareWakingVector);
if (!PhysicalAddress)
@@ -199,24 +208,41 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ /* Get the FACS */
+
+ Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
+ ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Get the vector */
- if (AcpiGbl_CommonFACS.VectorWidth == 32)
+ if ((Facs->Length < 32) ||
+ (!(Facs->XFirmwareWakingVector)))
{
- *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS)
- *(ACPI_CAST_PTR (UINT32, AcpiGbl_CommonFACS.FirmwareWakingVector));
+ /*
+ * ACPI 1.0 FACS or short table or optional X_ field is zero
+ */
+ *PhysicalAddress =
+ (ACPI_PHYSICAL_ADDRESS) Facs->FirmwareWakingVector;
}
else
{
- *PhysicalAddress =
- *AcpiGbl_CommonFACS.FirmwareWakingVector;
+ /*
+ * ACPI 2.0 FACS with valid X_ field
+ */
+ *PhysicalAddress = (ACPI_PHYSICAL_ADDRESS) Facs->XFirmwareWakingVector;
}
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetFirmwareWakingVector)
-/******************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiEnterSleepStatePrep
*
@@ -240,7 +266,7 @@
ACPI_OBJECT Arg;
- ACPI_FUNCTION_TRACE ("AcpiEnterSleepStatePrep");
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepStatePrep);
/*
@@ -294,7 +320,7 @@
break;
default:
- Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is indicator off */
+ Arg.Integer.Value = ACPI_SST_INDICATOR_OFF; /* Default is off */
break;
}
@@ -303,14 +329,16 @@
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "While executing method _SST"));
}
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepStatePrep)
-/******************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiEnterSleepState
*
@@ -336,13 +364,13 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiEnterSleepState");
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepState);
if ((AcpiGbl_SleepTypeA > ACPI_SLEEP_TYPE_MAX) ||
(AcpiGbl_SleepTypeB > ACPI_SLEEP_TYPE_MAX))
{
- ACPI_REPORT_ERROR (("Sleep values out of range: A=%X B=%X\n",
+ ACPI_ERROR ((AE_INFO, "Sleep values out of range: A=%X B=%X",
AcpiGbl_SleepTypeA, AcpiGbl_SleepTypeB));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
@@ -352,7 +380,7 @@
/* Clear wake status */
- Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -360,7 +388,7 @@
/* Clear all fixed and general purpose status bits */
- Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiHwClearAcpiStatus ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -370,7 +398,7 @@
{
/* Disable BM arbitration */
- Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -381,14 +409,14 @@
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
- Status = AcpiHwDisableAllGpes (ACPI_ISR);
+ Status = AcpiHwDisableAllGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = FALSE;
- Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
+ Status = AcpiHwEnableAllWakeupGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -396,16 +424,19 @@
/* Get current value of PM1A control */
- Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL, &PM1AControl);
+ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_CONTROL, &PM1AControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Entering sleep state [S%d]\n", SleepState));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
+ "Entering sleep state [S%d]\n", SleepState));
/* Clear SLP_EN and SLP_TYP fields */
- PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask | SleepEnableRegInfo->AccessBitMask);
+ PM1AControl &= ~(SleepTypeRegInfo->AccessBitMask |
+ SleepEnableRegInfo->AccessBitMask);
PM1BControl = PM1AControl;
/* Insert SLP_TYP bits */
@@ -420,13 +451,15 @@
/* Write #1: fill in SLP_TYP data */
- Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -441,13 +474,15 @@
ACPI_FLUSH_CPU_CACHE ();
- Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1A_CONTROL, PM1AControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1B_CONTROL, PM1BControl);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -456,10 +491,11 @@
if (SleepState > ACPI_STATE_S3)
{
/*
- * We wanted to sleep > S3, but it didn't happen (by virtue of the fact that
- * we are still executing!)
+ * We wanted to sleep > S3, but it didn't happen (by virtue of the
+ * fact that we are still executing!)
*
- * Wait ten seconds, then try again. This is to get S4/S5 to work on all machines.
+ * Wait ten seconds, then try again. This is to get S4/S5 to work on
+ * all machines.
*
* We wait so long to allow chipsets that poll this reg very slowly to
* still read the right value. Ideally, this block would go
@@ -467,7 +503,8 @@
*/
AcpiOsStall (10000000);
- Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_CONTROL,
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_CONTROL,
SleepEnableRegInfo->AccessBitMask);
if (ACPI_FAILURE (Status))
{
@@ -480,7 +517,7 @@
Retry = 1000;
do
{
- Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -502,8 +539,10 @@
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepState)
-/******************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiEnterSleepStateS4bios
*
@@ -524,16 +563,16 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiEnterSleepStateS4bios");
+ ACPI_FUNCTION_TRACE (AcpiEnterSleepStateS4bios);
- Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_WAKE_STATUS, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiHwClearAcpiStatus (ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiHwClearAcpiStatus ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -543,14 +582,14 @@
* 1) Disable/Clear all GPEs
* 2) Enable all wakeup GPEs
*/
- Status = AcpiHwDisableAllGpes (ACPI_ISR);
+ Status = AcpiHwDisableAllGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = FALSE;
- Status = AcpiHwEnableAllWakeupGpes (ACPI_ISR);
+ Status = AcpiHwEnableAllWakeupGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -558,11 +597,12 @@
ACPI_FLUSH_CPU_CACHE ();
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, (UINT32) AcpiGbl_FADT->S4BiosReq, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+ (UINT32) AcpiGbl_FADT.S4BiosRequest, 8);
do {
AcpiOsStall(1000);
- Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue, ACPI_MTX_DO_NOT_LOCK);
+ Status = AcpiGetRegister (ACPI_BITREG_WAKE_STATUS, &InValue);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -572,8 +612,10 @@
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiEnterSleepStateS4bios)
-/******************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiLeaveSleepState
*
@@ -599,7 +641,7 @@
UINT32 PM1BControl;
- ACPI_FUNCTION_TRACE ("AcpiLeaveSleepState");
+ ACPI_FUNCTION_TRACE (AcpiLeaveSleepState);
/*
@@ -656,20 +698,20 @@
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _SST"));
}
Arg.Integer.Value = SleepState;
Status = AcpiEvaluateObject (NULL, METHOD_NAME__BFS, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _BFS failed, %s\n", AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _BFS"));
}
Status = AcpiEvaluateObject (NULL, METHOD_NAME__WAK, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _WAK failed, %s\n", AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _WAK"));
}
/* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
@@ -678,14 +720,14 @@
* 1) Disable/Clear all GPEs
* 2) Enable all runtime GPEs
*/
- Status = AcpiHwDisableAllGpes (ACPI_NOT_ISR);
+ Status = AcpiHwDisableAllGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
AcpiGbl_SystemAwakeAndRunning = TRUE;
- Status = AcpiHwEnableAllRuntimeGpes (ACPI_NOT_ISR);
+ Status = AcpiHwEnableAllRuntimeGpes ();
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -693,14 +735,15 @@
/* Enable power button */
- (void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId,
- 1, ACPI_MTX_DO_NOT_LOCK);
- (void) AcpiSetRegister(AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId,
- 1, ACPI_MTX_DO_NOT_LOCK);
+ (void) AcpiSetRegister(
+ AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].EnableRegisterId, 1);
+
+ (void) AcpiSetRegister(
+ AcpiGbl_FixedEventInfo[ACPI_EVENT_POWER_BUTTON].StatusRegisterId, 1);
/* Enable BM arbitration */
- Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (ACPI_BITREG_ARB_DISABLE, 0);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -710,8 +753,11 @@
Status = AcpiEvaluateObject (NULL, METHOD_NAME__SST, &ArgList, NULL);
if (ACPI_FAILURE (Status) && Status != AE_NOT_FOUND)
{
- ACPI_REPORT_ERROR (("Method _SST failed, %s\n", AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Method _SST"));
}
return_ACPI_STATUS (Status);
}
+
+ACPI_EXPORT_SYMBOL (AcpiLeaveSleepState)
+
Index: utmath.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utmath.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utmath.c -L sys/contrib/dev/acpica/utmath.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utmath.c
+++ sys/contrib/dev/acpica/utmath.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmath - Integer math support routines
- * $Revision: 14 $
+ * $Revision: 1.22 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -159,14 +159,14 @@
UINT32 Remainder32;
- ACPI_FUNCTION_TRACE ("UtShortDivide");
+ ACPI_FUNCTION_TRACE (UtShortDivide);
/* Always check for a zero divisor */
if (Divisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -229,14 +229,14 @@
UINT64_OVERLAY Partial3;
- ACPI_FUNCTION_TRACE ("UtDivide");
+ ACPI_FUNCTION_TRACE (UtDivide);
/* Always check for a zero divisor */
if (InDivisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -349,6 +349,8 @@
*
* FUNCTION: AcpiUtShortDivide, AcpiUtDivide
*
+ * PARAMETERS: See function headers above
+ *
* DESCRIPTION: Native versions of the UtDivide functions. Use these if either
* 1) The target is a 64-bit platform and therefore 64-bit
* integer math is supported directly by the machine.
@@ -366,14 +368,14 @@
UINT32 *OutRemainder)
{
- ACPI_FUNCTION_TRACE ("UtShortDivide");
+ ACPI_FUNCTION_TRACE (UtShortDivide);
/* Always check for a zero divisor */
if (Divisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtShortDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
@@ -398,14 +400,14 @@
ACPI_INTEGER *OutQuotient,
ACPI_INTEGER *OutRemainder)
{
- ACPI_FUNCTION_TRACE ("UtDivide");
+ ACPI_FUNCTION_TRACE (UtDivide);
/* Always check for a zero divisor */
if (InDivisor == 0)
{
- ACPI_REPORT_ERROR (("AcpiUtDivide: Divide by zero\n"));
+ ACPI_ERROR ((AE_INFO, "Divide by zero"));
return_ACPI_STATUS (AE_AML_DIVIDE_BY_ZERO);
}
Index: utmisc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utmisc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utmisc.c -L sys/contrib/dev/acpica/utmisc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utmisc.c
+++ sys/contrib/dev/acpica/utmisc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utmisc - common utility procedures
- * $Revision: 101 $
+ * $Revision: 1.151 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,9 +127,350 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiUtValidateException
+ *
+ * PARAMETERS: Status - The ACPI_STATUS code to be formatted
+ *
+ * RETURN: A string containing the exception text. NULL if exception is
+ * not valid.
+ *
+ * DESCRIPTION: This function validates and translates an ACPI exception into
+ * an ASCII string.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiUtValidateException (
+ ACPI_STATUS Status)
+{
+ ACPI_STATUS SubStatus;
+ const char *Exception = NULL;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /*
+ * Status is composed of two parts, a "type" and an actual code
+ */
+ SubStatus = (Status & ~AE_CODE_MASK);
+
+ switch (Status & AE_CODE_MASK)
+ {
+ case AE_CODE_ENVIRONMENTAL:
+
+ if (SubStatus <= AE_CODE_ENV_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
+ }
+ break;
+
+ case AE_CODE_PROGRAMMER:
+
+ if (SubStatus <= AE_CODE_PGM_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_ACPI_TABLES:
+
+ if (SubStatus <= AE_CODE_TBL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_AML:
+
+ if (SubStatus <= AE_CODE_AML_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
+ }
+ break;
+
+ case AE_CODE_CONTROL:
+
+ if (SubStatus <= AE_CODE_CTRL_MAX)
+ {
+ Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (ACPI_CAST_PTR (const char, Exception));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtIsAmlTable
+ *
+ * PARAMETERS: Table - An ACPI table
+ *
+ * RETURN: TRUE if table contains executable AML; FALSE otherwise
+ *
+ * DESCRIPTION: Check ACPI Signature for a table that contains AML code.
+ * Currently, these are DSDT,SSDT,PSDT. All other table types are
+ * data tables that do not contain AML code.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtIsAmlTable (
+ ACPI_TABLE_HEADER *Table)
+{
+
+ /* These are the only tables that contain executable AML */
+
+ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_DSDT) ||
+ ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_PSDT) ||
+ ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_SSDT))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtAllocateOwnerId
+ *
+ * PARAMETERS: OwnerId - Where the new owner ID is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Allocate a table or method owner ID. The owner ID is used to
+ * track objects created by the table or method, to be deleted
+ * when the method exits or the table is unloaded.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiUtAllocateOwnerId (
+ ACPI_OWNER_ID *OwnerId)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+ ACPI_NATIVE_UINT k;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (UtAllocateOwnerId);
+
+
+ /* Guard against multiple allocations of ID to the same location */
+
+ if (*OwnerId)
+ {
+ ACPI_ERROR ((AE_INFO, "Owner ID [%2.2X] already exists", *OwnerId));
+ return_ACPI_STATUS (AE_ALREADY_EXISTS);
+ }
+
+ /* Mutex for the global ID mask */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Find a free owner ID, cycle through all possible IDs on repeated
+ * allocations. (ACPI_NUM_OWNERID_MASKS + 1) because first index may have
+ * to be scanned twice.
+ */
+ for (i = 0, j = AcpiGbl_LastOwnerIdIndex;
+ i < (ACPI_NUM_OWNERID_MASKS + 1);
+ i++, j++)
+ {
+ if (j >= ACPI_NUM_OWNERID_MASKS)
+ {
+ j = 0; /* Wraparound to start of mask array */
+ }
+
+ for (k = AcpiGbl_NextOwnerIdOffset; k < 32; k++)
+ {
+ if (AcpiGbl_OwnerIdMask[j] == ACPI_UINT32_MAX)
+ {
+ /* There are no free IDs in this mask */
+
+ break;
+ }
+
+ if (!(AcpiGbl_OwnerIdMask[j] & (1 << k)))
+ {
+ /*
+ * Found a free ID. The actual ID is the bit index plus one,
+ * making zero an invalid Owner ID. Save this as the last ID
+ * allocated and update the global ID mask.
+ */
+ AcpiGbl_OwnerIdMask[j] |= (1 << k);
+
+ AcpiGbl_LastOwnerIdIndex = (UINT8) j;
+ AcpiGbl_NextOwnerIdOffset = (UINT8) (k + 1);
+
+ /*
+ * Construct encoded ID from the index and bit position
+ *
+ * Note: Last [j].k (bit 255) is never used and is marked
+ * permanently allocated (prevents +1 overflow)
+ */
+ *OwnerId = (ACPI_OWNER_ID) ((k + 1) + ACPI_MUL_32 (j));
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_VALUES,
+ "Allocated OwnerId: %2.2X\n", (unsigned int) *OwnerId));
+ goto Exit;
+ }
+ }
+
+ AcpiGbl_NextOwnerIdOffset = 0;
+ }
+
+ /*
+ * All OwnerIds have been allocated. This typically should
+ * not happen since the IDs are reused after deallocation. The IDs are
+ * allocated upon table load (one per table) and method execution, and
+ * they are released when a table is unloaded or a method completes
+ * execution.
+ *
+ * If this error happens, there may be very deep nesting of invoked control
+ * methods, or there may be a bug where the IDs are not released.
+ */
+ Status = AE_OWNER_ID_LIMIT;
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate new OwnerId (255 max), AE_OWNER_ID_LIMIT"));
+
+Exit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtReleaseOwnerId
+ *
+ * PARAMETERS: OwnerIdPtr - Pointer to a previously allocated OwnerID
+ *
+ * RETURN: None. No error is returned because we are either exiting a
+ * control method or unloading a table. Either way, we would
+ * ignore any error anyway.
+ *
+ * DESCRIPTION: Release a table or method owner ID. Valid IDs are 1 - 255
+ *
+ ******************************************************************************/
+
+void
+AcpiUtReleaseOwnerId (
+ ACPI_OWNER_ID *OwnerIdPtr)
+{
+ ACPI_OWNER_ID OwnerId = *OwnerIdPtr;
+ ACPI_STATUS Status;
+ ACPI_NATIVE_UINT Index;
+ UINT32 Bit;
+
+
+ ACPI_FUNCTION_TRACE_U32 (UtReleaseOwnerId, OwnerId);
+
+
+ /* Always clear the input OwnerId (zero is an invalid ID) */
+
+ *OwnerIdPtr = 0;
+
+ /* Zero is not a valid OwnerID */
+
+ if (OwnerId == 0)
+ {
+ ACPI_ERROR ((AE_INFO, "Invalid OwnerId: %2.2X", OwnerId));
+ return_VOID;
+ }
+
+ /* Mutex for the global ID mask */
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_CACHES);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VOID;
+ }
+
+ /* Normalize the ID to zero */
+
+ OwnerId--;
+
+ /* Decode ID to index/offset pair */
+
+ Index = ACPI_DIV_32 (OwnerId);
+ Bit = 1 << ACPI_MOD_32 (OwnerId);
+
+ /* Free the owner ID only if it is valid */
+
+ if (AcpiGbl_OwnerIdMask[Index] & Bit)
+ {
+ AcpiGbl_OwnerIdMask[Index] ^= Bit;
+ }
+ else
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Release of non-allocated OwnerId: %2.2X", OwnerId + 1));
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ return_VOID;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtStrupr (strupr)
+ *
+ * PARAMETERS: SrcString - The source string to convert
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert string to uppercase
+ *
+ * NOTE: This is not a POSIX function, so it appears here, not in utclib.c
+ *
+ ******************************************************************************/
+
+void
+AcpiUtStrupr (
+ char *SrcString)
+{
+ char *String;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ if (!SrcString)
+ {
+ return;
+ }
+
+ /* Walk entire string, uppercasing the letters */
+
+ for (String = SrcString; *String; String++)
+ {
+ *String = (char) ACPI_TOUPPER (*String);
+ }
+
+ return;
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtPrintString
*
* PARAMETERS: String - Null terminated ASCII string
+ * MaxLength - Maximum output length
*
* RETURN: None
*
@@ -160,7 +501,7 @@
switch (String[i])
{
case 0x07:
- AcpiOsPrintf ("\\a"); /* BELL */
+ AcpiOsPrintf ("\\a"); /* BELL */
break;
case 0x08:
@@ -227,6 +568,8 @@
*
* PARAMETERS: Value - Value to be converted
*
+ * RETURN: UINT32 integer with bytes swapped
+ *
* DESCRIPTION: Convert a 32-bit value to big-endian (swap the bytes)
*
******************************************************************************/
@@ -240,7 +583,6 @@
UINT32 Value;
UINT8 Bytes[4];
} Out;
-
union
{
UINT32 Value;
@@ -282,14 +624,18 @@
UINT8 Revision)
{
- if (Revision <= 1)
+ if (Revision < 2)
{
+ /* 32-bit case */
+
AcpiGbl_IntegerBitWidth = 32;
AcpiGbl_IntegerNybbleWidth = 8;
AcpiGbl_IntegerByteWidth = 4;
}
else
{
+ /* 64-bit case (ACPI 2.0+) */
+
AcpiGbl_IntegerBitWidth = 64;
AcpiGbl_IntegerNybbleWidth = 16;
AcpiGbl_IntegerByteWidth = 8;
@@ -302,7 +648,8 @@
*
* FUNCTION: AcpiUtDisplayInitPathname
*
- * PARAMETERS: ObjHandle - Handle whose pathname will be displayed
+ * PARAMETERS: Type - Object type of the node
+ * ObjHandle - Handle whose pathname will be displayed
* Path - Additional path string to be appended.
* (NULL if no extra path)
*
@@ -356,7 +703,8 @@
/* Print the object type and pathname */
- AcpiOsPrintf ("%-12s %s", AcpiUtGetTypeName (Type), (char *) Buffer.Pointer);
+ AcpiOsPrintf ("%-12s %s",
+ AcpiUtGetTypeName (Type), (char *) Buffer.Pointer);
/* Extra path is used to append names like _STA, _INI, etc. */
@@ -366,18 +714,60 @@
}
AcpiOsPrintf ("\n");
- ACPI_MEM_FREE (Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
}
#endif
/*******************************************************************************
*
+ * FUNCTION: AcpiUtValidAcpiChar
+ *
+ * PARAMETERS: Char - The character to be examined
+ * Position - Byte position (0-3)
+ *
+ * RETURN: TRUE if the character is valid, FALSE otherwise
+ *
+ * DESCRIPTION: Check for a valid ACPI character. Must be one of:
+ * 1) Upper case alpha
+ * 2) numeric
+ * 3) underscore
+ *
+ * We allow a '!' as the last character because of the ASF! table
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiUtValidAcpiChar (
+ char Character,
+ ACPI_NATIVE_UINT Position)
+{
+
+ if (!((Character >= 'A' && Character <= 'Z') ||
+ (Character >= '0' && Character <= '9') ||
+ (Character == '_')))
+ {
+ /* Allow a '!' in the last position */
+
+ if (Character == '!' && Position == 3)
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+ }
+
+ return (TRUE);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiUtValidAcpiName
*
- * PARAMETERS: Character - The character to be examined
+ * PARAMETERS: Name - The name to be examined
*
- * RETURN: 1 if Character may appear in a name, else 0
+ * RETURN: TRUE if the name is valid, FALSE otherwise
*
* DESCRIPTION: Check for a valid ACPI name. Each character must be one of:
* 1) Upper case alpha
@@ -390,8 +780,6 @@
AcpiUtValidAcpiName (
UINT32 Name)
{
- char *NamePtr = (char *) &Name;
- char Character;
ACPI_NATIVE_UINT i;
@@ -400,12 +788,7 @@
for (i = 0; i < ACPI_NAME_SIZE; i++)
{
- Character = *NamePtr;
- NamePtr++;
-
- if (!((Character == '_') ||
- (Character >= 'A' && Character <= 'Z') ||
- (Character >= '0' && Character <= '9')))
+ if (!AcpiUtValidAcpiChar ((ACPI_CAST_PTR (char, &Name))[i], i))
{
return (FALSE);
}
@@ -417,26 +800,41 @@
/*******************************************************************************
*
- * FUNCTION: AcpiUtValidAcpiCharacter
+ * FUNCTION: AcpiUtRepairName
*
- * PARAMETERS: Character - The character to be examined
+ * PARAMETERS: Name - The ACPI name to be repaired
*
- * RETURN: 1 if Character may appear in a name, else 0
+ * RETURN: Repaired version of the name
*
- * DESCRIPTION: Check for a printable character
+ * DESCRIPTION: Repair an ACPI name: Change invalid characters to '*' and
+ * return the new name.
*
******************************************************************************/
-BOOLEAN
-AcpiUtValidAcpiCharacter (
- char Character)
+ACPI_NAME
+AcpiUtRepairName (
+ char *Name)
{
+ ACPI_NATIVE_UINT i;
+ char NewName[ACPI_NAME_SIZE];
- ACPI_FUNCTION_ENTRY ();
- return ((BOOLEAN) ((Character == '_') ||
- (Character >= 'A' && Character <= 'Z') ||
- (Character >= '0' && Character <= '9')));
+ for (i = 0; i < ACPI_NAME_SIZE; i++)
+ {
+ NewName[i] = Name[i];
+
+ /*
+ * Replace a bad character with something printable, yet technically
+ * still invalid. This prevents any collisions with existing "good"
+ * names in the namespace.
+ */
+ if (!AcpiUtValidAcpiChar (Name[i], i))
+ {
+ NewName[i] = '*';
+ }
+ }
+
+ return (*(UINT32 *) NewName);
}
@@ -445,12 +843,15 @@
* FUNCTION: AcpiUtStrtoul64
*
* PARAMETERS: String - Null terminated string
- * Base - Radix of the string: 10, 16, or ACPI_ANY_BASE
+ * Base - Radix of the string: 16 or ACPI_ANY_BASE;
+ * ACPI_ANY_BASE means 'in behalf of ToInteger'
* RetInteger - Where the converted integer is returned
*
* RETURN: Status and Converted value
*
- * DESCRIPTION: Convert a string into an unsigned value.
+ * DESCRIPTION: Convert a string into an unsigned value. Performs either a
+ * 32-bit or 64-bit conversion, depending on the current mode
+ * of the interpreter.
* NOTE: Does not support Octal strings, not needed.
*
******************************************************************************/
@@ -461,18 +862,23 @@
UINT32 Base,
ACPI_INTEGER *RetInteger)
{
- UINT32 ThisDigit;
+ UINT32 ThisDigit = 0;
ACPI_INTEGER ReturnValue = 0;
ACPI_INTEGER Quotient;
+ ACPI_INTEGER Dividend;
+ UINT32 ToIntegerOp = (Base == ACPI_ANY_BASE);
+ UINT32 Mode32 = (AcpiGbl_IntegerByteWidth == 4);
+ UINT8 ValidDigits = 0;
+ UINT8 SignOf0x = 0;
+ UINT8 Term = 0;
- ACPI_FUNCTION_TRACE ("UtStroul64");
+ ACPI_FUNCTION_TRACE_STR (UtStroul64, String);
switch (Base)
{
case ACPI_ANY_BASE:
- case 10:
case 16:
break;
@@ -481,24 +887,31 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ if (!String)
+ {
+ goto ErrorExit;
+ }
+
/* Skip over any white space in the buffer */
- while (ACPI_IS_SPACE (*String) || *String == '\t')
+ while ((*String) && (ACPI_IS_SPACE (*String) || *String == '\t'))
{
- ++String;
+ String++;
}
- /*
- * If the input parameter Base is zero, then we need to
- * determine if it is decimal or hexadecimal:
- */
- if (Base == 0)
+ if (ToIntegerOp)
{
- if ((*String == '0') &&
- (ACPI_TOLOWER (*(++String)) == 'x'))
+ /*
+ * Base equal to ACPI_ANY_BASE means 'ToInteger operation case'.
+ * We need to determine if it is decimal or hexadecimal.
+ */
+ if ((*String == '0') && (ACPI_TOLOWER (*(String + 1)) == 'x'))
{
+ SignOf0x = 1;
Base = 16;
- ++String;
+
+ /* Skip over the leading '0x' */
+ String += 2;
}
else
{
@@ -506,841 +919,175 @@
}
}
- /*
- * For hexadecimal base, skip over the leading
- * 0 or 0x, if they are present.
- */
- if (Base == 16 &&
- *String == '0' &&
- ACPI_TOLOWER (*(++String)) == 'x')
- {
- String++;
- }
-
- /* Main loop: convert the string to a 64-bit integer */
+ /* Any string left? Check that '0x' is not followed by white space. */
- while (*String)
+ if (!(*String) || ACPI_IS_SPACE (*String) || *String == '\t')
{
- if (ACPI_IS_DIGIT (*String))
- {
- /* Convert ASCII 0-9 to Decimal value */
-
- ThisDigit = ((UINT8) *String) - '0';
- }
- else
- {
- ThisDigit = (UINT8) ACPI_TOUPPER (*String);
- if (ACPI_IS_UPPER ((char) ThisDigit))
- {
- /* Convert ASCII Hex char to value */
-
- ThisDigit = ThisDigit - 'A' + 10;
- }
- else
- {
- goto ErrorExit;
- }
- }
-
- /* Check to see if digit is out of range */
-
- if (ThisDigit >= Base)
+ if (ToIntegerOp)
{
goto ErrorExit;
}
-
- /* Divide the digit into the correct position */
-
- (void) AcpiUtShortDivide ((ACPI_INTEGER_MAX - (ACPI_INTEGER) ThisDigit),
- Base, &Quotient, NULL);
- if (ReturnValue > Quotient)
- {
- goto ErrorExit;
- }
-
- ReturnValue *= Base;
- ReturnValue += ThisDigit;
- ++String;
- }
-
- *RetInteger = ReturnValue;
- return_ACPI_STATUS (AE_OK);
-
-
-ErrorExit:
- /* Base was set/validated above */
-
- if (Base == 10)
- {
- return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
- }
- else
- {
- return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
- }
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtStrupr
- *
- * PARAMETERS: SrcString - The source string to convert to
- *
- * RETURN: SrcString
- *
- * DESCRIPTION: Convert string to uppercase
- *
- ******************************************************************************/
-
-char *
-AcpiUtStrupr (
- char *SrcString)
-{
- char *String;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /* Walk entire string, uppercasing the letters */
-
- for (String = SrcString; *String; )
- {
- *String = (char) ACPI_TOUPPER (*String);
- String++;
- }
-
- return (SrcString);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtMutexInitialize
- *
- * PARAMETERS: None.
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create the system mutex objects.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtMutexInitialize (
- void)
-{
- UINT32 i;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("UtMutexInitialize");
-
-
- /*
- * Create each of the predefined mutex objects
- */
- for (i = 0; i < NUM_MUTEX; i++)
- {
- Status = AcpiUtCreateMutex (i);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- Status = AcpiOsCreateLock (&AcpiGbl_GpeLock);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtMutexTerminate
- *
- * PARAMETERS: None.
- *
- * RETURN: None.
- *
- * DESCRIPTION: Delete all of the system mutex objects.
- *
- ******************************************************************************/
-
-void
-AcpiUtMutexTerminate (
- void)
-{
- UINT32 i;
-
-
- ACPI_FUNCTION_TRACE ("UtMutexTerminate");
-
-
- /*
- * Delete each predefined mutex object
- */
- for (i = 0; i < NUM_MUTEX; i++)
- {
- (void) AcpiUtDeleteMutex (i);
- }
-
- AcpiOsDeleteLock (AcpiGbl_GpeLock);
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be created
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtCreateMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE_U32 ("UtCreateMutex", MutexId);
-
-
- if (MutexId > MAX_MUTEX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- if (!AcpiGbl_MutexInfo[MutexId].Mutex)
- {
- Status = AcpiOsCreateSemaphore (1, 1,
- &AcpiGbl_MutexInfo[MutexId].Mutex);
- AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
- AcpiGbl_MutexInfo[MutexId].UseCount = 0;
- }
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be deleted
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtDeleteMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_U32 ("UtDeleteMutex", MutexId);
-
-
- if (MutexId > MAX_MUTEX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- Status = AcpiOsDeleteSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex);
-
- AcpiGbl_MutexInfo[MutexId].Mutex = NULL;
- AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAcquireMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be acquired
- *
- * RETURN: Status
- *
- * DESCRIPTION: Acquire a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtAcquireMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status;
- UINT32 i;
- UINT32 ThisThreadId;
-
-
- ACPI_FUNCTION_NAME ("UtAcquireMutex");
-
-
- if (MutexId > MAX_MUTEX)
- {
- return (AE_BAD_PARAMETER);
- }
-
- ThisThreadId = AcpiOsGetThreadId ();
-
- /*
- * Deadlock prevention. Check if this thread owns any mutexes of value
- * greater than or equal to this one. If so, the thread has violated
- * the mutex ordering rule. This indicates a coding error somewhere in
- * the ACPI subsystem code.
- */
- for (i = MutexId; i < MAX_MUTEX; i++)
- {
- if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
- {
- if (i == MutexId)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] already acquired by this thread [%X]\n",
- AcpiUtGetMutexName (MutexId), ThisThreadId));
-
- return (AE_ALREADY_ACQUIRED);
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid acquire order: Thread %X owns [%s], wants [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (i),
- AcpiUtGetMutexName (MutexId)));
-
- return (AE_ACQUIRE_DEADLOCK);
- }
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
- "Thread %X attempting to acquire Mutex [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId)));
-
- Status = AcpiOsWaitSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex,
- 1, ACPI_WAIT_FOREVER);
- if (ACPI_SUCCESS (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X acquired Mutex [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId)));
-
- AcpiGbl_MutexInfo[MutexId].UseCount++;
- AcpiGbl_MutexInfo[MutexId].OwnerId = ThisThreadId;
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not acquire Mutex [%s] %s\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId),
- AcpiFormatException (Status)));
- }
-
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReleaseMutex
- *
- * PARAMETERS: MutexID - ID of the mutex to be released
- *
- * RETURN: Status
- *
- * DESCRIPTION: Release a mutex object.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtReleaseMutex (
- ACPI_MUTEX_HANDLE MutexId)
-{
- ACPI_STATUS Status;
- UINT32 i;
- UINT32 ThisThreadId;
-
-
- ACPI_FUNCTION_NAME ("UtReleaseMutex");
-
-
- ThisThreadId = AcpiOsGetThreadId ();
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX,
- "Thread %X releasing Mutex [%s]\n", ThisThreadId,
- AcpiUtGetMutexName (MutexId)));
-
- if (MutexId > MAX_MUTEX)
- {
- return (AE_BAD_PARAMETER);
- }
-
- /*
- * Mutex must be acquired in order to release it!
- */
- if (AcpiGbl_MutexInfo[MutexId].OwnerId == ACPI_MUTEX_NOT_ACQUIRED)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Mutex [%s] is not acquired, cannot release\n",
- AcpiUtGetMutexName (MutexId)));
-
- return (AE_NOT_ACQUIRED);
- }
-
- /*
- * Deadlock prevention. Check if this thread owns any mutexes of value
- * greater than this one. If so, the thread has violated the mutex
- * ordering rule. This indicates a coding error somewhere in
- * the ACPI subsystem code.
- */
- for (i = MutexId; i < MAX_MUTEX; i++)
- {
- if (AcpiGbl_MutexInfo[i].OwnerId == ThisThreadId)
- {
- if (i == MutexId)
- {
- continue;
- }
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid release order: owns [%s], releasing [%s]\n",
- AcpiUtGetMutexName (i), AcpiUtGetMutexName (MutexId)));
-
- return (AE_RELEASE_DEADLOCK);
- }
- }
-
- /* Mark unlocked FIRST */
-
- AcpiGbl_MutexInfo[MutexId].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
-
- Status = AcpiOsSignalSemaphore (AcpiGbl_MutexInfo[MutexId].Mutex, 1);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Thread %X could not release Mutex [%s] %s\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId),
- AcpiFormatException (Status)));
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_MUTEX, "Thread %X released Mutex [%s]\n",
- ThisThreadId, AcpiUtGetMutexName (MutexId)));
- }
-
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateUpdateStateAndPush
- *
- * PARAMETERS: *Object - Object to be added to the new state
- * Action - Increment/Decrement
- * StateList - List the state will be added to
- *
- * RETURN: None
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtCreateUpdateStateAndPush (
- ACPI_OPERAND_OBJECT *Object,
- UINT16 Action,
- ACPI_GENERIC_STATE **StateList)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /* Ignore null objects; these are expected */
-
- if (!Object)
- {
- return (AE_OK);
- }
-
- State = AcpiUtCreateUpdateState (Object, Action);
- if (!State)
- {
- return (AE_NO_MEMORY);
- }
-
- AcpiUtPushGenericState (StateList, State);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreatePkgStateAndPush
- *
- * PARAMETERS: *Object - Object to be added to the new state
- * Action - Increment/Decrement
- * StateList - List the state will be added to
- *
- * RETURN: None
- *
- * DESCRIPTION: Create a new state and push it
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtCreatePkgStateAndPush (
- void *InternalObject,
- void *ExternalObject,
- UINT16 Index,
- ACPI_GENERIC_STATE **StateList)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- State = AcpiUtCreatePkgState (InternalObject, ExternalObject, Index);
- if (!State)
- {
- return (AE_NO_MEMORY);
- }
-
- AcpiUtPushGenericState (StateList, State);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtPushGenericState
- *
- * PARAMETERS: ListHead - Head of the state stack
- * State - State object to push
- *
- * RETURN: Status
- *
- * DESCRIPTION: Push a state object onto a state stack
- *
- ******************************************************************************/
-
-void
-AcpiUtPushGenericState (
- ACPI_GENERIC_STATE **ListHead,
- ACPI_GENERIC_STATE *State)
-{
- ACPI_FUNCTION_TRACE ("UtPushGenericState");
-
-
- /* Push the state object onto the front of the list (stack) */
-
- State->Common.Next = *ListHead;
- *ListHead = State;
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtPopGenericState
- *
- * PARAMETERS: ListHead - Head of the state stack
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop a state object from a state stack
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtPopGenericState (
- ACPI_GENERIC_STATE **ListHead)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE ("UtPopGenericState");
-
-
- /* Remove the state object at the head of the list (stack) */
-
- State = *ListHead;
- if (State)
- {
- /* Update the list head */
-
- *ListHead = State->Common.Next;
- }
-
- return_PTR (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateGenericState
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a generic state object. Attempt to obtain one from
- * the global state cache; If none available, create a new one.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtCreateGenericState (void)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- State = AcpiUtAcquireFromCache (ACPI_MEM_LIST_STATE);
-
- /* Initialize */
-
- if (State)
- {
- State->Common.DataType = ACPI_DESC_TYPE_STATE;
+ else
+ {
+ goto AllDone;
+ }
}
- return (State);
-}
+ /*
+ * Perform a 32-bit or 64-bit conversion, depending upon the current
+ * execution mode of the interpreter
+ */
+ Dividend = (Mode32) ? ACPI_UINT32_MAX : ACPI_UINT64_MAX;
+ /* Main loop: convert the string to a 32- or 64-bit integer */
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateThreadState
- *
- * PARAMETERS: None
- *
- * RETURN: Thread State
- *
- * DESCRIPTION: Create a "Thread State" - a flavor of the generic state used
- * to track per-thread info during method execution
- *
- ******************************************************************************/
+ while (*String)
+ {
+ if (ACPI_IS_DIGIT (*String))
+ {
+ /* Convert ASCII 0-9 to Decimal value */
-ACPI_THREAD_STATE *
-AcpiUtCreateThreadState (
- void)
-{
- ACPI_GENERIC_STATE *State;
+ ThisDigit = ((UINT8) *String) - '0';
+ }
+ else if (Base == 10)
+ {
+ /* Digit is out of range; possible in ToInteger case only */
+ Term = 1;
+ }
+ else
+ {
+ ThisDigit = (UINT8) ACPI_TOUPPER (*String);
+ if (ACPI_IS_XDIGIT ((char) ThisDigit))
+ {
+ /* Convert ASCII Hex char to value */
- ACPI_FUNCTION_TRACE ("UtCreateThreadState");
+ ThisDigit = ThisDigit - 'A' + 10;
+ }
+ else
+ {
+ Term = 1;
+ }
+ }
+ if (Term)
+ {
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ break;
+ }
+ }
+ else if ((ValidDigits == 0) && (ThisDigit == 0) && !SignOf0x)
+ {
+ /* Skip zeros */
+ String++;
+ continue;
+ }
- /* Create the generic state object */
+ ValidDigits++;
- State = AcpiUtCreateGenericState ();
- if (!State)
- {
- return_PTR (NULL);
- }
+ if (SignOf0x && ((ValidDigits > 16) || ((ValidDigits > 8) && Mode32)))
+ {
+ /*
+ * This is ToInteger operation case.
+ * No any restrictions for string-to-integer conversion,
+ * see ACPI spec.
+ */
+ goto ErrorExit;
+ }
- /* Init fields specific to the update struct */
+ /* Divide the digit into the correct position */
- State->Common.DataType = ACPI_DESC_TYPE_STATE_THREAD;
- State->Thread.ThreadId = AcpiOsGetThreadId ();
+ (void) AcpiUtShortDivide ((Dividend - (ACPI_INTEGER) ThisDigit),
+ Base, &Quotient, NULL);
- return_PTR ((ACPI_THREAD_STATE *) State);
-}
+ if (ReturnValue > Quotient)
+ {
+ if (ToIntegerOp)
+ {
+ goto ErrorExit;
+ }
+ else
+ {
+ break;
+ }
+ }
+ ReturnValue *= Base;
+ ReturnValue += ThisDigit;
+ String++;
+ }
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateUpdateState
- *
- * PARAMETERS: Object - Initial Object to be installed in the
- * state
- * Action - Update action to be performed
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create an "Update State" - a flavor of the generic state used
- * to update reference counts and delete complex objects such
- * as packages.
- *
- ******************************************************************************/
+ /* All done, normal exit */
-ACPI_GENERIC_STATE *
-AcpiUtCreateUpdateState (
- ACPI_OPERAND_OBJECT *Object,
- UINT16 Action)
-{
- ACPI_GENERIC_STATE *State;
+AllDone:
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ReturnValue)));
- ACPI_FUNCTION_TRACE_PTR ("UtCreateUpdateState", Object);
+ *RetInteger = ReturnValue;
+ return_ACPI_STATUS (AE_OK);
- /* Create the generic state object */
+ErrorExit:
+ /* Base was set/validated above */
- State = AcpiUtCreateGenericState ();
- if (!State)
+ if (Base == 10)
{
- return_PTR (NULL);
+ return_ACPI_STATUS (AE_BAD_DECIMAL_CONSTANT);
+ }
+ else
+ {
+ return_ACPI_STATUS (AE_BAD_HEX_CONSTANT);
}
-
- /* Init fields specific to the update struct */
-
- State->Common.DataType = ACPI_DESC_TYPE_STATE_UPDATE;
- State->Update.Object = Object;
- State->Update.Value = Action;
-
- return_PTR (State);
}
/*******************************************************************************
*
- * FUNCTION: AcpiUtCreatePkgState
+ * FUNCTION: AcpiUtCreateUpdateStateAndPush
*
- * PARAMETERS: Object - Initial Object to be installed in the
- * state
- * Action - Update action to be performed
+ * PARAMETERS: Object - Object to be added to the new state
+ * Action - Increment/Decrement
+ * StateList - List the state will be added to
*
* RETURN: Status
*
- * DESCRIPTION: Create a "Package State"
+ * DESCRIPTION: Create a new state and push it
*
******************************************************************************/
-ACPI_GENERIC_STATE *
-AcpiUtCreatePkgState (
- void *InternalObject,
- void *ExternalObject,
- UINT16 Index)
+ACPI_STATUS
+AcpiUtCreateUpdateStateAndPush (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT16 Action,
+ ACPI_GENERIC_STATE **StateList)
{
- ACPI_GENERIC_STATE *State;
+ ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE_PTR ("UtCreatePkgState", InternalObject);
+ ACPI_FUNCTION_ENTRY ();
- /* Create the generic state object */
+ /* Ignore null objects; these are expected */
- State = AcpiUtCreateGenericState ();
- if (!State)
+ if (!Object)
{
- return_PTR (NULL);
+ return (AE_OK);
}
- /* Init fields specific to the update struct */
-
- State->Common.DataType = ACPI_DESC_TYPE_STATE_PACKAGE;
- State->Pkg.SourceObject = (ACPI_OPERAND_OBJECT *) InternalObject;
- State->Pkg.DestObject = ExternalObject;
- State->Pkg.Index = Index;
- State->Pkg.NumPackages = 1;
-
- return_PTR (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCreateControlState
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Create a "Control State" - a flavor of the generic state used
- * to support nested IF/WHILE constructs in the AML.
- *
- ******************************************************************************/
-
-ACPI_GENERIC_STATE *
-AcpiUtCreateControlState (
- void)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE ("UtCreateControlState");
-
-
- /* Create the generic state object */
-
- State = AcpiUtCreateGenericState ();
+ State = AcpiUtCreateUpdateState (Object, Action);
if (!State)
{
- return_PTR (NULL);
+ return (AE_NO_MEMORY);
}
- /* Init fields specific to the control struct */
-
- State->Common.DataType = ACPI_DESC_TYPE_STATE_CONTROL;
- State->Common.State = ACPI_CONTROL_CONDITIONAL_EXECUTING;
-
- return_PTR (State);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteGenericState
- *
- * PARAMETERS: State - The state object to be deleted
- *
- * RETURN: Status
- *
- * DESCRIPTION: Put a state object back into the global state cache. The object
- * is not actually freed at this time.
- *
- ******************************************************************************/
-
-void
-AcpiUtDeleteGenericState (
- ACPI_GENERIC_STATE *State)
-{
- ACPI_FUNCTION_TRACE ("UtDeleteGenericState");
-
-
- AcpiUtReleaseToCache (ACPI_MEM_LIST_STATE, State);
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteGenericStateCache
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-AcpiUtDeleteGenericStateCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("UtDeleteGenericStateCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_STATE);
- return_VOID;
+ AcpiUtPushGenericState (StateList, State);
+ return (AE_OK);
}
@@ -1348,7 +1095,10 @@
*
* FUNCTION: AcpiUtWalkPackageTree
*
- * PARAMETERS: ObjDesc - The Package object on which to resolve refs
+ * PARAMETERS: SourceObject - The package to walk
+ * TargetObject - Target object (if package is being copied)
+ * WalkCallback - Called once for each package element
+ * Context - Passed to the callback function
*
* RETURN: Status
*
@@ -1370,7 +1120,7 @@
ACPI_OPERAND_OBJECT *ThisSourceObj;
- ACPI_FUNCTION_TRACE ("UtWalkPackageTree");
+ ACPI_FUNCTION_TRACE (UtWalkPackageTree);
State = AcpiUtCreatePkgState (SourceObject, TargetObject, 0);
@@ -1471,168 +1221,94 @@
/*******************************************************************************
*
- * FUNCTION: AcpiUtGenerateChecksum
+ * FUNCTION: AcpiUtError, AcpiUtWarning, AcpiUtInfo
*
- * PARAMETERS: Buffer - Buffer to be scanned
- * Length - number of bytes to examine
+ * PARAMETERS: ModuleName - Caller's module name (for error output)
+ * LineNumber - Caller's line number (for error output)
+ * Format - Printf format string + additional args
*
- * RETURN: checksum
+ * RETURN: None
*
- * DESCRIPTION: Generate a checksum on a raw buffer
+ * DESCRIPTION: Print message with module/line/version info
*
******************************************************************************/
-UINT8
-AcpiUtGenerateChecksum (
- UINT8 *Buffer,
- UINT32 Length)
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtError (
+ char *ModuleName,
+ UINT32 LineNumber,
+ char *Format,
+ ...)
{
- UINT32 i;
- signed char Sum = 0;
+ va_list args;
- for (i = 0; i < Length; i++)
- {
- Sum = (signed char) (Sum + Buffer[i]);
- }
+ AcpiOsPrintf ("ACPI Error (%s-%04d): ", ModuleName, LineNumber);
- return ((UINT8) (0 - Sum));
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtGetResourceEndTag
- *
- * PARAMETERS: ObjDesc - The resource template buffer object
- *
- * RETURN: Pointer to the end tag
- *
- * DESCRIPTION: Find the END_TAG resource descriptor in a resource template
- *
- ******************************************************************************/
-
-
-UINT8 *
-AcpiUtGetResourceEndTag (
- ACPI_OPERAND_OBJECT *ObjDesc)
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtException (
+ char *ModuleName,
+ UINT32 LineNumber,
+ ACPI_STATUS Status,
+ char *Format,
+ ...)
{
- UINT8 BufferByte;
- UINT8 *Buffer;
- UINT8 *EndBuffer;
-
-
- Buffer = ObjDesc->Buffer.Pointer;
- EndBuffer = Buffer + ObjDesc->Buffer.Length;
+ va_list args;
- while (Buffer < EndBuffer)
- {
- BufferByte = *Buffer;
- if (BufferByte & ACPI_RDESC_TYPE_MASK)
- {
- /* Large Descriptor - Length is next 2 bytes */
-
- Buffer += ((*(Buffer+1) | (*(Buffer+2) << 8)) + 3);
- }
- else
- {
- /* Small Descriptor. End Tag will be found here */
-
- if ((BufferByte & ACPI_RDESC_SMALL_MASK) == ACPI_RDESC_TYPE_END_TAG)
- {
- /* Found the end tag descriptor, all done. */
- return (Buffer);
- }
-
- /* Length is in the header */
-
- Buffer += ((BufferByte & 0x07) + 1);
- }
- }
-
- /* End tag not found */
+ AcpiOsPrintf ("ACPI Exception (%s-%04d): %s, ", ModuleName, LineNumber,
+ AcpiFormatException (Status));
- return (NULL);
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReportError
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- * Message - Error message to use on failure
- *
- * RETURN: None
- *
- * DESCRIPTION: Print error message
- *
- ******************************************************************************/
-
-void
-AcpiUtReportError (
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtWarning (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId)
+ char *Format,
+ ...)
{
+ va_list args;
- AcpiOsPrintf ("%8s-%04d: *** Error: ", ModuleName, LineNumber);
-}
-
+ AcpiOsPrintf ("ACPI Warning (%s-%04d): ", ModuleName, LineNumber);
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReportWarning
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- * Message - Error message to use on failure
- *
- * RETURN: None
- *
- * DESCRIPTION: Print warning message
- *
- ******************************************************************************/
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf (" [%X]\n", ACPI_CA_VERSION);
+}
-void
-AcpiUtReportWarning (
+void ACPI_INTERNAL_VAR_XFACE
+AcpiUtInfo (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId)
+ char *Format,
+ ...)
{
+ va_list args;
- AcpiOsPrintf ("%8s-%04d: *** Warning: ", ModuleName, LineNumber);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtReportInfo
- *
- * PARAMETERS: ModuleName - Caller's module name (for error output)
- * LineNumber - Caller's line number (for error output)
- * ComponentId - Caller's component ID (for error output)
- * Message - Error message to use on failure
- *
- * RETURN: None
- *
- * DESCRIPTION: Print information message
- *
- ******************************************************************************/
+#ifdef _KERNEL
+ /* Temporarily hide too verbose printfs. */
+ if (!bootverbose)
+ return;
+#endif
-void
-AcpiUtReportInfo (
- char *ModuleName,
- UINT32 LineNumber,
- UINT32 ComponentId)
-{
+ /*
+ * Removed ModuleName, LineNumber, and acpica version, not needed
+ * for info output
+ */
+ AcpiOsPrintf ("ACPI: ");
- AcpiOsPrintf ("%8s-%04d: *** Info: ", ModuleName, LineNumber);
+ va_start (args, Format);
+ AcpiOsVprintf (Format, args);
+ AcpiOsPrintf ("\n");
}
-
Index: acinterp.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acinterp.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acinterp.h -L sys/contrib/dev/acpica/acinterp.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acinterp.h
+++ sys/contrib/dev/acpica/acinterp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acinterp.h - Interpreter subcomponent prototypes and defines
- * $Revision: 155 $
+ * $Revision: 1.171 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,40 +118,59 @@
#define __ACINTERP_H__
-#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
+#define ACPI_WALK_OPERANDS (&(WalkState->Operands [WalkState->NumOperands -1]))
+/* Macros for tables used for debug output */
-ACPI_STATUS
-AcpiExResolveOperands (
- UINT16 Opcode,
- ACPI_OPERAND_OBJECT **StackPtr,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiExCheckObjectType (
- ACPI_OBJECT_TYPE TypeNeeded,
- ACPI_OBJECT_TYPE ThisType,
- void *Object);
-
-/*
- * exxface - External interpreter interfaces
- */
+#define ACPI_EXD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_OPERAND_OBJECT,f)
+#define ACPI_EXD_NSOFFSET(f) (UINT8) ACPI_OFFSET (ACPI_NAMESPACE_NODE,f)
+#define ACPI_EXD_TABLE_SIZE(name) (sizeof(name) / sizeof (ACPI_EXDUMP_INFO))
+
+/*
+ * If possible, pack the following structures to byte alignment, since we
+ * don't care about performance for debug output. Two cases where we cannot
+ * pack the structures:
+ *
+ * 1) Hardware does not support misaligned memory transfers
+ * 2) Compiler does not support pointers within packed structures
+ */
+#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
+#pragma pack(1)
+#endif
+
+typedef const struct acpi_exdump_info
+{
+ UINT8 Opcode;
+ UINT8 Offset;
+ char *Name;
+
+} ACPI_EXDUMP_INFO;
+
+/* Values for the Opcode field above */
+
+#define ACPI_EXD_INIT 0
+#define ACPI_EXD_TYPE 1
+#define ACPI_EXD_UINT8 2
+#define ACPI_EXD_UINT16 3
+#define ACPI_EXD_UINT32 4
+#define ACPI_EXD_UINT64 5
+#define ACPI_EXD_LITERAL 6
+#define ACPI_EXD_POINTER 7
+#define ACPI_EXD_ADDRESS 8
+#define ACPI_EXD_STRING 9
+#define ACPI_EXD_BUFFER 10
+#define ACPI_EXD_PACKAGE 11
+#define ACPI_EXD_FIELD 12
+#define ACPI_EXD_REFERENCE 13
-ACPI_STATUS
-AcpiExLoadTable (
- ACPI_TABLE_TYPE TableId);
+/* restore default alignment */
-ACPI_STATUS
-AcpiExExecuteMethod (
- ACPI_NAMESPACE_NODE *MethodNode,
- ACPI_OPERAND_OBJECT **Params,
- ACPI_OPERAND_OBJECT **ReturnObjDesc);
+#pragma pack()
/*
* exconvrt - object conversion
*/
-
ACPI_STATUS
AcpiExConvertToInteger (
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -183,17 +202,10 @@
ACPI_OPERAND_OBJECT **ResultDesc,
ACPI_WALK_STATE *WalkState);
-UINT32
-AcpiExConvertToAscii (
- ACPI_INTEGER Integer,
- UINT16 Base,
- UINT8 *String,
- UINT8 MaxLength);
/*
* exfield - ACPI AML (p-code) execution - field manipulation
*/
-
ACPI_STATUS
AcpiExCommonBufferSetup (
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -201,42 +213,6 @@
UINT32 *DatumCount);
ACPI_STATUS
-AcpiExExtractFromField (
- ACPI_OPERAND_OBJECT *ObjDesc,
- void *Buffer,
- UINT32 BufferLength);
-
-ACPI_STATUS
-AcpiExInsertIntoField (
- ACPI_OPERAND_OBJECT *ObjDesc,
- void *Buffer,
- UINT32 BufferLength);
-
-ACPI_STATUS
-AcpiExSetupRegion (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 FieldDatumByteOffset);
-
-ACPI_STATUS
-AcpiExAccessRegion (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 FieldDatumByteOffset,
- ACPI_INTEGER *Value,
- UINT32 ReadWrite);
-
-BOOLEAN
-AcpiExRegisterOverflow (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_INTEGER Value);
-
-ACPI_STATUS
-AcpiExFieldDatumIo (
- ACPI_OPERAND_OBJECT *ObjDesc,
- UINT32 FieldDatumByteOffset,
- ACPI_INTEGER *Value,
- UINT32 ReadWrite);
-
-ACPI_STATUS
AcpiExWriteWithUpdateRule (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_INTEGER Mask,
@@ -271,28 +247,33 @@
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT **ResultDesc);
+
/*
- * exmisc - ACPI AML (p-code) execution - specific opcodes
+ * exfldio - low level field I/O
*/
-
ACPI_STATUS
-AcpiExOpcode_3A_0T_0R (
- ACPI_WALK_STATE *WalkState);
+AcpiExExtractFromField (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ void *Buffer,
+ UINT32 BufferLength);
ACPI_STATUS
-AcpiExOpcode_3A_1T_1R (
- ACPI_WALK_STATE *WalkState);
+AcpiExInsertIntoField (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ void *Buffer,
+ UINT32 BufferLength);
ACPI_STATUS
-AcpiExOpcode_6A_0T_1R (
- ACPI_WALK_STATE *WalkState);
+AcpiExAccessRegion (
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ UINT32 FieldDatumByteOffset,
+ ACPI_INTEGER *Value,
+ UINT32 ReadWrite);
-BOOLEAN
-AcpiExDoMatch (
- UINT32 MatchOp,
- ACPI_INTEGER PackageValue,
- ACPI_INTEGER MatchValue);
+/*
+ * exmisc - misc support routines
+ */
ACPI_STATUS
AcpiExGetObjectReference (
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -300,13 +281,6 @@
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
-AcpiExResolveMultiple (
- ACPI_WALK_STATE *WalkState,
- ACPI_OPERAND_OBJECT *Operand,
- ACPI_OBJECT_TYPE *ReturnType,
- ACPI_OPERAND_OBJECT **ReturnDesc);
-
-ACPI_STATUS
AcpiExConcatTemplate (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_OPERAND_OBJECT *ObjDesc2,
@@ -381,13 +355,6 @@
/*
* exconfig - dynamic table load/unload
*/
-
-ACPI_STATUS
-AcpiExAddTable (
- ACPI_TABLE_HEADER *Table,
- ACPI_NAMESPACE_NODE *ParentNode,
- ACPI_OPERAND_OBJECT **DdbHandle);
-
ACPI_STATUS
AcpiExLoadOp (
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -407,7 +374,6 @@
/*
* exmutex - mutex support
*/
-
ACPI_STATUS
AcpiExAcquireMutex (
ACPI_OPERAND_OBJECT *TimeDesc,
@@ -415,10 +381,20 @@
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
+AcpiExAcquireMutexObject (
+ UINT16 Timeout,
+ ACPI_OPERAND_OBJECT *ObjDesc,
+ ACPI_THREAD_ID ThreadId);
+
+ACPI_STATUS
AcpiExReleaseMutex (
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState);
+ACPI_STATUS
+AcpiExReleaseMutexObject (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
void
AcpiExReleaseAllMutexes (
ACPI_THREAD_STATE *Thread);
@@ -427,15 +403,10 @@
AcpiExUnlinkMutex (
ACPI_OPERAND_OBJECT *ObjDesc);
-void
-AcpiExLinkMutex (
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_THREAD_STATE *Thread);
/*
- * exprep - ACPI AML (p-code) execution - prep utilities
+ * exprep - ACPI AML execution - prep utilities
*/
-
ACPI_STATUS
AcpiExPrepCommonFieldObject (
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -448,10 +419,10 @@
AcpiExPrepFieldValue (
ACPI_CREATE_FIELD_INFO *Info);
+
/*
* exsystem - Interface to OS services
*/
-
ACPI_STATUS
AcpiExSystemDoNotifyOp (
ACPI_OPERAND_OBJECT *Value,
@@ -466,15 +437,6 @@
UINT32 Time);
ACPI_STATUS
-AcpiExSystemAcquireMutex(
- ACPI_OPERAND_OBJECT *Time,
- ACPI_OPERAND_OBJECT *ObjDesc);
-
-ACPI_STATUS
-AcpiExSystemReleaseMutex(
- ACPI_OPERAND_OBJECT *ObjDesc);
-
-ACPI_STATUS
AcpiExSystemSignalEvent(
ACPI_OPERAND_OBJECT *ObjDesc);
@@ -489,14 +451,17 @@
ACPI_STATUS
AcpiExSystemWaitSemaphore (
- ACPI_HANDLE Semaphore,
+ ACPI_SEMAPHORE Semaphore,
UINT16 Timeout);
+ACPI_STATUS
+AcpiExSystemWaitMutex (
+ ACPI_MUTEX Mutex,
+ UINT16 Timeout);
/*
- * exmonadic - ACPI AML (p-code) execution, monadic operators
+ * exoparg1 - ACPI AML execution, 1 operand
*/
-
ACPI_STATUS
AcpiExOpcode_0A_0T_1R (
ACPI_WALK_STATE *WalkState);
@@ -518,9 +483,8 @@
ACPI_WALK_STATE *WalkState);
/*
- * exdyadic - ACPI AML (p-code) execution, dyadic operators
+ * exoparg2 - ACPI AML execution, 2 operands
*/
-
ACPI_STATUS
AcpiExOpcode_2A_0T_0R (
ACPI_WALK_STATE *WalkState);
@@ -539,21 +503,56 @@
/*
- * exresolv - Object resolution and get value functions
+ * exoparg3 - ACPI AML execution, 3 operands
*/
+ACPI_STATUS
+AcpiExOpcode_3A_0T_0R (
+ ACPI_WALK_STATE *WalkState);
ACPI_STATUS
+AcpiExOpcode_3A_1T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * exoparg6 - ACPI AML execution, 6 operands
+ */
+ACPI_STATUS
+AcpiExOpcode_6A_0T_1R (
+ ACPI_WALK_STATE *WalkState);
+
+
+/*
+ * exresolv - Object resolution and get value functions
+ */
+ACPI_STATUS
AcpiExResolveToValue (
ACPI_OPERAND_OBJECT **StackPtr,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
+AcpiExResolveMultiple (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_OPERAND_OBJECT *Operand,
+ ACPI_OBJECT_TYPE *ReturnType,
+ ACPI_OPERAND_OBJECT **ReturnDesc);
+
+
+/*
+ * exresnte - resolve namespace node
+ */
+ACPI_STATUS
AcpiExResolveNodeToValue (
ACPI_NAMESPACE_NODE **StackPtr,
ACPI_WALK_STATE *WalkState);
+
+/*
+ * exresop - resolve operand to value
+ */
ACPI_STATUS
-AcpiExResolveObjectToValue (
+AcpiExResolveOperands (
+ UINT16 Opcode,
ACPI_OPERAND_OBJECT **StackPtr,
ACPI_WALK_STATE *WalkState);
@@ -561,7 +560,6 @@
/*
* exdump - Interpreter debug output routines
*/
-
void
AcpiExDumpOperand (
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -583,49 +581,14 @@
UINT32 Flags);
void
-AcpiExDumpNode (
+AcpiExDumpNamespaceNode (
ACPI_NAMESPACE_NODE *Node,
UINT32 Flags);
-void
-AcpiExOutString (
- char *Title,
- char *Value);
-
-void
-AcpiExOutPointer (
- char *Title,
- void *Value);
-
-void
-AcpiExOutInteger (
- char *Title,
- UINT32 Value);
-
-void
-AcpiExOutAddress (
- char *Title,
- ACPI_PHYSICAL_ADDRESS Value);
-
/*
- * exnames - interpreter/scanner name load/execute
+ * exnames - AML namestring support
*/
-
-char *
-AcpiExAllocateNameString (
- UINT32 PrefixCount,
- UINT32 NumNameSegs);
-
-UINT32
-AcpiExGoodChar (
- UINT32 Character);
-
-ACPI_STATUS
-AcpiExNameSegment (
- UINT8 **InAmlAddress,
- char *NameString);
-
ACPI_STATUS
AcpiExGetNameString (
ACPI_OBJECT_TYPE DataType,
@@ -633,16 +596,10 @@
char **OutNameString,
UINT32 *OutNameLength);
-ACPI_STATUS
-AcpiExDoName (
- ACPI_OBJECT_TYPE DataType,
- ACPI_INTERPRETER_MODE LoadExecMode);
-
/*
* exstore - Object store support
*/
-
ACPI_STATUS
AcpiExStore (
ACPI_OPERAND_OBJECT *ValDesc,
@@ -650,12 +607,6 @@
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
-AcpiExStoreObjectToIndex (
- ACPI_OPERAND_OBJECT *ValDesc,
- ACPI_OPERAND_OBJECT *DestDesc,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
AcpiExStoreObjectToNode (
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_NAMESPACE_NODE *Node,
@@ -665,10 +616,10 @@
#define ACPI_IMPLICIT_CONVERSION TRUE
#define ACPI_NO_IMPLICIT_CONVERSION FALSE
+
/*
- * exstoren
+ * exstoren - resolve/store object
*/
-
ACPI_STATUS
AcpiExResolveObject (
ACPI_OPERAND_OBJECT **SourceDescPtr,
@@ -684,9 +635,8 @@
/*
- * excopy - object copy
+ * exstorob - store object - buffer/string
*/
-
ACPI_STATUS
AcpiExStoreBufferToBuffer (
ACPI_OPERAND_OBJECT *SourceDesc,
@@ -697,6 +647,10 @@
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
+
+/*
+ * excopy - object copy
+ */
ACPI_STATUS
AcpiExCopyIntegerToIndexField (
ACPI_OPERAND_OBJECT *SourceDesc,
@@ -717,11 +671,11 @@
ACPI_OPERAND_OBJECT *SourceDesc,
ACPI_OPERAND_OBJECT *TargetDesc);
+
/*
* exutils - interpreter/scanner utilities
*/
-
-ACPI_STATUS
+void
AcpiExEnterInterpreter (
void);
@@ -730,21 +684,24 @@
void);
void
+AcpiExReacquireInterpreter (
+ void);
+
+void
+AcpiExRelinquishInterpreter (
+ void);
+
+void
AcpiExTruncateFor32bitTable (
ACPI_OPERAND_OBJECT *ObjDesc);
-BOOLEAN
+void
AcpiExAcquireGlobalLock (
UINT32 Rule);
void
AcpiExReleaseGlobalLock (
- BOOLEAN Locked);
-
-UINT32
-AcpiExDigitsNeeded (
- ACPI_INTEGER Value,
- UINT32 Base);
+ UINT32 Rule);
void
AcpiExEisaIdToString (
@@ -760,7 +717,6 @@
/*
* exregion - default OpRegion handlers
*/
-
ACPI_STATUS
AcpiExSystemMemorySpaceHandler (
UINT32 Function,
Index: exresnte.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exresnte.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exresnte.c -L sys/contrib/dev/acpica/exresnte.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exresnte.c
+++ sys/contrib/dev/acpica/exresnte.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresnte - AML Interpreter object resolution
- * $Revision: 65 $
+ * $Revision: 1.75 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -168,7 +168,7 @@
ACPI_OBJECT_TYPE EntryType;
- ACPI_FUNCTION_TRACE ("ExResolveNodeToValue");
+ ACPI_FUNCTION_TRACE (ExResolveNodeToValue);
/*
@@ -195,10 +195,11 @@
/*
* Several object types require no further processing:
- * 1) Devices rarely have an attached object, return the Node
+ * 1) Device/Thermal objects don't have a "real" subobject, return the Node
* 2) Method locals and arguments have a pseudo-Node
*/
- if (EntryType == ACPI_TYPE_DEVICE ||
+ if ((EntryType == ACPI_TYPE_DEVICE) ||
+ (EntryType == ACPI_TYPE_THERMAL) ||
(Node->Flags & (ANOBJ_METHOD_ARG | ANOBJ_METHOD_LOCAL)))
{
return_ACPI_STATUS (AE_OK);
@@ -206,7 +207,7 @@
if (!SourceDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No object attached to node %p\n",
+ ACPI_ERROR ((AE_INFO, "No object attached to node %p",
Node));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
@@ -221,7 +222,7 @@
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_PACKAGE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Package, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a Package, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -241,7 +242,7 @@
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Buffer, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a Buffer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -261,7 +262,7 @@
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a String, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a String, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -277,7 +278,7 @@
if (ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Object not a Integer, type %s\n",
+ ACPI_ERROR ((AE_INFO, "Object not a Integer, type %s",
AcpiUtGetObjectTypeName (SourceDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -294,20 +295,19 @@
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "FieldRead Node=%p SourceDesc=%p Type=%X\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "FieldRead Node=%p SourceDesc=%p Type=%X\n",
Node, SourceDesc, EntryType));
Status = AcpiExReadDataFromField (WalkState, SourceDesc, &ObjDesc);
break;
- /*
- * For these objects, just return the object attached to the Node
- */
+ /* For these objects, just return the object attached to the Node */
+
case ACPI_TYPE_MUTEX:
case ACPI_TYPE_METHOD:
case ACPI_TYPE_POWER:
case ACPI_TYPE_PROCESSOR:
- case ACPI_TYPE_THERMAL:
case ACPI_TYPE_EVENT:
case ACPI_TYPE_REGION:
@@ -317,13 +317,12 @@
AcpiUtAddReference (ObjDesc);
break;
-
/* TYPE_ANY is untyped, and thus there is no object associated with it */
case ACPI_TYPE_ANY:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Untyped entry %p, no attached object!\n",
- Node));
+ ACPI_ERROR ((AE_INFO,
+ "Untyped entry %p, no attached object!", Node));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE); /* Cannot be AE_TYPE */
@@ -337,6 +336,8 @@
/* This is a DdbHandle */
/* Return an additional reference to the object */
+ case AML_REF_OF_OP:
+
ObjDesc = SourceDesc;
AcpiUtAddReference (ObjDesc);
break;
@@ -344,7 +345,8 @@
default:
/* No named references are allowed here */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unsupported Reference opcode %X (%s)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unsupported Reference opcode %X (%s)",
SourceDesc->Reference.Opcode,
AcpiPsGetOpcodeName (SourceDesc->Reference.Opcode)));
@@ -353,11 +355,12 @@
break;
- /* Default case is for unknown types */
-
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Node %p - Unknown object type %X\n",
+ /* Default case is for unknown types */
+
+ ACPI_ERROR ((AE_INFO,
+ "Node %p - Unknown object type %X",
Node, EntryType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -365,7 +368,7 @@
} /* switch (EntryType) */
- /* Put the object descriptor on the stack */
+ /* Return the object descriptor */
*ObjectPtr = (void *) ObjDesc;
return_ACPI_STATUS (Status);
Index: psparse.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/psparse.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/psparse.c -L sys/contrib/dev/acpica/psparse.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/psparse.c
+++ sys/contrib/dev/acpica/psparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psparse - Parser top level AML parse routines
- * $Revision: 146 $
+ * $Revision: 1.171 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -135,9 +135,6 @@
ACPI_MODULE_NAME ("psparse")
-static UINT32 AcpiGbl_Depth = 0;
-
-
/*******************************************************************************
*
* FUNCTION: AcpiPsGetOpcodeSize
@@ -174,7 +171,7 @@
*
* PARAMETERS: ParserState - A parser state object
*
- * RETURN: Status
+ * RETURN: Next AML opcode
*
* DESCRIPTION: Get next AML opcode (without incrementing AML pointer)
*
@@ -191,10 +188,9 @@
Aml = ParserState->Aml;
Opcode = (UINT16) ACPI_GET8 (Aml);
-
- if (Opcode == AML_EXTOP)
+ if (Opcode == AML_EXTENDED_OP_PREFIX)
{
- /* Extended opcode */
+ /* Extended opcode, get the second opcode byte */
Aml++;
Opcode = (UINT16) ((Opcode << 8) | ACPI_GET8 (Aml));
@@ -211,13 +207,13 @@
* PARAMETERS: WalkState - Current State
* Op - Op to complete
*
- * RETURN: None.
+ * RETURN: Status
*
* DESCRIPTION: Perform any cleanup at the completion of an Op.
*
******************************************************************************/
-void
+ACPI_STATUS
AcpiPsCompleteThisOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op)
@@ -228,14 +224,14 @@
ACPI_PARSE_OBJECT *ReplacementOp = NULL;
- ACPI_FUNCTION_TRACE_PTR ("PsCompleteThisOp", Op);
+ ACPI_FUNCTION_TRACE_PTR (PsCompleteThisOp, Op);
/* Check for null Op, can happen if AML code is corrupt */
if (!Op)
{
- return_VOID;
+ return_ACPI_STATUS (AE_OK); /* OK for now */
}
/* Delete this op and the subtree below it if asked to */
@@ -243,18 +239,26 @@
if (((WalkState->ParseFlags & ACPI_PARSE_TREE_MASK) != ACPI_PARSE_DELETE_TREE) ||
(WalkState->OpInfo->Class == AML_CLASS_ARGUMENT))
{
- return_VOID;
+ return_ACPI_STATUS (AE_OK);
}
/* Make sure that we only delete this subtree */
if (Op->Common.Parent)
{
+ Prev = Op->Common.Parent->Common.Value.Arg;
+ if (!Prev)
+ {
+ /* Nothing more to do */
+
+ goto Cleanup;
+ }
+
/*
* Check if we need to replace the operator and its subtree
* with a return value op (placeholder op)
*/
- ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
+ ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
switch (ParentInfo->Class)
{
@@ -270,7 +274,7 @@
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
break;
@@ -289,13 +293,11 @@
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
}
-
- if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
- (WalkState->DescendingCallback != AcpiDsExecBeginOp))
-
+ else if ((Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
+ (WalkState->PassNumber <= ACPI_IMODE_LOAD_PASS2))
{
if ((Op->Common.AmlOpcode == AML_BUFFER_OP) ||
(Op->Common.AmlOpcode == AML_PACKAGE_OP) ||
@@ -304,7 +306,7 @@
ReplacementOp = AcpiPsAllocOp (Op->Common.AmlOpcode);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
ReplacementOp->Named.Data = Op->Named.Data;
@@ -314,16 +316,16 @@
break;
default:
+
ReplacementOp = AcpiPsAllocOp (AML_INT_RETURN_VALUE_OP);
if (!ReplacementOp)
{
- goto Cleanup;
+ goto AllocateError;
}
}
/* We must unlink this op from the parent tree */
- Prev = Op->Common.Parent->Common.Value.Arg;
if (Prev == Op)
{
/* This op is the first in the list */
@@ -366,7 +368,6 @@
Next = NULL;
}
}
-
Prev = Next;
}
}
@@ -374,10 +375,18 @@
Cleanup:
- /* Now we can actually delete the subtree rooted at op */
+ /* Now we can actually delete the subtree rooted at Op */
+
+ AcpiPsDeleteParseTree (Op);
+ return_ACPI_STATUS (AE_OK);
+
+
+AllocateError:
+
+ /* Always delete the subtree, even on error */
AcpiPsDeleteParseTree (Op);
- return_VOID;
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
@@ -385,7 +394,9 @@
*
* FUNCTION: AcpiPsNextParseState
*
- * PARAMETERS: ParserState - Current parser state object
+ * PARAMETERS: WalkState - Current state
+ * Op - Current parse op
+ * CallbackStatus - Status from previous operation
*
* RETURN: Status
*
@@ -404,13 +415,12 @@
ACPI_STATUS Status = AE_CTRL_PENDING;
- ACPI_FUNCTION_TRACE_PTR ("PsNextParseState", Op);
+ ACPI_FUNCTION_TRACE_PTR (PsNextParseState, Op);
switch (CallbackStatus)
{
case AE_CTRL_TERMINATE:
-
/*
* A control method was terminated via a RETURN statement.
* The walk of this method is complete.
@@ -427,13 +437,14 @@
Status = AE_CTRL_BREAK;
break;
- case AE_CTRL_CONTINUE:
+ case AE_CTRL_CONTINUE:
ParserState->Aml = WalkState->AmlLastWhile;
Status = AE_CTRL_CONTINUE;
break;
+
case AE_CTRL_PENDING:
ParserState->Aml = WalkState->AmlLastWhile;
@@ -448,17 +459,16 @@
#endif
case AE_CTRL_TRUE:
-
/*
* Predicate of an IF was true, and we are at the matching ELSE.
* Just close out this package
*/
ParserState->Aml = AcpiPsGetNextPackageEnd (ParserState);
+ Status = AE_CTRL_PENDING;
break;
case AE_CTRL_FALSE:
-
/*
* Either an IF/WHILE Predicate was false or we encountered a BREAK
* opcode. In both cases, we do not execute the rest of the
@@ -477,9 +487,8 @@
case AE_CTRL_TRANSFER:
- /*
- * A method call (invocation) -- transfer control
- */
+ /* A method call (invocation) -- transfer control */
+
Status = AE_CTRL_TRANSFER;
WalkState->PrevOp = Op;
WalkState->MethodCallOp = Op;
@@ -492,6 +501,7 @@
default:
+
Status = CallbackStatus;
if ((CallbackStatus & AE_CODE_MASK) == AE_CODE_CONTROL)
{
@@ -506,715 +516,9 @@
/*******************************************************************************
*
- * FUNCTION: AcpiPsParseLoop
- *
- * PARAMETERS: ParserState - Current parser state object
- *
- * RETURN: Status
- *
- * DESCRIPTION: Parse AML (pointed to by the current parser state) and return
- * a tree of ops.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiPsParseLoop (
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status = AE_OK;
- ACPI_PARSE_OBJECT *Op = NULL; /* current op */
- ACPI_PARSE_OBJECT *Arg = NULL;
- ACPI_PARSE_OBJECT *PreOp = NULL;
- ACPI_PARSE_STATE *ParserState;
- UINT8 *AmlOpStart = NULL;
-
-
- ACPI_FUNCTION_TRACE_PTR ("PsParseLoop", WalkState);
-
- if (WalkState->DescendingCallback == NULL)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- ParserState = &WalkState->ParserState;
- WalkState->ArgTypes = 0;
-
-#if (!defined (ACPI_NO_METHOD_EXECUTION) && !defined (ACPI_CONSTANT_EVAL_ONLY))
- if (WalkState->WalkType & ACPI_WALK_METHOD_RESTART)
- {
- /* We are restarting a preempted control method */
-
- if (AcpiPsHasCompletedScope (ParserState))
- {
- /*
- * We must check if a predicate to an IF or WHILE statement
- * was just completed
- */
- if ((ParserState->Scope->ParseScope.Op) &&
- ((ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_IF_OP) ||
- (ParserState->Scope->ParseScope.Op->Common.AmlOpcode == AML_WHILE_OP)) &&
- (WalkState->ControlState) &&
- (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
- */
- WalkState->Op = NULL;
- Status = AcpiDsGetPredicateValue (WalkState, ACPI_TO_POINTER (TRUE));
- if (ACPI_FAILURE (Status) &&
- ((Status & AE_CODE_MASK) != AE_CODE_CONTROL))
- {
- if (Status == AE_AML_NO_RETURN_VALUE)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invoked method did not return a value, %s\n",
- AcpiFormatException (Status)));
-
- }
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "GetPredicate Failed, %s\n",
- AcpiFormatException (Status)));
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- }
-
- 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 */
-
- Op = WalkState->PrevOp;
- WalkState->ArgTypes = WalkState->PrevArgTypes;
- }
- }
-#endif
-
- /*
- * Iterative parsing loop, while there is more aml to process:
- */
- while ((ParserState->Aml < ParserState->AmlEnd) || (Op))
- {
- AmlOpStart = ParserState->Aml;
- if (!Op)
- {
- /* Get the next opcode from the AML stream */
-
- WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml,
- ParserState->AmlStart);
- WalkState->Opcode = AcpiPsPeekOpcode (ParserState);
-
- /*
- * First cut to determine what we have found:
- * 1) A valid AML opcode
- * 2) A name string
- * 3) An unknown/invalid opcode
- */
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
- switch (WalkState->OpInfo->Class)
- {
- case AML_CLASS_ASCII:
- case AML_CLASS_PREFIX:
- /*
- * Starts with a valid prefix or ASCII char, this is a name
- * string. Convert the bare name string to a namepath.
- */
- WalkState->Opcode = AML_INT_NAMEPATH_OP;
- WalkState->ArgTypes = ARGP_NAMESTRING;
- break;
-
- case AML_CLASS_UNKNOWN:
-
- /* The opcode is unrecognized. Just skip unknown opcodes */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Found unknown opcode %X at AML address %p offset %X, ignoring\n",
- WalkState->Opcode, ParserState->Aml, WalkState->AmlOffset));
-
- ACPI_DUMP_BUFFER (ParserState->Aml, 128);
-
- /* Assume one-byte bad opcode */
-
- ParserState->Aml++;
- continue;
-
- default:
-
- /* Found opcode info, this is a normal opcode */
-
- 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)
- {
- /* Allocate a new PreOp if necessary */
-
- if (!PreOp)
- {
- PreOp = AcpiPsAllocOp (WalkState->Opcode);
- if (!PreOp)
- {
- Status = AE_NO_MEMORY;
- goto CloseThisOp;
- }
- }
-
- PreOp->Common.Value.Arg = NULL;
- PreOp->Common.AmlOpcode = WalkState->Opcode;
-
- /*
- * Get and append arguments until we find the node that contains
- * the name (the type ARGP_NAME).
- */
- while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
- (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) != ARGP_NAME))
- {
- Status = AcpiPsGetNextArg (WalkState, ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- AcpiPsAppendArg (PreOp, Arg);
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
- }
-
- /* Make sure that we found a NAME and didn't run out of arguments */
-
- if (!GET_CURRENT_ARG_TYPE (WalkState->ArgTypes))
- {
- Status = AE_AML_NO_OPERAND;
- goto CloseThisOp;
- }
-
- /* We know that this arg is a name, move to next arg */
-
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
-
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- WalkState->Op = NULL;
-
- Status = WalkState->DescendingCallback (WalkState, &Op);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "During name lookup/catalog, %s\n",
- AcpiFormatException (Status)));
- goto CloseThisOp;
- }
-
- if (Op == NULL)
- {
- continue;
- }
-
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
-
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- AcpiPsAppendArg (Op, PreOp->Common.Value.Arg);
- AcpiGbl_Depth++;
-
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- /*
- * Defer final parsing of an OperationRegion body,
- * because we don't have enough info in the first pass
- * to parse it correctly (i.e., there may be method
- * calls within the TermArg elements of the body.)
- *
- * However, we must continue parsing because
- * the opregion is not a standalone package --
- * we don't know where the end is at this point.
- *
- * (Length is unknown until parse of the body complete)
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = 0;
- }
- }
- else
- {
- /* Not a named opcode, just allocate Op and append to parent */
-
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode);
- Op = AcpiPsAllocOp (WalkState->Opcode);
- if (!Op)
- {
- Status = AE_NO_MEMORY;
- goto CloseThisOp;
- }
-
- if (WalkState->OpInfo->Flags & AML_CREATE)
- {
- /*
- * Backup to beginning of CreateXXXfield declaration
- * BodyLength is unknown until we parse the body
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.Length = 0;
- }
-
- AcpiPsAppendArg (AcpiPsGetParentScope (ParserState), Op);
-
- if ((WalkState->DescendingCallback != NULL))
- {
- /*
- * Find the object. This will either insert the object into
- * the namespace or simply look it up
- */
- WalkState->Op = Op;
-
- Status = WalkState->DescendingCallback (WalkState, &Op);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
-
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
- }
- }
-
- Op->Common.AmlOffset = WalkState->AmlOffset;
-
- if (WalkState->OpInfo)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "Opcode %4.4X [%s] Op %p Aml %p AmlOffset %5.5X\n",
- (UINT32) Op->Common.AmlOpcode, WalkState->OpInfo->Name,
- Op, ParserState->Aml, Op->Common.AmlOffset));
- }
- }
-
-
- /* Start ArgCount at zero because we don't know if there are any args yet */
-
- WalkState->ArgCount = 0;
-
- if (WalkState->ArgTypes) /* Are there any arguments that must be processed? */
- {
- /* Get arguments */
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_BYTE_OP: /* AML_BYTEDATA_ARG */
- case AML_WORD_OP: /* AML_WORDDATA_ARG */
- case AML_DWORD_OP: /* AML_DWORDATA_ARG */
- case AML_QWORD_OP: /* AML_QWORDATA_ARG */
- case AML_STRING_OP: /* AML_ASCIICHARLIST_ARG */
-
- /* Fill in constant or string argument directly */
-
- AcpiPsGetNextSimpleArg (ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), Op);
- break;
-
- case AML_INT_NAMEPATH_OP: /* AML_NAMESTRING_ARG */
-
- Status = AcpiPsGetNextNamepath (WalkState, ParserState, Op, 1);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- WalkState->ArgTypes = 0;
- break;
-
- default:
-
- /* Op is not a constant or string, append each argument to the Op */
-
- while (GET_CURRENT_ARG_TYPE (WalkState->ArgTypes) &&
- !WalkState->ArgCount)
- {
- WalkState->AmlOffset = (UINT32) ACPI_PTR_DIFF (ParserState->Aml,
- ParserState->AmlStart);
- Status = AcpiPsGetNextArg (WalkState, ParserState,
- GET_CURRENT_ARG_TYPE (WalkState->ArgTypes), &Arg);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
-
- if (Arg)
- {
- Arg->Common.AmlOffset = WalkState->AmlOffset;
- AcpiPsAppendArg (Op, Arg);
- }
- INCREMENT_ARG_LIST (WalkState->ArgTypes);
- }
-
- /* Special processing for certain opcodes */
-
- switch (Op->Common.AmlOpcode)
- {
- case AML_METHOD_OP:
-
- /*
- * Skip parsing of control method
- * because we don't have enough info in the first pass
- * to parse it correctly.
- *
- * Save the length and address of the body
- */
- Op->Named.Data = ParserState->Aml;
- Op->Named.Length = (UINT32) (ParserState->PkgEnd - ParserState->Aml);
-
- /* Skip body of method */
-
- ParserState->Aml = ParserState->PkgEnd;
- WalkState->ArgCount = 0;
- break;
-
- case AML_BUFFER_OP:
- case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
-
- if ((Op->Common.Parent) &&
- (Op->Common.Parent->Common.AmlOpcode == AML_NAME_OP) &&
- (WalkState->DescendingCallback != AcpiDsExecBeginOp))
- {
- /*
- * Skip parsing of Buffers and Packages
- * because we don't have enough info in the first pass
- * to parse them correctly.
- */
- Op->Named.Data = AmlOpStart;
- Op->Named.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;
-
- default:
-
- /* No action for all other opcodes */
- break;
- }
- break;
- }
- }
-
- /* Check for arguments that need to be processed */
-
- if (WalkState->ArgCount)
- {
- /* There are arguments (complex ones), push Op and prepare for argument */
-
- Status = AcpiPsPushScope (ParserState, Op,
- WalkState->ArgTypes, WalkState->ArgCount);
- if (ACPI_FAILURE (Status))
- {
- goto CloseThisOp;
- }
- Op = NULL;
- continue;
- }
-
- /* All arguments have been processed -- Op is complete, prepare for next */
-
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- if (WalkState->OpInfo->Flags & AML_NAMED)
- {
- if (AcpiGbl_Depth)
- {
- AcpiGbl_Depth--;
- }
-
- if (Op->Common.AmlOpcode == AML_REGION_OP)
- {
- /*
- * Skip parsing of control method or opregion body,
- * because we don't have enough info in the first pass
- * to parse them correctly.
- *
- * Completed parsing an OpRegion declaration, we now
- * know the length.
- */
- Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
- }
- }
-
- if (WalkState->OpInfo->Flags & AML_CREATE)
- {
- /*
- * Backup to beginning of CreateXXXfield declaration (1 for
- * Opcode)
- *
- * BodyLength is unknown until we parse the body
- */
- Op->Named.Length = (UINT32) (ParserState->Aml - Op->Named.Data);
- }
-
- /* This op complete, notify the dispatcher */
-
- if (WalkState->AscendingCallback != NULL)
- {
- WalkState->Op = Op;
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
- }
-
-
-CloseThisOp:
- /*
- * Finished one argument of the containing scope
- */
- ParserState->Scope->ParseScope.ArgCount--;
-
- /* Close this Op (will result in parse subtree deletion) */
-
- AcpiPsCompleteThisOp (WalkState, Op);
- Op = NULL;
- if (PreOp)
- {
- AcpiPsFreeOp (PreOp);
- PreOp = NULL;
- }
-
- switch (Status)
- {
- case AE_OK:
- break;
-
-
- case AE_CTRL_TRANSFER:
-
- /*
- * We are about to transfer to a called method.
- */
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
- return_ACPI_STATUS (Status);
-
-
- case AE_CTRL_END:
-
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- if (Op)
- {
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
-
- AcpiPsCompleteThisOp (WalkState, Op);
- Op = NULL;
- }
- Status = AE_OK;
- break;
-
-
- case AE_CTRL_BREAK:
- case AE_CTRL_CONTINUE:
-
- /* Pop off scopes until we find the While */
-
- while (!Op || (Op->Common.AmlOpcode != AML_WHILE_OP))
- {
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- }
-
- /* Close this iteration of the While loop */
-
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
-
- AcpiPsCompleteThisOp (WalkState, Op);
- Op = NULL;
-
- Status = AE_OK;
- break;
-
-
- case AE_CTRL_TERMINATE:
-
- Status = AE_OK;
-
- /* Clean up */
- do
- {
- if (Op)
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- }
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- } while (Op);
-
- return_ACPI_STATUS (Status);
-
-
- default: /* All other non-AE_OK status */
-
- do
- {
- if (Op)
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- }
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- } while (Op);
-
-
- /*
- * TBD: Cleanup parse ops on error
- */
-#if 0
- if (Op == NULL)
- {
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- }
-#endif
- WalkState->PrevOp = Op;
- WalkState->PrevArgTypes = WalkState->ArgTypes;
- return_ACPI_STATUS (Status);
- }
-
- /* This scope complete? */
-
- if (AcpiPsHasCompletedScope (ParserState))
- {
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped scope, Op=%p\n", Op));
- }
- else
- {
- Op = NULL;
- }
-
- } /* while ParserState->Aml */
-
-
- /*
- * Complete the last Op (if not completed), and clear the scope stack.
- * It is easily possible to end an AML "package" with an unbounded number
- * of open scopes (such as when several ASL blocks are closed with
- * sequential closing braces). We want to terminate each one cleanly.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "AML package complete at Op %p\n", Op));
- do
- {
- if (Op)
- {
- if (WalkState->AscendingCallback != NULL)
- {
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = WalkState->AscendingCallback (WalkState);
- Status = AcpiPsNextParseState (WalkState, Op, Status);
- if (Status == AE_CTRL_PENDING)
- {
- Status = AE_OK;
- goto CloseThisOp;
- }
-
- if (Status == AE_CTRL_TERMINATE)
- {
- Status = AE_OK;
-
- /* Clean up */
- do
- {
- if (Op)
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- }
-
- AcpiPsPopScope (ParserState, &Op,
- &WalkState->ArgTypes, &WalkState->ArgCount);
-
- } while (Op);
-
- return_ACPI_STATUS (Status);
- }
-
- else if (ACPI_FAILURE (Status))
- {
- AcpiPsCompleteThisOp (WalkState, Op);
- return_ACPI_STATUS (Status);
- }
- }
-
- AcpiPsCompleteThisOp (WalkState, Op);
- }
-
- AcpiPsPopScope (ParserState, &Op, &WalkState->ArgTypes,
- &WalkState->ArgCount);
-
- } while (Op);
-
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiPsParseAml
*
- * PARAMETERS: StartScope - The starting point of the parse. Becomes the
- * root of the parsed op tree.
- * Aml - Pointer to the raw AML code to parse
- * AmlSize - Length of the AML to parse
+ * PARAMETERS: WalkState - Current state
*
*
* RETURN: Status
@@ -1228,16 +532,17 @@
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status;
- ACPI_STATUS TerminateStatus;
ACPI_THREAD_STATE *Thread;
ACPI_THREAD_STATE *PrevWalkList = AcpiGbl_CurrentWalkList;
ACPI_WALK_STATE *PreviousWalkState;
- ACPI_FUNCTION_TRACE ("PsParseAml");
+ ACPI_FUNCTION_TRACE (PsParseAml);
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Entered with WalkState=%p Aml=%p size=%X\n",
- WalkState, WalkState->ParserState.Aml, WalkState->ParserState.AmlSize));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Entered with WalkState=%p Aml=%p size=%X\n",
+ WalkState, WalkState->ParserState.Aml,
+ WalkState->ParserState.AmlSize));
/* Create and initialize a new thread state */
@@ -1245,10 +550,21 @@
Thread = AcpiUtCreateThreadState ();
if (!Thread)
{
+ AcpiDsDeleteWalkState (WalkState);
return_ACPI_STATUS (AE_NO_MEMORY);
}
WalkState->Thread = Thread;
+
+ /*
+ * If executing a method, the starting SyncLevel is this method's
+ * SyncLevel
+ */
+ if (WalkState->MethodDesc)
+ {
+ WalkState->Thread->CurrentSyncLevel = WalkState->MethodDesc->Method.SyncLevel;
+ }
+
AcpiDsPushWalkState (WalkState, Thread);
/*
@@ -1286,6 +602,10 @@
* Transfer control to the called control method
*/
Status = AcpiDsCallControlMethod (Thread, WalkState, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ Status = AcpiDsMethodError (Status, WalkState);
+ }
/*
* If the transfer to the new method method call worked, a new walk
@@ -1300,31 +620,30 @@
}
else if ((Status != AE_OK) && (WalkState->MethodDesc))
{
- ACPI_REPORT_METHOD_ERROR ("Method execution failed",
+ /* Either the method parse or actual execution failed */
+
+ ACPI_ERROR_METHOD ("Method parse/execution failed",
WalkState->MethodNode, NULL, Status);
/* Check for possible multi-thread reentrancy problem */
if ((Status == AE_ALREADY_EXISTS) &&
- (!WalkState->MethodDesc->Method.Semaphore))
+ (!WalkState->MethodDesc->Method.Mutex))
{
+ ACPI_INFO ((AE_INFO, "Marking method %4.4s as Serialized",
+ WalkState->MethodNode->Name.Ascii));
+
/*
- * This method is marked NotSerialized, but it tried to create a named
- * object, causing the second thread entrance to fail. We will workaround
- * this by marking the method permanently as Serialized.
+ * Method tried to create an object twice. The probable cause is
+ * that the method cannot handle reentrancy.
+ *
+ * The method is marked NotSerialized, but it tried to create
+ * a named object, causing the second thread entrance to fail.
+ * Workaround this problem by marking the method permanently
+ * as Serialized.
*/
WalkState->MethodDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED;
- WalkState->MethodDesc->Method.Concurrency = 1;
- }
- }
-
- if (WalkState->MethodDesc)
- {
- /* Decrement the thread count on the method parse tree */
-
- if (WalkState->MethodDesc->Method.ThreadCount)
- {
- WalkState->MethodDesc->Method.ThreadCount--;
+ WalkState->MethodDesc->Method.SyncLevel = 0;
}
}
@@ -1337,29 +656,24 @@
AcpiDsScopeStackClear (WalkState);
/*
- * If we just returned from the execution of a control method,
- * there's lots of cleanup to do
+ * If we just returned from the execution of a control method or if we
+ * encountered an error during the method parse phase, there's lots of
+ * cleanup to do
*/
- if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE)
+ if (((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) == ACPI_PARSE_EXECUTE) ||
+ (ACPI_FAILURE (Status)))
{
- TerminateStatus = AcpiDsTerminateControlMethod (WalkState);
- if (ACPI_FAILURE (TerminateStatus))
- {
- ACPI_REPORT_ERROR ((
- "Could not terminate control method properly\n"));
-
- /* Ignore error and continue */
- }
+ AcpiDsTerminateControlMethod (WalkState->MethodDesc, WalkState);
}
/* Delete this walk state and all linked control states */
AcpiPsCleanupScope (&WalkState->ParserState);
-
PreviousWalkState = WalkState;
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "ReturnValue=%p, State=%p\n",
- WalkState->ReturnDesc, WalkState));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "ReturnValue=%p, ImplicitValue=%p State=%p\n",
+ WalkState->ReturnDesc, WalkState->ImplicitReturnObj, WalkState));
/* Check if we have restarted a preempted walk */
@@ -1373,8 +687,22 @@
* If the method return value is not used by the parent,
* The object is deleted
*/
- Status = AcpiDsRestartControlMethod (WalkState,
- PreviousWalkState->ReturnDesc);
+ if (!PreviousWalkState->ReturnDesc)
+ {
+ Status = AcpiDsRestartControlMethod (WalkState,
+ PreviousWalkState->ImplicitReturnObj);
+ }
+ else
+ {
+ /*
+ * We have a valid return value, delete any implicit
+ * return value.
+ */
+ AcpiDsClearImplicitReturn (PreviousWalkState);
+
+ Status = AcpiDsRestartControlMethod (WalkState,
+ PreviousWalkState->ReturnDesc);
+ }
if (ACPI_SUCCESS (Status))
{
WalkState->WalkType |= ACPI_WALK_METHOD_RESTART;
@@ -1394,13 +722,33 @@
*/
else if (PreviousWalkState->CallerReturnDesc)
{
- *(PreviousWalkState->CallerReturnDesc) = PreviousWalkState->ReturnDesc; /* NULL if no return value */
+ if (PreviousWalkState->ImplicitReturnObj)
+ {
+ *(PreviousWalkState->CallerReturnDesc) =
+ PreviousWalkState->ImplicitReturnObj;
+ }
+ else
+ {
+ /* NULL if no return value */
+
+ *(PreviousWalkState->CallerReturnDesc) =
+ PreviousWalkState->ReturnDesc;
+ }
}
- else if (PreviousWalkState->ReturnDesc)
+ else
{
- /* Caller doesn't want it, must delete it */
+ if (PreviousWalkState->ReturnDesc)
+ {
+ /* Caller doesn't want it, must delete it */
+
+ AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
+ }
+ if (PreviousWalkState->ImplicitReturnObj)
+ {
+ /* Caller doesn't want it, must delete it */
- AcpiUtRemoveReference (PreviousWalkState->ReturnDesc);
+ AcpiUtRemoveReference (PreviousWalkState->ImplicitReturnObj);
+ }
}
AcpiDsDeleteWalkState (PreviousWalkState);
Index: acevents.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acevents.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acevents.h -L sys/contrib/dev/acpica/acevents.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acevents.h
+++ sys/contrib/dev/acpica/acevents.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acevents.h - Event subcomponent prototypes and defines
- * $Revision: 96 $
+ * $Revision: 1.107 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,6 +118,9 @@
#define __ACEVENTS_H__
+/*
+ * evevent
+ */
ACPI_STATUS
AcpiEvInitializeEvents (
void);
@@ -126,28 +129,18 @@
AcpiEvInstallXruptHandlers (
void);
-
-/*
- * Evfixed - Fixed event handling
- */
-
ACPI_STATUS
-AcpiEvFixedEventInitialize (
+AcpiEvInstallFadtGpes (
void);
UINT32
AcpiEvFixedEventDetect (
void);
-UINT32
-AcpiEvFixedEventDispatch (
- UINT32 Event);
-
/*
- * Evmisc
+ * evmisc
*/
-
BOOLEAN
AcpiEvIsNotifyObject (
ACPI_NAMESPACE_NODE *Node);
@@ -173,24 +166,10 @@
ACPI_NAMESPACE_NODE *Node,
UINT32 NotifyValue);
-void ACPI_SYSTEM_XFACE
-AcpiEvNotifyDispatch (
- void *Context);
-
/*
- * Evgpe - GPE handling and dispatch
+ * evgpe - GPE handling and dispatch
*/
-
-ACPI_STATUS
-AcpiEvWalkGpeList (
- ACPI_GPE_CALLBACK GpeWalkCallback,
- UINT32 Flags);
-
-BOOLEAN
-AcpiEvValidGpeEvent (
- ACPI_GPE_EVENT_INFO *GpeEventInfo);
-
ACPI_STATUS
AcpiEvUpdateGpeEnableMasks (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
@@ -210,9 +189,22 @@
ACPI_HANDLE GpeDevice,
UINT32 GpeNumber);
+
+/*
+ * evgpeblk
+ */
+BOOLEAN
+AcpiEvValidGpeEvent (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
ACPI_STATUS
-AcpiEvGpeInitialize (
- void);
+AcpiEvWalkGpeList (
+ ACPI_GPE_CALLBACK GpeWalkCallback);
+
+ACPI_STATUS
+AcpiEvDeleteGpeHandlers (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
ACPI_STATUS
AcpiEvCreateGpeBlock (
@@ -220,16 +212,16 @@
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
UINT8 GpeBlockBaseNumber,
- UINT32 InterruptLevel,
+ UINT32 InterruptNumber,
ACPI_GPE_BLOCK_INFO **ReturnGpeBlock);
ACPI_STATUS
-AcpiEvDeleteGpeBlock (
+AcpiEvInitializeGpeBlock (
+ ACPI_NAMESPACE_NODE *GpeDevice,
ACPI_GPE_BLOCK_INFO *GpeBlock);
ACPI_STATUS
-AcpiEvDeleteGpeHandlers (
- ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+AcpiEvDeleteGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock);
UINT32
@@ -250,10 +242,14 @@
AcpiEvCheckForWakeOnlyGpe (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
+ACPI_STATUS
+AcpiEvGpeInitialize (
+ void);
+
+
/*
- * Evregion - Address Space handling
+ * evregion - Address Space handling
*/
-
ACPI_STATUS
AcpiEvInstallRegionHandlers (
void);
@@ -268,14 +264,7 @@
UINT32 Function,
ACPI_PHYSICAL_ADDRESS Address,
UINT32 BitWidth,
- void *Value);
-
-ACPI_STATUS
-AcpiEvInstallHandler (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Context,
- void **ReturnValue);
+ ACPI_INTEGER *Value);
ACPI_STATUS
AcpiEvAttachRegion (
@@ -306,17 +295,10 @@
ACPI_OPERAND_OBJECT *RegionObj,
UINT32 Function);
-ACPI_STATUS
-AcpiEvRegRun (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Context,
- void **ReturnValue);
/*
- * Evregini - Region initialization and setup
+ * evregini - Region initialization and setup
*/
-
ACPI_STATUS
AcpiEvSystemMemoryRegionSetup (
ACPI_HANDLE Handle,
@@ -366,9 +348,8 @@
/*
- * Evsci - SCI (System Control Interrupt) handling/dispatch
+ * evsci - SCI (System Control Interrupt) handling/dispatch
*/
-
UINT32 ACPI_SYSTEM_XFACE
AcpiEvGpeXruptHandler (
void *Context);
Index: pswalk.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/pswalk.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/pswalk.c -L sys/contrib/dev/acpica/pswalk.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/pswalk.c
+++ sys/contrib/dev/acpica/pswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: pswalk - Parser routines to walk parsed op tree(s)
- * $Revision: 70 $
+ * $Revision: 1.78 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,7 +117,6 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acparser.h>
-#include <contrib/dev/acpica/acdispat.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("pswalk")
@@ -125,269 +124,70 @@
/*******************************************************************************
*
- * FUNCTION: AcpiPsGetNextWalkOp
+ * FUNCTION: AcpiPsDeleteParseTree
*
- * PARAMETERS: WalkState - Current state of the walk
- * Op - Current Op to be walked
- * AscendingCallback - Procedure called when Op is complete
+ * PARAMETERS: SubtreeRoot - Root of tree (or subtree) to delete
*
- * RETURN: Status
+ * RETURN: None
*
- * DESCRIPTION: Get the next Op in a walk of the parse tree.
+ * DESCRIPTION: Delete a portion of or an entire parse tree.
*
******************************************************************************/
-ACPI_STATUS
-AcpiPsGetNextWalkOp (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- ACPI_PARSE_UPWARDS AscendingCallback)
+void
+AcpiPsDeleteParseTree (
+ ACPI_PARSE_OBJECT *SubtreeRoot)
{
- ACPI_PARSE_OBJECT *Next;
- ACPI_PARSE_OBJECT *Parent;
- ACPI_PARSE_OBJECT *GrandParent;
- ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Op = SubtreeRoot;
+ ACPI_PARSE_OBJECT *Next = NULL;
+ ACPI_PARSE_OBJECT *Parent = NULL;
- ACPI_FUNCTION_TRACE_PTR ("PsGetNextWalkOp", Op);
+ ACPI_FUNCTION_TRACE_PTR (PsDeleteParseTree, SubtreeRoot);
- /* Check for a argument only if we are descending in the tree */
+ /* Visit all nodes in the subtree */
- if (WalkState->NextOpInfo != ACPI_NEXT_OP_UPWARD)
+ while (Op)
{
- /* Look for an argument or child of the current op */
-
- Next = AcpiPsGetArg (Op, 0);
- if (Next)
- {
- /* Still going downward in tree (Op is not completed yet) */
-
- WalkState->PrevOp = Op;
- WalkState->NextOp = Next;
- WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
+ /* Check if we are not ascending */
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * No more children, this Op is complete. Save Next and Parent
- * in case the Op object gets deleted by the callback routine
- */
- Next = Op->Common.Next;
- Parent = Op->Common.Parent;
-
- WalkState->Op = Op;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
- WalkState->Opcode = Op->Common.AmlOpcode;
-
- Status = AscendingCallback (WalkState);
-
- /*
- * If we are back to the starting point, the walk is complete.
- */
- if (Op == WalkState->Origin)
+ if (Op != Parent)
{
- /* Reached the point of origin, the walk is complete */
+ /* Look for an argument or child of the current op */
- WalkState->PrevOp = Op;
- WalkState->NextOp = NULL;
+ Next = AcpiPsGetArg (Op, 0);
+ if (Next)
+ {
+ /* Still going downward in tree (Op is not completed yet) */
- return_ACPI_STATUS (Status);
+ Op = Next;
+ continue;
+ }
}
- /*
- * Check for a sibling to the current op. A sibling means
- * we are still going "downward" in the tree.
- */
- if (Next)
- {
- /* There is a sibling, it will be next */
-
- WalkState->PrevOp = Op;
- WalkState->NextOp = Next;
- WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
-
- /* Continue downward */
+ /* No more children, this Op is complete. */
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Drop into the loop below because we are moving upwards in
- * the tree
- */
- }
- else
- {
- /*
- * We are resuming a walk, and we were (are) going upward in the tree.
- * So, we want to drop into the parent loop below.
- */
- Parent = Op;
- }
+ Next = Op->Common.Next;
+ Parent = Op->Common.Parent;
- /*
- * Look for a sibling of the current Op's parent
- * Continue moving up the tree until we find a node that has not been
- * visited, or we get back to where we started.
- */
- while (Parent)
- {
- /* We are moving up the tree, therefore this parent Op is complete */
+ AcpiPsFreeOp (Op);
- GrandParent = Parent->Common.Parent;
- Next = Parent->Common.Next;
+ /* If we are back to the starting point, the walk is complete. */
- WalkState->Op = Parent;
- WalkState->OpInfo = AcpiPsGetOpcodeInfo (Parent->Common.AmlOpcode);
- WalkState->Opcode = Parent->Common.AmlOpcode;
-
- Status = AscendingCallback (WalkState);
-
- /*
- * If we are back to the starting point, the walk is complete.
- */
- if (Parent == WalkState->Origin)
+ if (Op == SubtreeRoot)
{
- /* Reached the point of origin, the walk is complete */
-
- WalkState->PrevOp = Parent;
- WalkState->NextOp = NULL;
-
- return_ACPI_STATUS (Status);
+ return_VOID;
}
-
- /*
- * If there is a sibling to this parent (it is not the starting point
- * Op), then we will visit it.
- */
if (Next)
{
- /* found sibling of parent */
-
- WalkState->PrevOp = Parent;
- WalkState->NextOp = Next;
- WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
-
- return_ACPI_STATUS (Status);
+ Op = Next;
}
-
- /* No siblings, no errors, just move up one more level in the tree */
-
- Op = Parent;
- Parent = GrandParent;
- WalkState->PrevOp = Op;
- }
-
-
- /*
- * Got all the way to the top of the tree, we must be done!
- * However, the code should have terminated in the loop above
- */
- WalkState->NextOp = NULL;
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiPsDeleteCompletedOp
- *
- * PARAMETERS: State - Walk state
- * Op - Completed op
- *
- * RETURN: AE_OK
- *
- * DESCRIPTION: Callback function for AcpiPsGetNextWalkOp(). Used during
- * AcpiPsDeleteParse tree to delete Op objects when all sub-objects
- * have been visited (and deleted.)
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiPsDeleteCompletedOp (
- ACPI_WALK_STATE *WalkState)
-{
-
- AcpiPsFreeOp (WalkState->Op);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiPsDeleteParseTree
- *
- * PARAMETERS: SubtreeRoot - Root of tree (or subtree) to delete
- *
- * RETURN: None
- *
- * DESCRIPTION: Delete a portion of or an entire parse tree.
- *
- ******************************************************************************/
-
-void
-AcpiPsDeleteParseTree (
- ACPI_PARSE_OBJECT *SubtreeRoot)
-{
- ACPI_WALK_STATE *WalkState;
- ACPI_THREAD_STATE *Thread;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_PTR ("PsDeleteParseTree", SubtreeRoot);
-
-
- if (!SubtreeRoot)
- {
- return_VOID;
- }
-
- /* Create and initialize a new walk list */
-
- Thread = AcpiUtCreateThreadState ();
- if (!Thread)
- {
- return_VOID;
- }
-
- WalkState = AcpiDsCreateWalkState (0, NULL, NULL, Thread);
- if (!WalkState)
- {
- return_VOID;
- }
-
- WalkState->ParseFlags = 0;
- WalkState->DescendingCallback = NULL;
- WalkState->AscendingCallback = NULL;
-
- WalkState->Origin = SubtreeRoot;
- WalkState->NextOp = SubtreeRoot;
-
- /* Head downward in the tree */
-
- WalkState->NextOpInfo = ACPI_NEXT_OP_DOWNWARD;
-
- /* Visit all nodes in the subtree */
-
- while (WalkState->NextOp)
- {
- Status = AcpiPsGetNextWalkOp (WalkState, WalkState->NextOp,
- AcpiPsDeleteCompletedOp);
- if (ACPI_FAILURE (Status))
+ else
{
- break;
+ Op = Parent;
}
}
- /* We are done with this walk */
-
- AcpiUtDeleteGenericState (ACPI_CAST_PTR (ACPI_GENERIC_STATE, Thread));
- AcpiDsDeleteWalkState (WalkState);
-
return_VOID;
}
-
-
Index: CHANGES.txt
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/CHANGES.txt,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/CHANGES.txt -L sys/contrib/dev/acpica/CHANGES.txt -u -r1.1.1.1 -r1.2
--- sys/contrib/dev/acpica/CHANGES.txt
+++ sys/contrib/dev/acpica/CHANGES.txt
@@ -1,41 +1,3098 @@
----------------------------------------
+20 March 2007. Summary of changes for version 20070320:
+
+1) ACPI CA Core Subsystem:
+
+Implemented a change to the order of interpretation and
+evaluation of AML operand objects within the AML interpreter. The
+interpreter now evaluates operands in the order that they appear
+in the AML stream (and the corresponding ASL code), instead of in
+the reverse order (after the entire operand list has been
+parsed). The previous behavior caused several subtle
+incompatibilities with the Microsoft AML interpreter as well as
+being somewhat non-intuitive. BZ 7871, local BZ 263. Valery
+Podrezov.
+
+Implemented a change to the ACPI Global Lock support. All
+interfaces to the global lock now allow the same thread to
+acquire the lock multiple times. This affects the
+AcpiAcquireGlobalLock external interface to the global lock as
+well as the internal use of the global lock to support AML fields
+-- a control method that is holding the global lock can now
+simultaneously access AML fields that require global lock
+protection. Previously, in both cases, this would have resulted
+in an AE_ALREADY_ACQUIRED exception. The change to
+AcpiAcquireGlobalLock is of special interest to drivers for the
+Embedded Controller. There is no change to the behavior of the
+AML Acquire operator, as this can already be used to acquire a
+mutex multiple times by the same thread. BZ 8066. With assistance
+from Alexey Starikovskiy.
+
+Fixed a problem where invalid objects could be referenced in the
+AML Interpreter after error conditions. During operand
+evaluation, ensure that the internal "Return Object" field is
+cleared on error and only valid pointers are stored there. Caused
+occasional access to deleted objects that resulted in "large
+reference count" warning messages. Valery Podrezov.
+
+Fixed a problem where an AE_STACK_OVERFLOW internal exception
+could occur on deeply nested control method invocations. BZ 7873,
+local BZ 487. Valery Podrezov.
+
+Fixed an internal problem with the handling of result objects on
+the interpreter result stack. BZ 7872. Valery Podrezov.
+
+Removed obsolete code that handled the case where AML_NAME_OP is
+the target of a reference (Reference.Opcode). This code was no
+longer necessary. BZ 7874. Valery Podrezov.
+
+Removed obsolete ACPI_NO_INTEGER64_SUPPORT from two header files.
+This was a remnant from the previously discontinued 16-bit
+support.
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total
+ Debug Version: 155.8K Code, 63.3K Data, 219.1K Total
+ Current Release:
+ Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total
+ Debug Version: 155.9K Code, 63.1K Data, 219.0K Total
+
+----------------------------------------
+26 January 2007. Summary of changes for version 20070126:
+
+1) ACPI CA Core Subsystem:
+
+Added the 2007 copyright to all module headers and signons. This
+affects virtually every file in the ACPICA core subsystem, the
+iASL compiler, and the utilities.
+
+Implemented a fix for an incorrect parameter passed to
+AcpiTbDeleteTable during a table load. A bad pointer was passed
+in the case where the DSDT is overridden, causing a fault in this
+case.
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total
+ Debug Version: 155.8K Code, 63.3K Data, 219.1K Total
+ Current Release:
+ Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total
+ Debug Version: 155.8K Code, 63.3K Data, 219.1K Total
+
+----------------------------------------
+15 December 2006. Summary of changes for version 20061215:
+
+1) ACPI CA Core Subsystem:
+
+Support for 16-bit ACPICA has been completely removed since it is
+no longer necessary and it clutters the code. All 16-bit macros,
+types, and conditional compiles have been removed, cleaning up
+and simplifying the code across the entire subsystem. DOS support
+is no longer needed since the bootable Linux firmware kit is now
+available.
+
+The handler for the Global Lock is now removed during
+AcpiTerminate to enable a clean subsystem restart, via the
+implementation of the AcpiEvRemoveGlobalLockHandler function.
+(With assistance from Joel Bretz, HP)
+
+Implemented enhancements to the multithreading support within the
+debugger to enable improved multithreading debugging and
+evaluation of the subsystem. (Valery Podrezov)
+
+Debugger: Enhanced the Statistics/Memory command to emit the
+total (maximum) memory used during the execution, as well as the
+maximum memory consumed by each of the various object types.
+(Valery Podrezov)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 77.9K Code, 17.0K Data, 94.9K Total
+ Debug Version: 155.2K Code, 63.1K Data, 218.3K Total
+ Current Release:
+ Non-Debug Version: 78.0K Code, 17.1K Data, 95.1K Total
+ Debug Version: 155.8K Code, 63.3K Data, 219.1K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+AcpiExec: Implemented a new option (-m) to display full memory
+use statistics upon subsystem/program termination. (Valery
+Podrezov)
+
+----------------------------------------
+09 November 2006. Summary of changes for version 20061109:
+
+1) ACPI CA Core Subsystem:
+
+Optimized the Load ASL operator in the case where the source
+operand is an operation region. Simply map the operation region
+memory, instead of performing a bytewise read. (Region must be of
+type SystemMemory, see below.)
+
+Fixed the Load ASL operator for the case where the source operand
+is a region field. A buffer object is also allowed as the source
+operand. BZ 480
+
+Fixed a problem where the Load ASL operator allowed the source
+operand to be an operation region of any type. It is now
+restricted to regions of type SystemMemory, as per the ACPI
+specification. BZ 481
+
+Additional cleanup and optimizations for the new Table Manager
+code.
+
+AcpiEnable will now fail if all of the required ACPI tables are
+not loaded (FADT, FACS, DSDT). BZ 477
+
+Added #pragma pack(8/4) to acobject.h to ensure that the
+structures in this header are always compiled as aligned. The
+ACPI_OPERAND_OBJECT has been manually optimized to be aligned and
+will not work if it is byte-packed.
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total
+ Debug Version: 155.4K Code, 63.1K Data, 218.5K Total
+ Current Release:
+ Non-Debug Version: 77.9K Code, 17.0K Data, 94.9K Total
+ Debug Version: 155.2K Code, 63.1K Data, 218.3K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Fixed a problem where the presence of the _OSI predefined control
+method within complex expressions could cause an internal
+compiler error.
+
+AcpiExec: Implemented full region support for multiple address
+spaces. SpaceId is now part of the REGION object. BZ 429
+
+----------------------------------------
+11 October 2006. Summary of changes for version 20061011:
+
+1) ACPI CA Core Subsystem:
+
+Completed an AML interpreter performance enhancement for control
+method execution. Previously a 2-pass parse/execution, control
+methods are now completely parsed and executed in a single pass.
+This improves overall interpreter performance by ~25%, reduces
+code size, and reduces CPU stack use. (Valery Podrezov +
+interpreter changes in version 20051202 that eliminated namespace
+loading during the pass one parse.)
+
+Implemented _CID support for PCI Root Bridge detection. If the
+_HID does not match the predefined PCI Root Bridge IDs, the _CID
+list (if present) is now obtained and also checked for an ID
+match.
+
+Implemented additional support for the PCI _ADR execution:
+upsearch until a device scope is found before executing _ADR.
+This allows PCI_Config operation regions to be declared locally
+within control methods underneath PCI device objects.
+
+Fixed a problem with a possible race condition between threads
+executing AcpiWalkNamespace and the AML interpreter. This
+condition was removed by modifying AcpiWalkNamespace to (by
+default) ignore all temporary namespace entries created during
+any concurrent control method execution. An additional namespace
+race condition is known to exist between AcpiWalkNamespace and
+the Load/Unload ASL operators and is still under investigation.
+
+Restructured the AML ParseLoop function, breaking it into several
+subfunctions in order to reduce CPU stack use and improve
+maintainability. (Mikhail Kouzmich)
+
+AcpiGetHandle: Fix for parameter validation to detect invalid
+combinations of prefix handle and pathname. BZ 478
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total
+ Debug Version: 154.6K Code, 63.0K Data, 217.6K Total
+ Current Release:
+ Non-Debug Version: 78.1K Code, 17.1K Data, 95.2K Total
+ Debug Version: 155.4K Code, 63.1K Data, 218.5K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+Ported the -g option (get local ACPI tables) to the new ACPICA
+Table Manager to restore original behavior.
+
+----------------------------------------
+27 September 2006. Summary of changes for version 20060927:
+
+1) ACPI CA Core Subsystem:
+
+Removed the "Flags" parameter from AcpiGetRegister and
+AcpiSetRegister. These functions now use a spinlock for mutual
+exclusion and the interrupt level indication flag is not needed.
+
+Fixed a problem with the Global Lock where the lock could appear
+to be obtained before it is actually obtained. The global lock
+semaphore was inadvertently created with one unit instead of zero
+units. (BZ 464) Fiodor Suietov.
+
+Fixed a possible memory leak and fault in
+AcpiExResolveObjectToValue during a read from a buffer or region
+field. (BZ 458) Fiodor Suietov.
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total
+ Debug Version: 154.7K Code, 63.0K Data, 217.7K Total
+ Current Release:
+ Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total
+ Debug Version: 154.6K Code, 63.0K Data, 217.6K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Fixed a compilation problem with the pre-defined Resource
+Descriptor field names where an "object does not exist" error
+could be incorrectly generated if the parent ResourceTemplate
+pathname places the template within a different namespace scope
+than the current scope. (BZ 7212)
+
+Fixed a problem where the compiler could hang after syntax errors
+detected in an ElseIf construct. (BZ 453)
+
+Fixed a problem with the AmlFilename parameter to the
+DefinitionBlock() operator. An incorrect output filename was
+produced when this parameter was a null string (""). Now, the
+original input filename is used as the AML output filename, with
+an ".aml" extension.
+
+Implemented a generic batch command mode for the AcpiExec utility
+(execute any AML debugger command) (Valery Podrezov).
+
+----------------------------------------
+12 September 2006. Summary of changes for version 20060912:
+
+1) ACPI CA Core Subsystem:
+
+Enhanced the implementation of the "serialized mode" of the
+interpreter (enabled via the AcpiGbl_AllMethodsSerialized flag.)
+When this mode is specified, instead of creating a serialization
+semaphore per control method, the interpreter lock is simply no
+longer released before a blocking operation during control method
+execution. This effectively makes the AML Interpreter single-
+threaded. The overhead of a semaphore per-method is eliminated.
+
+Fixed a regression where an error was no longer emitted if a
+control method attempts to create 2 objects of the same name.
+This once again returns AE_ALREADY_EXISTS. When this exception
+occurs, it invokes the mechanism that will dynamically serialize
+the control method to possible prevent future errors. (BZ 440)
+
+Integrated a fix for a problem with PCI Express HID detection in
+the PCI Config Space setup procedure. (BZ 7145)
+
+Moved all FADT-related functions to a new file, tbfadt.c.
+Eliminated the AcpiHwInitialize function - the FADT registers are
+now validated when the table is loaded.
+
+Added two new warnings during FADT verification - 1) if the FADT
+is larger than the largest known FADT version, and 2) if there is
+a mismatch between a 32-bit block address and the 64-bit X
+counterpart (when both are non-zero.)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 77.9K Code, 16.7K Data, 94.6K Total
+ Debug Version: 154.9K Code, 62.6K Data, 217.5K Total
+ Current Release:
+ Non-Debug Version: 77.9K Code, 17.1K Data, 95.0K Total
+ Debug Version: 154.7K Code, 63.0K Data, 217.7K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Fixed a problem with the implementation of the Switch() operator
+where the temporary variable was declared too close to the actual
+Switch, instead of at method level. This could cause a problem if
+the Switch() operator is within a while loop, causing an error on
+the second iteration. (BZ 460)
+
+Disassembler - fix for error emitted for unknown type for target
+of scope operator. Now, ignore it and continue.
+
+Disassembly of an FADT now verifies the input FADT and reports
+any errors found. Fix for proper disassembly of full-sized (ACPI
+2.0) FADTs.
+
+Disassembly of raw data buffers with byte initialization data now
+prefixes each output line with the current buffer offset.
+
+Disassembly of ASF! table now includes all variable-length data
+fields at the end of some of the subtables.
+
+The disassembler now emits a comment if a buffer appears to be a
+ResourceTemplate, but cannot be disassembled as such because the
+EndTag does not appear at the very end of the buffer.
+
+AcpiExec - Added the "-t" command line option to enable the
+serialized mode of the AML interpreter.
+
+----------------------------------------
+31 August 2006. Summary of changes for version 20060831:
+
+1) ACPI CA Core Subsystem:
+
+Miscellaneous fixes for the Table Manager:
+- Correctly initialize internal common FADT for all 64-bit "X"
+fields
+- Fixed a couple table mapping issues during table load
+- Fixed a couple alignment issues for IA64
+- Initialize input array to zero in AcpiInitializeTables
+- Additional parameter validation for AcpiGetTable,
+AcpiGetTableHeader, AcpiGetTableByIndex
+
+Change for GPE support: when a "wake" GPE is received, all wake
+GPEs are now immediately disabled to prevent the waking GPE from
+firing again and to prevent other wake GPEs from interrupting the
+wake process.
+
+Added the AcpiGpeCount global that tracks the number of processed
+GPEs, to be used for debugging systems with a large number of
+ACPI interrupts.
+
+Implemented support for the "DMAR" ACPI table (DMA Redirection
+Table) in both the ACPICA headers and the disassembler.
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 77.8K Code, 16.5K Data, 94.3K Total
+ Debug Version: 154.6K Code, 62.3K Data, 216.9K Total
+ Current Release:
+ Non-Debug Version: 77.9K Code, 16.7K Data, 94.6K Total
+ Debug Version: 154.9K Code, 62.6K Data, 217.5K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler support for the DMAR ACPI table.
+
+----------------------------------------
+23 August 2006. Summary of changes for version 20060823:
+
+1) ACPI CA Core Subsystem:
+
+The Table Manager component has been completely redesigned and
+reimplemented. The new design is much simpler, and reduces the
+overall code and data size of the kernel-resident ACPICA by
+approximately 5%. Also, it is now possible to obtain the ACPI
+tables very early during kernel initialization, even before
+dynamic memory management is initialized. (Alexey Starikovskiy,
+Fiodor Suietov, Bob Moore)
+
+Obsolete ACPICA interfaces:
+
+- AcpiGetFirmwareTable: Use AcpiGetTable instead (works at early
+kernel init time).
+- AcpiLoadTable: Not needed.
+- AcpiUnloadTable: Not needed.
+
+New ACPICA interfaces:
+
+- AcpiInitializeTables: Must be called before the table manager
+can be used.
+- AcpiReallocateRootTable: Used to transfer the root table to
+dynamically allocated memory after it becomes available.
+- AcpiGetTableByIndex: Allows the host to easily enumerate all
+ACPI tables in the RSDT/XSDT.
+
+Other ACPICA changes:
+
+- AcpiGetTableHeader returns the actual mapped table header, not
+a copy. Use AcpiOsUnmapMemory to free this mapping.
+- AcpiGetTable returns the actual mapped table. The mapping is
+managed internally and must not be deleted by the caller. Use of
+this interface causes no additional dynamic memory allocation.
+- AcpiFindRootPointer: Support for physical addressing has been
+eliminated, it appeared to be unused.
+- The interface to AcpiOsMapMemory has changed to be consistent
+with the other allocation interfaces.
+- The interface to AcpiOsGetRootPointer has changed to eliminate
+unnecessary parameters.
+- ACPI_PHYSICAL_ADDRESS is now 32 bits on 32-bit platforms, 64
+bits on 64-bit platforms. Was previously 64 bits on all
+platforms.
+- The interface to the ACPI Global Lock acquire/release macros
+have changed slightly since ACPICA no longer keeps a local copy
+of the FACS with a constructed pointer to the actual global lock.
+
+Porting to the new table manager:
+
+- AcpiInitializeTables: Must be called once, and can be called
+anytime during the OS initialization process. It allows the host
+to specify an area of memory to be used to store the internal
+version of the RSDT/XSDT (root table). This allows the host to
+access ACPI tables before memory management is initialized and
+running.
+- AcpiReallocateRootTable: Can be called after memory management
+is running to copy the root table to a dynamically allocated
+array, freeing up the scratch memory specified in the call to
+AcpiInitializeTables.
+- AcpiSubsystemInitialize: This existing interface is independent
+of the Table Manager, and does not have to be called before the
+Table Manager can be used, it only must be called before the rest
+of ACPICA can be used.
+- ACPI Tables: Some changes have been made to the names and
+structure of the actbl.h and actbl1.h header files and may
+require changes to existing code. For example, bitfields have
+been completely removed because of their lack of portability
+across C compilers.
+- Update interfaces to the Global Lock acquire/release macros if
+local versions are used. (see acwin.h)
+
+Obsolete files: tbconvrt.c, tbget.c, tbgetall.c, tbrsdt.c
+
+New files: tbfind.c
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 80.7K Code, 17.9K Data, 98.6K Total
+ Debug Version: 161.0K Code, 65.1K Data, 226.1K Total
+ Current Release:
+ Non-Debug Version: 77.8K Code, 16.5K Data, 94.3K Total
+ Debug Version: 154.6K Code, 62.3K Data, 216.9K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+No changes for this release.
+
+----------------------------------------
+21 July 2006. Summary of changes for version 20060721:
+
+1) ACPI CA Core Subsystem:
+
+The full source code for the ASL test suite used to validate the
+iASL compiler and the ACPICA core subsystem is being released
+with the ACPICA source for the first time. The source is
+contained in a separate package and consists of over 1100 files
+that exercise all ASL/AML operators. The package should appear on
+the Intel/ACPI web site shortly. (Valery Podrezov, Fiodor
+Suietov)
+
+Completed a new design and implementation for support of the ACPI
+Global Lock. On the OS side, the global lock is now treated as a
+standard AML mutex. Previously, multiple OS threads could
+"acquire" the global lock simultaneously. However, this could
+cause the BIOS to be starved out of the lock - especially in
+cases such as the Embedded Controller driver where there is a
+tight coupling between the OS and the BIOS.
+
+Implemented an optimization for the ACPI Global Lock interrupt
+mechanism. The Global Lock interrupt handler no longer queues the
+execution of a separate thread to signal the global lock
+semaphore. Instead, the semaphore is signaled directly from the
+interrupt handler.
+
+Implemented support within the AML interpreter for package
+objects that contain a larger AML length (package list length)
+than the package element count. In this case, the length of the
+package is truncated to match the package element count. Some
+BIOS code apparently modifies the package length on the fly, and
+this change supports this behavior. Provides compatibility with
+the MS AML interpreter. (With assistance from Fiodor Suietov)
+
+Implemented a temporary fix for the BankValue parameter of a Bank
+Field to support all constant values, now including the Zero and
+One opcodes. Evaluation of this parameter must eventually be
+converted to a full TermArg evaluation. A not-implemented error
+is now returned (temporarily) for non-constant values for this
+parameter.
+
+Fixed problem reports (Fiodor Suietov) integrated:
+- Fix for premature object deletion after CopyObject on Operation
+Region (BZ 350)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 80.7K Code, 18.0K Data, 98.7K Total
+ Debug Version: 160.9K Code, 65.1K Data, 226.0K Total
+ Current Release:
+ Non-Debug Version: 80.7K Code, 17.9K Data, 98.6K Total
+ Debug Version: 161.0K Code, 65.1K Data, 226.1K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+No changes for this release.
+
+----------------------------------------
+07 July 2006. Summary of changes for version 20060707:
+
+1) ACPI CA Core Subsystem:
+
+Added the ACPI_PACKED_POINTERS_NOT_SUPPORTED macro to support C
+compilers that do not allow the initialization of address
+pointers within packed structures - even though the hardware
+itself may support misaligned transfers. Some of the debug data
+structures are packed by default to minimize size.
+
+Added an error message for the case where AcpiOsGetThreadId()
+returns zero. A non-zero value is required by the core ACPICA
+code to ensure the proper operation of AML mutexes and recursive
+control methods.
+
+The DSDT is now the only ACPI table that determines whether the
+AML interpreter is in 32-bit or 64-bit mode. Not really a
+functional change, but the hooks for per-table 32/64 switching
+have been removed from the code. A clarification to the ACPI
+specification is forthcoming in ACPI 3.0B.
+
+Fixed a possible leak of an OwnerID in the error path of
+AcpiTbInitTableDescriptor (tbinstal.c), and migrated all table
+OwnerID deletion to a single place in AcpiTbUninstallTable to
+correct possible leaks when using the AcpiTbDeleteTablesByType
+interface (with assistance from Lance Ortiz.)
+
+Fixed a problem with Serialized control methods where the
+semaphore associated with the method could be over-signaled after
+multiple method invocations.
+
+Fixed two issues with the locking of the internal namespace data
+structure. Both the Unload() operator and AcpiUnloadTable
+interface now lock the namespace during the namespace deletion
+associated with the table unload (with assistance from Linn
+Crosetto.)
+
+Fixed problem reports (Valery Podrezov) integrated:
+- Eliminate unnecessary memory allocation for CreateXxxxField (BZ
+5426)
+
+Fixed problem reports (Fiodor Suietov) integrated:
+- Incomplete cleanup branches in AcpiTbGetTableRsdt (BZ 369)
+- On Address Space handler deletion, needless deactivation call
+(BZ 374)
+- AcpiRemoveAddressSpaceHandler: validate Device handle parameter
+(BZ 375)
+- Possible memory leak, Notify sub-objects of Processor, Power,
+ThermalZone (BZ 376)
+- AcpiRemoveAddressSpaceHandler: validate Handler parameter (BZ
+378)
+- Minimum Length of RSDT should be validated (BZ 379)
+- AcpiRemoveNotifyHandler: return AE_NOT_EXIST if Processor Obj
+has no Handler (BZ (380)
+- AcpiUnloadTable: return AE_NOT_EXIST if no table of specified
+type loaded (BZ 381)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 80.5K Code, 17.8K Data, 98.3K Total
+ Debug Version: 160.8K Code, 64.8K Data, 225.6K Total
+ Current Release:
+ Non-Debug Version: 80.7K Code, 17.9K Data, 98.6K Total
+ Debug Version: 161.0K Code, 65.1K Data, 226.1K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Fixed problem reports:
+Compiler segfault when ASL contains a long (>1024) String
+declaration (BZ 436)
+
+----------------------------------------
+23 June 2006. Summary of changes for version 20060623:
+
+1) ACPI CA Core Subsystem:
+
+Implemented a new ACPI_SPINLOCK type for the OSL lock interfaces.
+This allows the type to be customized to the host OS for improved
+efficiency (since a spinlock is usually a very small object.)
+
+Implemented support for "ignored" bits in the ACPI registers.
+According to the ACPI specification, these bits should be
+preserved when writing the registers via a read/modify/write
+cycle. There are 3 bits preserved in this manner: PM1_CONTROL[0]
+(SCI_EN), PM1_CONTROL[9], and PM1_STATUS[11].
+
+Implemented the initial deployment of new OSL mutex interfaces.
+Since some host operating systems have separate mutex and
+semaphore objects, this feature was requested. The base code now
+uses mutexes (and the new mutex interfaces) wherever a binary
+semaphore was used previously. However, for the current release,
+the mutex interfaces are defined as macros to map them to the
+existing semaphore interfaces. Therefore, no OSL changes are
+required at this time. (See acpiosxf.h)
+
+Fixed several problems with the support for the control method
+SyncLevel parameter. The SyncLevel now works according to the
+ACPI specification and in concert with the Mutex SyncLevel
+parameter, since the current SyncLevel is a property of the
+executing thread. Mutual exclusion for control methods is now
+implemented with a mutex instead of a semaphore.
+
+Fixed three instances of the use of the C shift operator in the
+bitfield support code (exfldio.c) to avoid the use of a shift
+value larger than the target data width. The behavior of C
+compilers is undefined in this case and can cause unpredictable
+results, and therefore the case must be detected and avoided.
+(Fiodor Suietov)
+
+Added an info message whenever an SSDT or OEM table is loaded
+dynamically via the Load() or LoadTable() ASL operators. This
+should improve debugging capability since it will show exactly
+what tables have been loaded (beyond the tables present in the
+RSDT/XSDT.)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 80.0K Code, 17.6K Data, 97.6K Total
+ Debug Version: 160.2K Code, 64.7K Data, 224.9K Total
+ Current Release:
+ Non-Debug Version: 80.5K Code, 17.8K Data, 98.3K Total
+ Debug Version: 160.8K Code, 64.8K Data, 225.6K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+No changes for this release.
+
+----------------------------------------
+08 June 2006. Summary of changes for version 20060608:
+
+1) ACPI CA Core Subsystem:
+
+Converted the locking mutex used for the ACPI hardware to a
+spinlock. This change should eliminate all problems caused by
+attempting to acquire a semaphore at interrupt level, and it
+means that all ACPICA external interfaces that directly access
+the ACPI hardware can be safely called from interrupt level. OSL
+code that implements the semaphore interfaces should be able to
+eliminate any workarounds for being called at interrupt level.
+
+Fixed a regression introduced in 20060526 where the ACPI device
+initialization could be prematurely aborted with an AE_NOT_FOUND
+if a device did not have an optional _INI method.
+
+Fixed an IndexField issue where a write to the Data Register
+should be limited in size to the AccessSize (width) of the
+IndexField itself. (BZ 433, Fiodor Suietov)
+
+Fixed problem reports (Valery Podrezov) integrated:
+- Allow store of ThermalZone objects to Debug object (BZ
+5369/5370)
+
+Fixed problem reports (Fiodor Suietov) integrated:
+- AcpiGetTableHeader doesn't handle multiple instances correctly
+(BZ 364)
+
+Removed four global mutexes that were obsolete and were no longer
+being used.
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 80.0K Code, 17.7K Data, 97.7K Total
+ Debug Version: 160.3K Code, 64.9K Data, 225.2K Total
+ Current Release:
+ Non-Debug Version: 80.0K Code, 17.6K Data, 97.6K Total
+ Debug Version: 160.2K Code, 64.7K Data, 224.9K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Fixed a fault when using -g option (get tables from registry) on
+Windows machines.
+
+Fixed problem reports integrated:
+- Generate error if CreateField NumBits parameter is zero. (BZ
+405)
+- Fault if Offset/Length in Field unit is very large (BZ 432,
+Fiodor Suietov)
+- Global table revision override (-r) is ignored (BZ 413)
+
+----------------------------------------
+26 May 2006. Summary of changes for version 20060526:
+
+1) ACPI CA Core Subsystem:
+
+Restructured, flattened, and simplified the internal interfaces
+for namespace object evaluation - resulting in smaller code, less
+CPU stack use, and fewer interfaces. (With assistance from
+Mikhail Kouzmich)
+
+Fixed a problem with the CopyObject operator where the first
+parameter was not typed correctly for the parser, interpreter,
+compiler, and disassembler. Caused various errors and unexpected
+behavior.
+
+Fixed a problem where a ShiftLeft or ShiftRight of more than 64
+bits produced incorrect results with some C compilers. Since the
+behavior of C compilers when the shift value is larger than the
+datatype width is apparently not well defined, the interpreter
+now detects this condition and simply returns zero as expected in
+all such cases. (BZ 395)
+
+Fixed problem reports (Valery Podrezov) integrated:
+- Update String-to-Integer conversion to match ACPI 3.0A spec (BZ
+5329)
+- Allow interpreter to handle nested method declarations (BZ
+5361)
+
+Fixed problem reports (Fiodor Suietov) integrated:
+- AcpiTerminate doesn't free debug memory allocation list objects
+(BZ 355)
+- After Core Subsystem shutdown, AcpiSubsystemStatus returns
+AE_OK (BZ 356)
+- AcpiOsUnmapMemory for RSDP can be invoked inconsistently (BZ
+357)
+- Resource Manager should return AE_TYPE for non-device objects
+(BZ 358)
+- Incomplete cleanup branch in AcpiNsEvaluateRelative (BZ 359)
+- Use AcpiOsFree instead of ACPI_FREE in AcpiRsSetSrsMethodData
+(BZ 360)
+- Incomplete cleanup branch in AcpiPsParseAml (BZ 361)
+- Incomplete cleanup branch in AcpiDsDeleteWalkState (BZ 362)
+- AcpiGetTableHeader returns AE_NO_ACPI_TABLES until DSDT is
+loaded (BZ 365)
+- Status of the Global Initialization Handler call not used (BZ
+366)
+- Incorrect object parameter to Global Initialization Handler (BZ
+367)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 79.8K Code, 17.7K Data, 97.5K Total
+ Debug Version: 160.5K Code, 65.1K Data, 225.6K Total
+ Current Release:
+ Non-Debug Version: 80.0K Code, 17.7K Data, 97.7K Total
+ Debug Version: 160.3K Code, 64.9K Data, 225.2K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Modified the parser to allow the names IO, DMA, and IRQ to be
+used as namespace identifiers with no collision with existing
+resource descriptor macro names. This provides compatibility with
+other ASL compilers and is most useful for
+disassembly/recompilation of existing tables without parse
+errors. (With assistance from Thomas Renninger)
+
+Disassembler: fixed an incorrect disassembly problem with the
+DataTableRegion and CopyObject operators. Fixed a possible fault
+during disassembly of some Alias operators.
+
+----------------------------------------
+12 May 2006. Summary of changes for version 20060512:
+
+1) ACPI CA Core Subsystem:
+
+Replaced the AcpiOsQueueForExecution interface with a new
+interface named AcpiOsExecute. The major difference is that the
+new interface does not have a Priority parameter, this appeared
+to be useless and has been replaced by a Type parameter. The Type
+tells the host what type of execution is being requested, such as
+global lock handler, notify handler, GPE handler, etc. This
+allows the host to queue and execute the request as appropriate
+for the request type, possibly using different work queues and
+different priorities for the various request types. This enables
+fixes for multithreading deadlock problems such as BZ #5534, and
+will require changes to all existing OS interface layers. (Alexey
+Starikovskiy and Bob Moore)
+
+Fixed a possible memory leak associated with the support for the
+so-called "implicit return" ACPI extension. Reported by FreeBSD,
+BZ #6514. (Fiodor Suietov)
+
+Fixed a problem with the Load() operator where a table load from
+an operation region could overwrite an internal table buffer by
+up to 7 bytes and cause alignment faults on IPF systems. (With
+assistance from Luming Yu)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 79.7K Code, 17.7K Data, 97.4K Total
+ Debug Version: 160.1K Code, 65.2K Data, 225.3K Total
+ Current Release:
+ Non-Debug Version: 79.8K Code, 17.7K Data, 97.5K Total
+ Debug Version: 160.5K Code, 65.1K Data, 225.6K Total
+
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Implemented support to cross reference the internal
+namespace and automatically generate ASL External() statements
+for symbols not defined within the current table being
+disassembled. This will simplify the disassembly and
+recompilation of interdependent tables such as SSDTs since these
+statements will no longer have to be added manually.
+
+Disassembler: Implemented experimental support to automatically
+detect invocations of external control methods and generate
+appropriate External() statements. This is problematic because
+the AML cannot be correctly parsed until the number of arguments
+for each control method is known. Currently, standalone method
+invocations and invocations as the source operand of a Store()
+statement are supported.
+
+Disassembler: Implemented support for the ASL pseudo-operators
+LNotEqual, LLessEqual, and LGreaterEqual. Previously disassembled
+as LNot(LEqual()), LNot(LGreater()), and LNot(LLess()), this
+makes the disassembled ASL code more readable and likely closer
+to the original ASL source.
+
+----------------------------------------
+21 April 2006. Summary of changes for version 20060421:
+
+1) ACPI CA Core Subsystem:
+
+Removed a device initialization optimization introduced in
+20051216 where the _STA method was not run unless an _INI was
+also present for the same device. This optimization could cause
+problems because it could allow _INI methods to be run within a
+not-present device subtree. (If a not-present device had no _INI,
+_STA would not be run, the not-present status would not be
+discovered, and the children of the device would be incorrectly
+traversed.)
+
+Implemented a new _STA optimization where namespace subtrees that
+do not contain _INI are identified and ignored during device
+initialization. Selectively running _STA can significantly
+improve boot time on large machines (with assistance from Len
+Brown.)
+
+Implemented support for the device initialization case where the
+returned _STA flags indicate a device not-present but
+functioning. In this case, _INI is not run, but the device
+children are examined for presence, as per the ACPI
+specification.
+
+Implemented an additional change to the IndexField support in
+order to conform to MS behavior. The value written to the Index
+Register is not simply a byte offset, it is a byte offset in
+units of the access width of the parent Index Field. (Fiodor
+Suietov)
+
+Defined and deployed a new OSL interface, AcpiOsValidateAddress.
+This interface is called during the creation of all AML operation
+regions, and allows the host OS to exert control over what
+addresses it will allow the AML code to access. Operation Regions
+whose addresses are disallowed will cause a runtime exception
+when they are actually accessed (will not affect or abort table
+loading.) See oswinxf or osunixxf for an example implementation.
+
+Defined and deployed a new OSL interface,
+AcpiOsValidateInterface. This interface allows the host OS to
+match the various "optional" interface/behavior strings for the
+_OSI predefined control method as appropriate (with assistance
+from Bjorn Helgaas.) See oswinxf or osunixxf for an example
+implementation.
+
+Restructured and corrected various problems in the exception
+handling code paths within DsCallControlMethod and
+DsTerminateControlMethod in dsmethod (with assistance from
+Takayoshi Kochi.)
+
+Modified the Linux source converter to ignore quoted string
+literals while converting identifiers from mixed to lower case.
+This will correct problems with the disassembler and other areas
+where such strings must not be modified.
+
+The ACPI_FUNCTION_* macros no longer require quotes around the
+function name. This allows the Linux source converter to convert
+the names, now that the converter ignores quoted strings.
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+
+ Non-Debug Version: 81.1K Code, 17.7K Data, 98.8K Total
+ Debug Version: 158.9K Code, 64.9K Data, 223.8K Total
+ Current Release:
+ Non-Debug Version: 79.7K Code, 17.7K Data, 97.4K Total
+ Debug Version: 160.1K Code, 65.2K Data, 225.3K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Implemented 3 new warnings for iASL, and implemented multiple
+warning levels (w2 flag).
+
+1) Ignored timeouts: If the TimeoutValue parameter to Wait or
+Acquire is not WAIT_FOREVER (0xFFFF) and the code does not
+examine the return value to check for the possible timeout, a
+warning is issued.
+
+2) Useless operators: If an ASL operator does not specify an
+optional target operand and it also does not use the function
+return value from the operator, a warning is issued since the
+operator effectively does nothing.
+
+3) Unreferenced objects: If a namespace object is created, but
+never referenced, a warning is issued. This is a warning level 2
+since there are cases where this is ok, such as when a secondary
+table is loaded that uses the unreferenced objects. Even so, care
+is taken to only flag objects that don't look like they will ever
+be used. For example, the reserved methods (starting with an
+underscore) are usually not referenced because it is expected
+that the OS will invoke them.
+
+----------------------------------------
+31 March 2006. Summary of changes for version 20060331:
+
+1) ACPI CA Core Subsystem:
+
+Implemented header file support for the following additional ACPI
+tables: ASF!, BOOT, CPEP, DBGP, MCFG, SPCR, SPMI, TCPA, and WDRT.
+With this support, all current and known ACPI tables are now
+defined in the ACPICA headers and are available for use by device
+drivers and other software.
+
+Implemented support to allow tables that contain ACPI names with
+invalid characters to be loaded. Previously, this would cause the
+table load to fail, but since there are several known cases of
+such tables on existing machines, this change was made to enable
+ACPI support for them. Also, this matches the behavior of the
+Microsoft ACPI implementation.
+
+Fixed a couple regressions introduced during the memory
+optimization in the 20060317 release. The namespace node
+definition required additional reorganization and an internal
+datatype that had been changed to 8-bit was restored to 32-bit.
+(Valery Podrezov)
+
+Fixed a problem where a null pointer passed to
+AcpiUtDeleteGenericState could be passed through to
+AcpiOsReleaseObject which is unexpected. Such null pointers are
+now trapped and ignored, matching the behavior of the previous
+implementation before the deployment of AcpiOsReleaseObject.
+(Valery Podrezov, Fiodor Suietov)
+
+Fixed a memory mapping leak during the deletion of a SystemMemory
+operation region where a cached memory mapping was not deleted.
+This became a noticeable problem for operation regions that are
+defined within frequently used control methods. (Dana Meyers)
+
+Reorganized the ACPI table header files into two main files: one
+for the ACPI tables consumed by the ACPICA core, and another for
+the miscellaneous ACPI tables that are consumed by the drivers
+and other software. The various FADT definitions were merged into
+one common section and three different tables (ACPI 1.0, 1.0+,
+and 2.0)
+
+Example Code and Data Size: These are the sizes for the OS-
+independent acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+
+ Previous Release:
+ Non-Debug Version: 80.9K Code, 17.7K Data, 98.6K Total
+ Debug Version: 158.7K Code, 64.8K Data, 223.5K Total
+ Current Release:
+ Non-Debug Version: 81.1K Code, 17.7K Data, 98.8K Total
+ Debug Version: 158.9K Code, 64.9K Data, 223.8K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Disassembler: Implemented support to decode and format all non-
+AML ACPI tables (tables other than DSDTs and SSDTs.) This
+includes the new tables added to the ACPICA headers, therefore
+all current and known ACPI tables are supported.
+
+Disassembler: The change to allow ACPI names with invalid
+characters also enables the disassembly of such tables. Invalid
+characters within names are changed to '*' to make the name
+printable; the iASL compiler will still generate an error for
+such names, however, since this is an invalid ACPI character.
+
+Implemented an option for AcpiXtract (-a) to extract all tables
+found in the input file. The default invocation extracts only the
+DSDTs and SSDTs.
+
+Fixed a couple of gcc generation issues for iASL and AcpiExec and
+added a makefile for the AcpiXtract utility.
+
+----------------------------------------
+17 March 2006. Summary of changes for version 20060317:
+
+1) ACPI CA Core Subsystem:
+
+Implemented the use of a cache object for all internal namespace
+nodes. Since there are about 1000 static nodes in a typical
+system, this will decrease memory use for cache implementations
+that minimize per-allocation overhead (such as a slab allocator.)
+
+Removed the reference count mechanism for internal namespace
+nodes, since it was deemed unnecessary. This reduces the size of
+each namespace node by about 5%-10% on all platforms. Nodes are
+now 20 bytes for the 32-bit case, and 32 bytes for the 64-bit
+case.
+
+Optimized several internal data structures to reduce object size
+on 64-bit platforms by packing data within the 64-bit alignment.
+This includes the frequently used ACPI_OPERAND_OBJECT, of which
+there can be ~1000 static instances corresponding to the
+namespace objects.
+
+Added two new strings for the predefined _OSI method: "Windows
+2001.1 SP1" and "Windows 2006".
+
+Split the allocation tracking mechanism out to a separate file,
+from utalloc.c to uttrack.c. This mechanism appears to be only
+useful for application-level code. Kernels may wish to not
+include uttrack.c in distributions.
+
+Removed all remnants of the obsolete ACPI_REPORT_* macros and the
+associated code. (These macros have been replaced by the
+ACPI_ERROR and ACPI_WARNING macros.)
+
+Code and Data Size: These are the sizes for the acpica.lib
+produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
+values do not include any ACPI driver or OSPM code. The debug
+version of the code includes the debug output trace mechanism and
+has a much larger code and data size. Note that these values will
+vary depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total
+ Debug Version: 161.6K Code, 65.7K Data, 227.3K Total
+ Current Release:
+ Non-Debug Version: 80.9K Code, 17.7K Data, 98.6K Total
+ Debug Version: 158.7K Code, 64.8K Data, 223.5K Total
+
+
+2) iASL Compiler/Disassembler and Tools:
+
+Implemented an ANSI C version of the acpixtract utility. This
+version will automatically extract the DSDT and all SSDTs from
+the input acpidump text file and dump the binary output to
+separate files. It can also display a summary of the input file
+including the headers for each table found and will extract any
+single ACPI table, with any signature. (See
+source/tools/acpixtract)
+
+----------------------------------------
+10 March 2006. Summary of changes for version 20060310:
+
+1) ACPI CA Core Subsystem:
+
+Tagged all external interfaces to the subsystem with the new
+ACPI_EXPORT_SYMBOL macro. This macro can be defined as necessary
+to assist kernel integration. For Linux, the macro resolves to
+the EXPORT_SYMBOL macro. The default definition is NULL.
+
+Added the ACPI_THREAD_ID type for the return value from
+AcpiOsGetThreadId. This allows the host to define this as
+necessary to simplify kernel integration. The default definition
+is ACPI_NATIVE_UINT.
+
+Fixed two interpreter problems related to error processing, the
+deletion of objects, and placing invalid pointers onto the
+internal operator result stack. BZ 6028, 6151 (Valery Podrezov)
+
+Increased the reference count threshold where a warning is
+emitted for large reference counts in order to eliminate
+unnecessary warnings on systems with large namespaces (especially
+64-bit.) Increased the value from 0x400 to 0x800.
+
+Due to universal disagreement as to the meaning of the 'c' in the
+calloc() function, the ACPI_MEM_CALLOCATE macro has been renamed
+to ACPI_ALLOCATE_ZEROED so that the purpose of the interface is
+'clear'. ACPI_MEM_ALLOCATE and ACPI_MEM_FREE are renamed to
+ACPI_ALLOCATE and ACPI_FREE.
+
+Code and Data Size: These are the sizes for the acpica.lib
+produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
+values do not include any ACPI driver or OSPM code. The debug
+version of the code includes the debug output trace mechanism and
+has a much larger code and data size. Note that these values will
+vary depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 81.0K Code, 17.8K Data, 98.8K Total
+ Debug Version: 161.4K Code, 65.7K Data, 227.1K Total
+ Current Release:
+ Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total
+ Debug Version: 161.6K Code, 65.7K Data, 227.3K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Disassembler: implemented support for symbolic resource
+descriptor references. If a CreateXxxxField operator references a
+fixed offset within a resource descriptor, a name is assigned to
+the descriptor and the offset is translated to the appropriate
+resource tag and pathname. The addition of this support brings
+the disassembled code very close to the original ASL source code
+and helps eliminate run-time errors when the disassembled code is
+modified (and recompiled) in such a way as to invalidate the
+original fixed offsets.
+
+Implemented support for a Descriptor Name as the last parameter
+to the ASL Register() macro. This parameter was inadvertently
+left out of the ACPI specification, and will be added for ACPI
+3.0b.
+
+Fixed a problem where the use of the "_OSI" string (versus the
+full path "\_OSI") caused an internal compiler error. ("No back
+ptr to op")
+
+Fixed a problem with the error message that occurs when an
+invalid string is used for a _HID object (such as one with an
+embedded asterisk: "*PNP010A".) The correct message is now
+displayed.
+
+----------------------------------------
+17 February 2006. Summary of changes for version 20060217:
+
+1) ACPI CA Core Subsystem:
+
+Implemented a change to the IndexField support to match the
+behavior of the Microsoft AML interpreter. The value written to
+the Index register is now a byte offset, no longer an index based
+upon the width of the Data register. This should fix IndexField
+problems seen on some machines where the Data register is not
+exactly one byte wide. The ACPI specification will be clarified
+on this point.
+
+Fixed a problem where several resource descriptor types could
+overrun the internal descriptor buffer due to size
+miscalculation: VendorShort, VendorLong, and Interrupt. This was
+noticed on IA64 machines, but could affect all platforms.
+
+Fixed a problem where individual resource descriptors were
+misaligned within the internal buffer, causing alignment faults
+on IA64 platforms.
+
+Code and Data Size: These are the sizes for the acpica.lib
+produced by the Microsoft Visual C++ 6.0 32-bit compiler. The
+values do not include any ACPI driver or OSPM code. The debug
+version of the code includes the debug output trace mechanism and
+has a much larger code and data size. Note that these values will
+vary depending on the efficiency of the compiler and the compiler
+options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total
+ Debug Version: 161.3K Code, 65.6K Data, 226.9K Total
+ Current Release:
+ Non-Debug Version: 81.0K Code, 17.8K Data, 98.8K Total
+ Debug Version: 161.4K Code, 65.7K Data, 227.1K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Implemented support for new reserved names: _WDG and _WED are
+Microsoft extensions for Windows Instrumentation Management, _TDL
+is a new ACPI-defined method (Throttling Depth Limit.)
+
+Fixed a problem where a zero-length VendorShort or VendorLong
+resource descriptor was incorrectly emitted as a descriptor of
+length one.
+
+----------------------------------------
+10 February 2006. Summary of changes for version 20060210:
+
+1) ACPI CA Core Subsystem:
+
+Removed a couple of extraneous ACPI_ERROR messages that appeared
+during normal execution. These became apparent after the
+conversion from ACPI_DEBUG_PRINT.
+
+Fixed a problem where the CreateField operator could hang if the
+BitIndex or NumBits parameter referred to a named object. (Valery
+Podrezov, BZ 5359)
+
+Fixed a problem where a DeRefOf operation on a buffer object
+incorrectly failed with an exception. This also fixes a couple of
+related RefOf and DeRefOf issues. (Valery Podrezov, BZ
+5360/5392/5387)
+
+Fixed a problem where the AE_BUFFER_LIMIT exception was returned
+instead of AE_STRING_LIMIT on an out-of-bounds Index() operation.
+(Valery Podrezov, BZ 5480)
+
+Implemented a memory cleanup at the end of the execution of each
+iteration of an AML While() loop, preventing the accumulation of
+outstanding objects. (Valery Podrezov, BZ 5427)
+
+Eliminated a chunk of duplicate code in the object resolution
+code. (Valery Podrezov, BZ 5336)
+
+Fixed several warnings during the 64-bit code generation.
+
+The AcpiSrc source code conversion tool now inserts one line of
+whitespace after an if() statement that is followed immediately
+by a comment, improving readability of the Linux code.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 81.0K Code, 17.9K Data, 98.9K Total
+ Debug Version: 161.3K Code, 65.7K Data, 227.0K Total
+ Current Release:
+ Non-Debug Version: 81.1K Code, 17.8K Data, 98.9K Total
+ Debug Version: 161.3K Code, 65.6K Data, 226.9K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a problem with the disassembly of a BankField operator with
+a complex expression for the BankValue parameter.
+
+----------------------------------------
+27 January 2006. Summary of changes for version 20060127:
+
+1) ACPI CA Core Subsystem:
+
+Implemented support in the Resource Manager to allow unresolved
+namestring references within resource package objects for the
+_PRT method. This support is in addition to the previously
+implemented unresolved reference support within the AML parser.
+If the interpreter slack mode is enabled, these unresolved
+references will be passed through to the caller as a NULL package
+entry.
+
+Implemented and deployed new macros and functions for error and
+warning messages across the subsystem. These macros are simpler
+and generate less code than their predecessors. The new macros
+ACPI_ERROR, ACPI_EXCEPTION, ACPI_WARNING, and ACPI_INFO replace
+the ACPI_REPORT_* macros. The older macros remain defined to
+allow ACPI drivers time to migrate to the new macros.
+
+Implemented the ACPI_CPU_FLAGS type to simplify host OS
+integration of the Acquire/Release Lock OSL interfaces.
+
+Fixed a problem where Alias ASL operators are sometimes not
+correctly resolved, in both the interpreter and the iASL
+compiler.
+
+Fixed several problems with the implementation of the
+ConcatenateResTemplate ASL operator. As per the ACPI
+specification, zero length buffers are now treated as a single
+EndTag. One-length buffers always cause a fatal exception. Non-
+zero length buffers that do not end with a full 2-byte EndTag
+cause a fatal exception.
+
+Fixed a possible structure overwrite in the AcpiGetObjectInfo
+external interface. (With assistance from Thomas Renninger)
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 83.1K Code, 18.4K Data, 101.5K Total
+ Debug Version: 163.2K Code, 66.2K Data, 229.4K Total
+ Current Release:
+ Non-Debug Version: 81.0K Code, 17.9K Data, 98.9K Total
+ Debug Version: 161.3K Code, 65.7K Data, 227.0K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed an internal error that was generated for any forward
+references to ASL Alias objects.
+
+----------------------------------------
+13 January 2006. Summary of changes for version 20060113:
+
+1) ACPI CA Core Subsystem:
+
+Added 2006 copyright to all module headers and signons. This
+affects virtually every file in the ACPICA core subsystem, iASL
+compiler, and the utilities.
+
+Enhanced the ACPICA error reporting in order to simplify user
+migration to the non-debug version of ACPICA. Replaced all
+instances of the ACPI_DEBUG_PRINT macro invoked at the
+ACPI_DB_ERROR and ACPI_DB_WARN debug levels with the
+ACPI_REPORT_ERROR and ACPI_REPORT_WARNING macros, respectively.
+This preserves all error and warning messages in the non-debug
+version of the ACPICA code (this has been referred to as the
+"debug lite" option.) Over 200 cases were converted to create a
+total of over 380 error/warning messages across the ACPICA code.
+This increases the code and data size of the default non-debug
+version of the code somewhat (about 13K), but all error/warning
+reporting may be disabled if desired (and code eliminated) by
+specifying the ACPI_NO_ERROR_MESSAGES compile-time configuration
+option. The size of the debug version of ACPICA remains about the
+same.
+
+Fixed a memory leak within the AML Debugger "Set" command. One
+object was not properly deleted for every successful invocation
+of the command.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 76.6K Code, 12.3K Data, 88.9K Total
+ Debug Version: 163.7K Code, 67.5K Data, 231.2K Total
+ Current Release:
+ Non-Debug Version: 83.1K Code, 18.4K Data, 101.5K Total
+ Debug Version: 163.2K Code, 66.2K Data, 229.4K Total
+
+
+2) iASL Compiler/Disassembler:
+
+The compiler now officially supports the ACPI 3.0a specification
+that was released on December 30, 2005. (Specification is
+available at www.acpi.info)
+
+----------------------------------------
+16 December 2005. Summary of changes for version 20051216:
+
+1) ACPI CA Core Subsystem:
+
+Implemented optional support to allow unresolved names within ASL
+Package objects. A null object is inserted in the package when a
+named reference cannot be located in the current namespace.
+Enabled via the interpreter slack flag, this should eliminate
+AE_NOT_FOUND exceptions seen on machines that contain such code.
+
+Implemented an optimization to the initialization sequence that
+can improve boot time. During ACPI device initialization, the
+_STA method is now run if and only if the _INI method exists. The
+_STA method is used to determine if the device is present; An
+_INI can only be run if _STA returns present, but it is a waste
+of time to run the _STA method if the _INI does not exist.
+(Prototype and assistance from Dong Wei)
+
+Implemented use of the C99 uintptr_t for the pointer casting
+macros if it is available in the current compiler. Otherwise, the
+default (void *) cast is used as before.
+
+Fixed some possible memory leaks found within the execution path
+of the Break, Continue, If, and CreateField operators. (Valery
+Podrezov)
+
+Fixed a problem introduced in the 20051202 release where an
+exception is generated during method execution if a control
+method attempts to declare another method.
+
+Moved resource descriptor string constants that are used by both
+the AML disassembler and AML debugger to the common utilities
+directory so that these components are independent.
+
+Implemented support in the AcpiExec utility (-e switch) to
+globally ignore exceptions during control method execution
+(method is not aborted.)
+
+Added the rsinfo.c source file to the AcpiExec makefile for
+Linux/Unix generation.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total
+ Debug Version: 163.2K Code, 67.4K Data, 230.6K Total
+ Current Release:
+ Non-Debug Version: 76.6K Code, 12.3K Data, 88.9K Total
+ Debug Version: 163.7K Code, 67.5K Data, 231.2K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a problem where a CPU stack overflow fault could occur if a
+recursive method call was made from within a Return statement.
+
+----------------------------------------
+02 December 2005. Summary of changes for version 20051202:
+
+1) ACPI CA Core Subsystem:
+
+Modified the parsing of control methods to no longer create
+namespace objects during the first pass of the parse. Objects are
+now created only during the execute phase, at the moment the
+namespace creation operator is encountered in the AML (Name,
+OperationRegion, CreateByteField, etc.) This should eliminate
+ALREADY_EXISTS exceptions seen on some machines where reentrant
+control methods are protected by an AML mutex. The mutex will now
+correctly block multiple threads from attempting to create the
+same object more than once.
+
+Increased the number of available Owner Ids for namespace object
+tracking from 32 to 255. This should eliminate the OWNER_ID_LIMIT
+exceptions seen on some machines with a large number of ACPI
+tables (either static or dynamic).
+
+Fixed a problem with the AcpiExec utility where a fault could
+occur when the -b switch (batch mode) is used.
+
+Enhanced the namespace dump routine to output the owner ID for
+each namespace object.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total
+ Debug Version: 163.0K Code, 67.4K Data, 230.4K Total
+ Current Release:
+ Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total
+ Debug Version: 163.2K Code, 67.4K Data, 230.6K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a parse error during compilation of certain Switch/Case
+constructs. To simplify the parse, the grammar now allows for
+multiple Default statements and this error is now detected and
+flagged during the analysis phase.
+
+Disassembler: The disassembly now includes the contents of the
+original table header within a comment at the start of the file.
+This includes the name and version of the original ASL compiler.
+
+----------------------------------------
+17 November 2005. Summary of changes for version 20051117:
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem in the AML parser where the method thread count
+could be decremented below zero if any errors occurred during the
+method parse phase. This should eliminate AE_AML_METHOD_LIMIT
+exceptions seen on some machines. This also fixed a related
+regression with the mechanism that detects and corrects methods
+that cannot properly handle reentrancy (related to the deployment
+of the new OwnerId mechanism.)
+
+Eliminated the pre-parsing of control methods (to detect errors)
+during table load. Related to the problem above, this was causing
+unwind issues if any errors occurred during the parse, and it
+seemed to be overkill. A table load should not be aborted if
+there are problems with any single control method, thus rendering
+this feature rather pointless.
+
+Fixed a problem with the new table-driven resource manager where
+an internal buffer overflow could occur for small resource
+templates.
+
+Implemented a new external interface, AcpiGetVendorResource. This
+interface will find and return a vendor-defined resource
+descriptor within a _CRS or _PRS method via an ACPI 3.0 UUID
+match. With assistance from Bjorn Helgaas.
+
+Removed the length limit (200) on string objects as per the
+upcoming ACPI 3.0A specification. This affects the following
+areas of the interpreter: 1) any implicit conversion of a Buffer
+to a String, 2) a String object result of the ASL Concatentate
+operator, 3) the String object result of the ASL ToString
+operator.
+
+Fixed a problem in the Windows OS interface layer (OSL) where a
+WAIT_FOREVER on a semaphore object would incorrectly timeout.
+This allows the multithreading features of the AcpiExec utility
+to work properly under Windows.
+
+Updated the Linux makefiles for the iASL compiler and AcpiExec to
+include the recently added file named "utresrc.c".
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 76.2K Code, 12.3K Data, 88.5K Total
+ Debug Version: 163.0K Code, 67.4K Data, 230.4K Total
+ Current Release:
+ Non-Debug Version: 76.3K Code, 12.3K Data, 88.6K Total
+ Debug Version: 163.0K Code, 67.4K Data, 230.4K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Removed the limit (200) on string objects as per the upcoming
+ACPI 3.0A specification. For the iASL compiler, this means that
+string literals within the source ASL can be of any length.
+
+Enhanced the listing output to dump the AML code for resource
+descriptors immediately after the ASL code for each descriptor,
+instead of in a block at the end of the entire resource template.
+
+Enhanced the compiler debug output to dump the entire original
+parse tree constructed during the parse phase, before any
+transforms are applied to the tree. The transformed tree is
+dumped also.
+
+----------------------------------------
+02 November 2005. Summary of changes for version 20051102:
+
+1) ACPI CA Core Subsystem:
+
+Modified the subsystem initialization sequence to improve GPE
+support. The GPE initialization has been split into two parts in
+order to defer execution of the _PRW methods (Power Resources for
+Wake) until after the hardware is fully initialized and the SCI
+handler is installed. This allows the _PRW methods to access
+fields protected by the Global Lock. This will fix systems where
+a NO_GLOBAL_LOCK exception has been seen during initialization.
+
+Converted the ACPI internal object disassemble and display code
+within the AML debugger to fully table-driven operation, reducing
+code size and increasing maintainability.
+
+Fixed a regression with the ConcatenateResTemplate() ASL operator
+introduced in the 20051021 release.
+
+Implemented support for "local" internal ACPI object types within
+the debugger "Object" command and the AcpiWalkNamespace external
+interfaces. These local types include RegionFields, BankFields,
+IndexFields, Alias, and reference objects.
+
+Moved common AML resource handling code into a new file,
+"utresrc.c". This code is shared by both the Resource Manager and
+the AML Debugger.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 76.1K Code, 12.2K Data, 88.3K Total
+ Debug Version: 163.5K Code, 67.0K Data, 230.5K Total
+ Current Release:
+ Non-Debug Version: 76.2K Code, 12.3K Data, 88.5K Total
+ Debug Version: 163.0K Code, 67.4K Data, 230.4K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a problem with very large initializer lists (more than 4000
+elements) for both Buffer and Package objects where the parse
+stack could overflow.
+
+Enhanced the pre-compile source code scan for non-ASCII
+characters to ignore characters within comment fields. The scan
+is now always performed and is no longer optional, detecting
+invalid characters within a source file immediately rather than
+during the parse phase or later.
+
+Enhanced the ASL grammar definition to force early reductions on
+all list-style grammar elements so that the overall parse stack
+usage is greatly reduced. This should improve performance and
+reduce the possibility of parse stack overflow.
+
+Eliminated all reduce/reduce conflicts in the iASL parser
+generation. Also, with the addition of a %expected statement, the
+compiler generates from source with no warnings.
+
+Fixed a possible segment fault in the disassembler if the input
+filename does not contain a "dot" extension (Thomas Renninger).
+
+----------------------------------------
+21 October 2005. Summary of changes for version 20051021:
+
+1) ACPI CA Core Subsystem:
+
+Implemented support for the EM64T and other x86-64 processors.
+This essentially entails recognizing that these processors
+support non-aligned memory transfers. Previously, all 64-bit
+processors were assumed to lack hardware support for non-aligned
+transfers.
+
+Completed conversion of the Resource Manager to nearly full table-
+driven operation. Specifically, the resource conversion code
+(convert AML to internal format and the reverse) and the debug
+code to dump internal resource descriptors are fully table-
+driven, reducing code and data size and improving
+maintainability.
+
+The OSL interfaces for Acquire and Release Lock now use a 64-bit
+flag word on 64-bit processors instead of a fixed 32-bit word.
+(With assistance from Alexey Starikovskiy)
+
+Implemented support within the resource conversion code for the
+Type-Specific byte within the various ACPI 3.0 *WordSpace macros.
+
+Fixed some issues within the resource conversion code for the
+type-specific flags for both Memory and I/O address resource
+descriptors. For Memory, implemented support for the MTP and TTP
+flags. For I/O, split the TRS and TTP flags into two separate
+fields.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 77.1K Code, 12.1K Data, 89.2K Total
+ Debug Version: 168.0K Code, 68.3K Data, 236.3K Total
+ Current Release:
+ Non-Debug Version: 76.1K Code, 12.2K Data, 88.3K Total
+ Debug Version: 163.5K Code, 67.0K Data, 230.5K Total
+
+
+
+2) iASL Compiler/Disassembler:
+
+Relaxed a compiler restriction that disallowed a ResourceIndex
+byte if the corresponding ResourceSource string was not also
+present in a resource descriptor declaration. This restriction
+caused problems with existing AML/ASL code that includes the
+Index byte without the string. When such AML was disassembled, it
+could not be compiled without modification. Further, the modified
+code created a resource template with a different size than the
+original, breaking code that used fixed offsets into the resource
+template buffer.
+
+Removed a recent feature of the disassembler to ignore a lone
+ResourceIndex byte. This byte is now emitted if present so that
+the exact AML can be reproduced when the disassembled code is
+recompiled.
+
+Improved comments and text alignment for the resource descriptor
+code emitted by the disassembler.
+
+Implemented disassembler support for the ACPI 3.0 AccessSize
+field within a Register() resource descriptor.
+
+----------------------------------------
+30 September 2005. Summary of changes for version 20050930:
+
+1) ACPI CA Core Subsystem:
+
+Completed a major overhaul of the Resource Manager code -
+specifically, optimizations in the area of the AML/internal
+resource conversion code. The code has been optimized to simplify
+and eliminate duplicated code, CPU stack use has been decreased
+by optimizing function parameters and local variables, and naming
+conventions across the manager have been standardized for clarity
+and ease of maintenance (this includes function, parameter,
+variable, and struct/typedef names.) The update may force changes
+in some driver code, depending on how resources are handled by
+the host OS.
+
+All Resource Manager dispatch and information tables have been
+moved to a single location for clarity and ease of maintenance.
+One new file was created, named "rsinfo.c".
+
+The ACPI return macros (return_ACPI_STATUS, etc.) have been
+modified to guarantee that the argument is not evaluated twice,
+making them less prone to macro side-effects. However, since
+there exists the possibility of additional stack use if a
+particular compiler cannot optimize them (such as in the debug
+generation case), the original macros are optionally available.
+Note that some invocations of the return_VALUE macro may now
+cause size mismatch warnings; the return_UINT8 and return_UINT32
+macros are provided to eliminate these. (From Randy Dunlap)
+
+Implemented a new mechanism to enable debug tracing for
+individual control methods. A new external interface,
+AcpiDebugTrace, is provided to enable this mechanism. The intent
+is to allow the host OS to easily enable and disable tracing for
+problematic control methods. This interface can be easily exposed
+to a user or debugger interface if desired. See the file
+psxface.c for details.
+
+AcpiUtCallocate will now return a valid pointer if a length of
+zero is specified - a length of one is used and a warning is
+issued. This matches the behavior of AcpiUtAllocate.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total
+ Debug Version: 168.1K Code, 68.4K Data, 236.5K Total
+ Current Release:
+ Non-Debug Version: 77.1K Code, 12.1K Data, 89.2K Total
+ Debug Version: 168.0K Code, 68.3K Data, 236.3K Total
+
+
+2) iASL Compiler/Disassembler:
+
+A remark is issued if the effective compile-time length of a
+package or buffer is zero. Previously, this was a warning.
+
+----------------------------------------
+16 September 2005. Summary of changes for version 20050916:
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem within the Resource Manager where support for the
+Generic Register descriptor was not fully implemented. This
+descriptor is now fully recognized, parsed, disassembled, and
+displayed.
+
+Completely restructured the Resource Manager code to utilize
+table-driven dispatch and lookup, eliminating many of the large
+switch() statements. This reduces overall subsystem code size and
+code complexity. Affects the resource parsing and construction,
+disassembly, and debug dump output.
+
+Cleaned up and restructured the debug dump output for all
+resource descriptors. Improved readability of the output and
+reduced code size.
+
+Fixed a problem where changes to internal data structures caused
+the optional ACPI_MUTEX_DEBUG code to fail compilation if
+specified.
+
+Code and Data Size: The current and previous library sizes for
+the core subsystem are shown below. These are the code and data
+sizes for the acpica.lib produced by the Microsoft Visual C++ 6.0
+32-bit compiler. These values do not include any ACPI driver or
+OSPM code. The debug version of the code includes the debug
+output trace mechanism and has a much larger code and data size.
+Note that these values will vary depending on the efficiency of
+the compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total
+ Debug Version: 169.6K Code, 69.9K Data, 239.5K Total
+ Current Release:
+ Non-Debug Version: 77.5K Code, 12.0K Data, 89.5K Total
+ Debug Version: 168.1K Code, 68.4K Data, 236.5K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Updated the disassembler to automatically insert an
+EndDependentFn() macro into the ASL stream if this macro is
+missing in the original AML code, simplifying compilation of the
+resulting ASL module.
+
+Fixed a problem in the disassembler where a disassembled
+ResourceSource string (within a large resource descriptor) was
+not surrounded by quotes and not followed by a comma, causing
+errors when the resulting ASL module was compiled. Also, escape
+sequences within a ResourceSource string are now handled
+correctly (especially "\\")
+
+----------------------------------------
+02 September 2005. Summary of changes for version 20050902:
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem with the internal Owner ID allocation and
+deallocation mechanisms for control method execution and
+recursive method invocation. This should eliminate the
+OWNER_ID_LIMIT exceptions and "Invalid OwnerId" messages seen on
+some systems. Recursive method invocation depth is currently
+limited to 255. (Alexey Starikovskiy)
+
+Completely eliminated all vestiges of support for the "module-
+level executable code" until this support is fully implemented
+and debugged. This should eliminate the NO_RETURN_VALUE
+exceptions seen during table load on some systems that invoke
+this support.
+
+Fixed a problem within the resource manager code where the
+transaction flags for a 64-bit address descriptor were handled
+incorrectly in the type-specific flag byte.
+
+Consolidated duplicate code within the address descriptor
+resource manager code, reducing overall subsystem code size.
+
+Fixed a fault when using the AML debugger "disassemble" command
+to disassemble individual control methods.
+
+Removed references to the "release_current" directory within the
+Unix release package.
+
+Code and Data Size: The current and previous core subsystem
+library sizes are shown below. These are the code and data sizes
+for the acpica.lib produced by the Microsoft Visual C++ 6.0
+compiler. These values do not include any ACPI driver or OSPM
+code. The debug version of the code includes the debug output
+trace mechanism and has a much larger code and data size. Note
+that these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total
+ Debug Version: 170.0K Code, 69.9K Data, 239.9K Total
+ Current Release:
+ Non-Debug Version: 78.4K Code, 11.8K Data, 90.2K Total
+ Debug Version: 169.6K Code, 69.9K Data, 239.5K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Implemented an error check for illegal duplicate values in the
+interrupt and dma lists for the following ASL macros: Dma(),
+Irq(), IrqNoFlags(), and Interrupt().
+
+Implemented error checking for the Irq() and IrqNoFlags() macros
+to detect too many values in the interrupt list (16 max) and
+invalid values in the list (range 0 - 15)
+
+The maximum length string literal within an ASL file is now
+restricted to 200 characters as per the ACPI specification.
+
+Fixed a fault when using the -ln option (generate namespace
+listing).
+
+Implemented an error check to determine if a DescriptorName
+within a resource descriptor has already been used within the
+current scope.
+
+----------------------------------------
+15 August 2005. Summary of changes for version 20050815:
+
+1) ACPI CA Core Subsystem:
+
+Implemented a full bytewise compare to determine if a table load
+request is attempting to load a duplicate table. The compare is
+performed if the table signatures and table lengths match. This
+will allow different tables with the same OEM Table ID and
+revision to be loaded - probably against the ACPI specification,
+but discovered in the field nonetheless.
+
+Added the changes.txt logfile to each of the zipped release
+packages.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total
+ Debug Version: 167.0K Code, 69.9K Data, 236.9K Total
+ Current Release:
+ Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total
+ Debug Version: 170.0K Code, 69.9K Data, 239.9K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a problem where incorrect AML code could be generated for
+Package objects if optimization is disabled (via the -oa switch).
+
+Fixed a problem with where incorrect AML code is generated for
+variable-length packages when the package length is not specified
+and the number of initializer values is greater than 255.
+
+
+----------------------------------------
+29 July 2005. Summary of changes for version 20050729:
+
+1) ACPI CA Core Subsystem:
+
+Implemented support to ignore an attempt to install/load a
+particular ACPI table more than once. Apparently there exists
+BIOS code that repeatedly attempts to load the same SSDT upon
+certain events. With assistance from Venkatesh Pallipadi.
+
+Restructured the main interface to the AML parser in order to
+correctly handle all exceptional conditions. This will prevent
+leakage of the OwnerId resource and should eliminate the
+AE_OWNER_ID_LIMIT exceptions seen on some machines. With
+assistance from Alexey Starikovskiy.
+
+Support for "module level code" has been disabled in this version
+due to a number of issues that have appeared on various machines.
+The support can be enabled by defining
+ACPI_ENABLE_MODULE_LEVEL_CODE during subsystem compilation. When
+the issues are fully resolved, the code will be enabled by
+default again.
+
+Modified the internal functions for debug print support to define
+the FunctionName parameter as a (const char *) for compatibility
+with compiler built-in macros such as __FUNCTION__, etc.
+
+Linted the entire ACPICA source tree for both 32-bit and 64-bit.
+
+Implemented support to display an object count summary for the
+AML Debugger commands Object and Methods.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total
+ Debug Version: 170.0K Code, 69.7K Data, 239.7K Total
+ Current Release:
+ Non-Debug Version: 78.6K Code, 11.7K Data, 90.3K Total
+ Debug Version: 167.0K Code, 69.9K Data, 236.9K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a regression that appeared in the 20050708 version of the
+compiler where an error message was inadvertently emitted for
+invocations of the _OSI reserved control method.
+
+----------------------------------------
+08 July 2005. Summary of changes for version 20050708:
+
+1) ACPI CA Core Subsystem:
+
+The use of the CPU stack in the debug version of the subsystem
+has been considerably reduced. Previously, a debug structure was
+declared in every function that used the debug macros. This
+structure has been removed in favor of declaring the individual
+elements as parameters to the debug functions. This reduces the
+cumulative stack use during nested execution of ACPI function
+calls at the cost of a small increase in the code size of the
+debug version of the subsystem. With assistance from Alexey
+Starikovskiy and Len Brown.
+
+Added the ACPI_GET_FUNCTION_NAME macro to enable the compiler-
+dependent headers to define a macro that will return the current
+function name at runtime (such as __FUNCTION__ or _func_, etc.)
+The function name is used by the debug trace output. If
+ACPI_GET_FUNCTION_NAME is not defined in the compiler-dependent
+header, the function name is saved on the CPU stack (one pointer
+per function.) This mechanism is used because apparently there
+exists no standard ANSI-C defined macro that that returns the
+function name.
+
+Redesigned and reimplemented the "Owner ID" mechanism used to
+track namespace objects created/deleted by ACPI tables and
+control method execution. A bitmap is now used to allocate and
+free the IDs, thus solving the wraparound problem present in the
+previous implementation. The size of the namespace node
+descriptor was reduced by 2 bytes as a result (Alexey
+Starikovskiy).
+
+Removed the UINT32_BIT and UINT16_BIT types that were used for
+the bitfield flag definitions within the headers for the
+predefined ACPI tables. These have been replaced by UINT8_BIT in
+order to increase the code portability of the subsystem. If the
+use of UINT8 remains a problem, we may be forced to eliminate
+bitfields entirely because of a lack of portability.
+
+Enhanced the performance of the AcpiUtUpdateObjectReference
+procedure. This is a frequently used function and this
+improvement increases the performance of the entire subsystem
+(Alexey Starikovskiy).
+
+Fixed several possible memory leaks and the inverse - premature
+object deletion (Alexey Starikovskiy).
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total
+ Debug Version: 165.2K Code, 69.6K Data, 234.8K Total
+ Current Release:
+ Non-Debug Version: 78.6K Code, 11.6K Data, 90.2K Total
+ Debug Version: 170.0K Code, 69.7K Data, 239.7K Total
+
+----------------------------------------
+24 June 2005. Summary of changes for version 20050624:
+
+1) ACPI CA Core Subsystem:
+
+Modified the new OSL cache interfaces to use ACPI_CACHE_T as the
+type for the host-defined cache object. This allows the OSL
+implementation to define and type this object in any manner
+desired, simplifying the OSL implementation. For example,
+ACPI_CACHE_T is defined as kmem_cache_t for Linux, and should be
+defined in the OS-specific header file for other operating
+systems as required.
+
+Changed the interface to AcpiOsAcquireObject to directly return
+the requested object as the function return (instead of
+ACPI_STATUS.) This change was made for performance reasons, since
+this is the purpose of the interface in the first place.
+AcpiOsAcquireObject is now similar to the AcpiOsAllocate
+interface.
+
+Implemented a new AML debugger command named Businfo. This
+command displays information about all devices that have an
+associate _PRT object. The _ADR, _HID, _UID, and _CID are
+displayed for these devices.
+
+Modified the initialization sequence in AcpiInitializeSubsystem
+to call the OSL interface AcpiOslInitialize first, before any
+local initialization. This change was required because the global
+initialization now calls OSL interfaces.
+
+Enhanced the Dump command to display the entire contents of
+Package objects (including all sub-objects and their values.)
+
+Restructured the code base to split some files because of size
+and/or because the code logically belonged in a separate file.
+New files are listed below. All makefiles and project files
+included in the ACPI CA release have been updated.
+ utilities/utcache.c /* Local cache interfaces */
+ utilities/utmutex.c /* Local mutex support */
+ utilities/utstate.c /* State object support */
+ interpreter/parser/psloop.c /* Main AML parse loop */
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total
+ Debug Version: 164.0K Code, 69.1K Data, 233.1K Total
+ Current Release:
+ Non-Debug Version: 78.6K Code, 11.5K Data, 90.1K Total
+ Debug Version: 165.2K Code, 69.6K Data, 234.8K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a regression introduced in version 20050513 where the use
+of a Package object within a Case() statement caused a compile
+time exception. The original behavior has been restored (a
+Match() operator is emitted.)
+
+----------------------------------------
+17 June 2005. Summary of changes for version 20050617:
+
+1) ACPI CA Core Subsystem:
+
+Moved the object cache operations into the OS interface layer
+(OSL) to allow the host OS to handle these operations if desired
+(for example, the Linux OSL will invoke the slab allocator). This
+support is optional; the compile time define ACPI_USE_LOCAL_CACHE
+may be used to utilize the original cache code in the ACPI CA
+core. The new OSL interfaces are shown below. See utalloc.c for
+an example implementation, and acpiosxf.h for the exact interface
+definitions. With assistance from Alexey Starikovskiy.
+ AcpiOsCreateCache
+ AcpiOsDeleteCache
+ AcpiOsPurgeCache
+ AcpiOsAcquireObject
+ AcpiOsReleaseObject
+
+Modified the interfaces to AcpiOsAcquireLock and
+AcpiOsReleaseLock to return and restore a flags parameter. This
+fits better with many OS lock models. Note: the current execution
+state (interrupt handler or not) is no longer passed to these
+interfaces. If necessary, the OSL must determine this state by
+itself, a simple and fast operation. With assistance from Alexey
+Starikovskiy.
+
+Fixed a problem in the ACPI table handling where a valid XSDT was
+assumed present if the revision of the RSDP was 2 or greater.
+According to the ACPI specification, the XSDT is optional in all
+cases, and the table manager therefore now checks for both an
+RSDP >=2 and a valid XSDT pointer. Otherwise, the RSDT pointer is
+used. Some ACPI 2.0 compliant BIOSs contain only the RSDT.
+
+Fixed an interpreter problem with the Mid() operator in the case
+of an input string where the resulting output string is of zero
+length. It now correctly returns a valid, null terminated string
+object instead of a string object with a null pointer.
+
+Fixed a problem with the control method argument handling to
+allow a store to an Arg object that already contains an object of
+type Device. The Device object is now correctly overwritten.
+Previously, an error was returned.
+
+
+Enhanced the debugger Find command to emit object values in
+addition to the found object pathnames. The output format is the
+same as the dump namespace command.
+
+Enhanced the debugger Set command. It now has the ability to set
+the value of any Named integer object in the namespace
+(Previously, only method locals and args could be set.)
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total
+ Debug Version: 164.0K Code, 69.3K Data, 233.3K Total
+ Current Release:
+ Non-Debug Version: 78.3K Code, 11.6K Data, 89.9K Total
+ Debug Version: 164.0K Code, 69.1K Data, 233.1K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a regression in the disassembler where if/else/while
+constructs were output incorrectly. This problem was introduced
+in the previous release (20050526). This problem also affected
+the single-step disassembly in the debugger.
+
+Fixed a problem where compiling the reserved _OSI method would
+randomly (but rarely) produce compile errors.
+
+Enhanced the disassembler to emit compilable code in the face of
+incorrect AML resource descriptors. If the optional
+ResourceSourceIndex is present, but the ResourceSource is not, do
+not emit the ResourceSourceIndex in the disassembly. Otherwise,
+the resulting code cannot be compiled without errors.
+
+----------------------------------------
+26 May 2005. Summary of changes for version 20050526:
+
+1) ACPI CA Core Subsystem:
+
+Implemented support to execute Type 1 and Type 2 AML opcodes
+appearing at the module level (not within a control method.)
+These opcodes are executed exactly once at the time the table is
+loaded. This type of code was legal up until the release of ACPI
+2.0B (2002) and is now supported within ACPI CA in order to
+provide backwards compatibility with earlier BIOS
+implementations. This eliminates the "Encountered executable code
+at module level" warning that was previously generated upon
+detection of such code.
+
+Fixed a problem in the interpreter where an AE_NOT_FOUND
+exception could inadvertently be generated during the lookup of
+namespace objects in the second pass parse of ACPI tables and
+control methods. It appears that this problem could occur during
+the resolution of forward references to namespace objects.
+
+Added the ACPI_MUTEX_DEBUG #ifdef to the AcpiUtReleaseMutex
+function, corresponding to the same #ifdef in the
+AcpiUtAcquireMutex function. This allows the deadlock detection
+debug code to be compiled out in the normal case, improving mutex
+performance (and overall subsystem performance) considerably.
+
+Implemented a handful of miscellaneous fixes for possible memory
+leaks on error conditions and error handling control paths. These
+fixes were suggested by FreeBSD and the Coverity Prevent source
+code analysis tool.
+
+Added a check for a null RSDT pointer in AcpiGetFirmwareTable
+(tbxfroot.c) to prevent a fault in this error case.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total
+ Debug Version: 163.7K Code, 69.3K Data, 233.0K Total
+ Current Release:
+ Non-Debug Version: 78.1K Code, 11.6K Data, 89.7K Total
+ Debug Version: 164.0K Code, 69.3K Data, 233.3K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Implemented support to allow Type 1 and Type 2 ASL operators to
+appear at the module level (not within a control method.) These
+operators will be executed once at the time the table is loaded.
+This type of code was legal up until the release of ACPI 2.0B
+(2002) and is now supported by the iASL compiler in order to
+provide backwards compatibility with earlier BIOS ASL code.
+
+The ACPI integer width (specified via the table revision ID or
+the -r override, 32 or 64 bits) is now used internally during
+compile-time constant folding to ensure that constants are
+truncated to 32 bits if necessary. Previously, the revision ID
+value was only emitted in the AML table header.
+
+An error message is now generated for the Mutex and Method
+operators if the SyncLevel parameter is outside the legal range
+of 0 through 15.
+
+Fixed a problem with the Method operator ParameterTypes list
+handling (ACPI 3.0). Previously, more than 2 types or 2 arguments
+generated a syntax error. The actual underlying implementation
+of method argument typechecking is still under development,
+however.
+
+----------------------------------------
+13 May 2005. Summary of changes for version 20050513:
+
+1) ACPI CA Core Subsystem:
+
+Implemented support for PCI Express root bridges -- added support
+for device PNP0A08 in the root bridge search within
+AcpiEvPciConfigRegionSetup.
+
+The interpreter now automatically truncates incoming 64-bit
+constants to 32 bits if currently executing out of a 32-bit ACPI
+table (Revision < 2). This also affects the iASL compiler
+constant folding. (Note: as per below, the iASL compiler no
+longer allows 64-bit constants within 32-bit tables.)
+
+Fixed a problem where string and buffer objects with "static"
+pointers (pointers to initialization data within an ACPI table)
+were not handled consistently. The internal object copy operation
+now always copies the data to a newly allocated buffer,
+regardless of whether the source object is static or not.
+
+Fixed a problem with the FromBCD operator where an implicit
+result conversion was improperly performed while storing the
+result to the target operand. Since this is an "explicit
+conversion" operator, the implicit conversion should never be
+performed on the output.
+
+Fixed a problem with the CopyObject operator where a copy to an
+existing named object did not always completely overwrite the
+existing object stored at name. Specifically, a buffer-to-buffer
+copy did not delete the existing buffer.
+
+Replaced "InterruptLevel" with "InterruptNumber" in all GPE
+interfaces and structs for consistency.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total
+ Debug Version: 163.7K Code, 69.3K Data, 233.0K Total
+ Current Release: (Same sizes)
+ Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total
+ Debug Version: 163.7K Code, 69.3K Data, 233.0K Total
+
+
+2) iASL Compiler/Disassembler:
+
+The compiler now emits a warning if an attempt is made to
+generate a 64-bit integer constant from within a 32-bit ACPI
+table (Revision < 2). The integer is truncated to 32 bits.
+
+Fixed a problem with large package objects: if the static length
+of the package is greater than 255, the "variable length package"
+opcode is emitted. Previously, this caused an error. This
+requires an update to the ACPI spec, since it currently
+(incorrectly) states that packages larger than 255 elements are
+not allowed.
+
+The disassembler now correctly handles variable length packages
+and packages larger than 255 elements.
+
+----------------------------------------
+08 April 2005. Summary of changes for version 20050408:
+
+1) ACPI CA Core Subsystem:
+
+Fixed three cases in the interpreter where an "index" argument to
+an ASL function was still (internally) 32 bits instead of the
+required 64 bits. This was the Index argument to the Index, Mid,
+and Match operators.
+
+The "strupr" function is now permanently local (AcpiUtStrupr),
+since this is not a POSIX-defined function and not present in
+most kernel-level C libraries. All references to the C library
+strupr function have been removed from the headers.
+
+Completed the deployment of static functions/prototypes. All
+prototypes with the static attribute have been moved from the
+headers to the owning C file.
+
+Implemented an extract option (-e) for the AcpiBin utility (AML
+binary utility). This option allows the utility to extract
+individual ACPI tables from the output of AcpiDmp. It provides
+the same functionality of the acpixtract.pl perl script without
+the worry of setting the correct perl options. AcpiBin runs on
+Windows and has not yet been generated/validated in the
+Linux/Unix environment (but should be soon).
+
+Updated and fixed the table dump option for AcpiBin (-d). This
+option converts a single ACPI table to a hex/ascii file, similar
+to the output of AcpiDmp.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.0K Code, 11.6K Data, 89.6K Total
+ Debug Version: 163.5K Code, 69.3K Data, 232.8K Total
+ Current Release:
+ Non-Debug Version: 78.2K Code, 11.6K Data, 89.8K Total
+ Debug Version: 163.7K Code, 69.3K Data, 233.0K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Disassembler fix: Added a check to ensure that the table length
+found in the ACPI table header within the input file is not
+longer than the actual input file size. This indicates some kind
+of file or table corruption.
+
+----------------------------------------
+29 March 2005. Summary of changes for version 20050329:
+
+1) ACPI CA Core Subsystem:
+
+An error is now generated if an attempt is made to create a
+Buffer Field of length zero (A CreateField with a length operand
+of zero.)
+
+The interpreter now issues a warning whenever executable code at
+the module level is detected during ACPI table load. This will
+give some idea of the prevalence of this type of code.
+
+Implemented support for references to named objects (other than
+control methods) within package objects.
+
+Enhanced package object output for the debug object. Package
+objects are now completely dumped, showing all elements.
+
+Enhanced miscellaneous object output for the debug object. Any
+object can now be written to the debug object (for example, a
+device object can be written, and the type of the object will be
+displayed.)
+
+The "static" qualifier has been added to all local functions
+across both the core subsystem and the iASL compiler.
+
+The number of "long" lines (> 80 chars) within the source has
+been significantly reduced, by about 1/3.
+
+Cleaned up all header files to ensure that all CA/iASL functions
+are prototyped (even static functions) and the formatting is
+consistent.
+
+Two new header files have been added, acopcode.h and acnames.h.
+
+Removed several obsolete functions that were no longer used.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 165.4K Code, 69.7K Data, 236.1K Total
+ Current Release:
+ Non-Debug Version: 78.0K Code, 11.6K Data, 89.6K Total
+ Debug Version: 163.5K Code, 69.3K Data, 232.8K Total
+
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a problem with the resource descriptor generation/support.
+For the ResourceSourceIndex and the ResourceSource fields, both
+must be present, or both must be not present - can't have one
+without the other.
+
+The compiler now returns non-zero from the main procedure if any
+errors have occurred during the compilation.
+
+
+----------------------------------------
+09 March 2005. Summary of changes for version 20050309:
+
+1) ACPI CA Core Subsystem:
+
+The string-to-buffer implicit conversion code has been modified
+again after a change to the ACPI specification. In order to
+match the behavior of the other major ACPI implementation, the
+target buffer is no longer truncated if the source string is
+smaller than an existing target buffer. This change requires an
+update to the ACPI spec, and should eliminate the recent
+AE_AML_BUFFER_LIMIT issues.
+
+The "implicit return" support was rewritten to a new algorithm
+that solves the general case. Rather than attempt to determine
+when a method is about to exit, the result of every ASL operator
+is saved momentarily until the very next ASL operator is
+executed. Therefore, no matter how the method exits, there will
+always be a saved implicit return value. This feature is only
+enabled with the AcpiGbl_EnableInterpreterSlack flag, and should
+eliminate AE_AML_NO_RETURN_VALUE errors when enabled.
+
+Implemented implicit conversion support for the predicate
+(operand) of the If, Else, and While operators. String and Buffer
+arguments are automatically converted to Integers.
+
+Changed the string-to-integer conversion behavior to match the
+new ACPI errata: "If no integer object exists, a new integer is
+created. The ASCII string is interpreted as a hexadecimal
+constant. Each string character is interpreted as a hexadecimal
+value (`0'-`9', `A'-`F', `a', `f'), starting with the first
+character as the most significant digit, and ending with the
+first non-hexadecimal character or end-of-string." This means
+that the first non-hex character terminates the conversion and
+this is the code that was changed.
+
+Fixed a problem where the ObjectType operator would fail (fault)
+when used on an Index of a Package which pointed to a null
+package element. The operator now properly returns zero
+(Uninitialized) in this case.
+
+Fixed a problem where the While operator used excessive memory by
+not properly popping the result stack during execution. There was
+no memory leak after execution, however. (Code provided by Valery
+Podrezov.)
+
+Fixed a problem where references to control methods within
+Package objects caused the method to be invoked, instead of
+producing a reference object pointing to the method.
+
+Restructured and simplified the pswalk.c module
+(AcpiPsDeleteParseTree) to improve performance and reduce code
+size. (Code provided by Alexey Starikovskiy.)
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 165.4K Code, 69.6K Data, 236.0K Total
+ Current Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 165.4K Code, 69.7K Data, 236.1K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a problem with the Return operator with no arguments. Since
+the AML grammar for the byte encoding requires an operand for the
+Return opcode, the compiler now emits a Return(Zero) for this
+case. An ACPI specification update has been written for this
+case.
+
+For tables other than the DSDT, namepath optimization is
+automatically disabled. This is because SSDTs can be loaded
+anywhere in the namespace, the compiler has no knowledge of
+where, and thus cannot optimize namepaths.
+
+Added "ProcessorObj" to the ObjectTypeKeyword list. This object
+type was inadvertently omitted from the ACPI specification, and
+will require an update to the spec.
+
+The source file scan for ASCII characters is now optional (-a).
+This change was made because some vendors place non-ascii
+characters within comments. However, the scan is simply a brute-
+force byte compare to ensure all characters in the file are in
+the range 0x00 to 0x7F.
+
+Fixed a problem with the CondRefOf operator where the compiler
+was inappropriately checking for the existence of the target.
+Since the point of the operator is to check for the existence of
+the target at run-time, the compiler no longer checks for the
+target existence.
+
+Fixed a problem where errors generated from the internal AML
+interpreter during constant folding were not handled properly,
+causing a fault.
+
+Fixed a problem with overly aggressive range checking for the
+Stall operator. The valid range (max 255) is now only checked if
+the operand is of type Integer. All other operand types cannot be
+statically checked.
+
+Fixed a problem where control method references within the RefOf,
+DeRefOf, and ObjectType operators were not treated properly. They
+are now treated as actual references, not method invocations.
+
+Fixed and enhanced the "list namespace" option (-ln). This option
+was broken a number of releases ago.
+
+Improved error handling for the Field, IndexField, and BankField
+operators. The compiler now cleanly reports and recovers from
+errors in the field component (FieldUnit) list.
+
+Fixed a disassembler problem where the optional
+ResourceDescriptor fields TRS and TTP were not always handled
+correctly.
+
+Disassembler - Comments in output now use "//" instead of "/*"
+
+----------------------------------------
+28 February 2005. Summary of changes for version 20050228:
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem where the result of an Index() operator (an
+object reference) must increment the reference count on the
+target object for the life of the object reference.
+
+Implemented AML Interpreter and Debugger support for the new ACPI
+3.0 Extended Address (IO, Memory, Space), QwordSpace, DwordSpace,
+and WordSpace resource descriptors.
+
+Implemented support in the _OSI method for the ACPI 3.0 "Extended
+Address Space Descriptor" string, indicating interpreter support
+for the descriptors above.
+
+Implemented header support for the new ACPI 3.0 FADT flag bits.
+
+Implemented header support for the new ACPI 3.0 PCI Express bits
+for the PM1 status/enable registers.
+
+Updated header support for the MADT processor local Apic struct
+and MADT platform interrupt source struct for new ACPI 3.0
+fields.
+
+Implemented header support for the SRAT and SLIT ACPI tables.
+
+Implemented the -s switch in AcpiExec to enable the
+"InterpreterSlack" flag at runtime.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.2K Code, 11.5K Data, 89.7K Total
+ Debug Version: 164.9K Code, 69.2K Data, 234.1K Total
+ Current Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 165.4K Code, 69.6K Data, 236.0K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a problem with the internal 64-bit String-to-integer
+conversion with strings less than two characters long.
+
+Fixed a problem with constant folding where the result of the
+Index() operator can not be considered a constant. This means
+that Index() cannot be a type3 opcode and this will require an
+update to the ACPI specification.
+
+Disassembler: Implemented support for the TTP, MTP, and TRS
+resource descriptor fields. These fields were inadvertently
+ignored and not output in the disassembly of the resource
+descriptor.
+
+
+ ----------------------------------------
+11 February 2005. Summary of changes for version 20050211:
+
+1) ACPI CA Core Subsystem:
+
+Implemented ACPI 3.0 support for implicit conversion within the
+Match() operator. MatchObjects can now be of type integer,
+buffer, or string instead of just type integer. Package elements
+are implicitly converted to the type of the MatchObject. This
+change aligns the behavior of Match() with the behavior of the
+other logical operators (LLess(), etc.) It also requires an
+errata change to the ACPI specification as this support was
+intended for ACPI 3.0, but was inadvertently omitted.
+
+Fixed a problem with the internal implicit "to buffer"
+conversion. Strings that are converted to buffers will cause
+buffer truncation if the string is smaller than the target
+buffer. Integers that are converted to buffers will not cause
+buffer truncation, only zero extension (both as per the ACPI
+spec.) The problem was introduced when code was added to truncate
+the buffer, but this should not be performed in all cases, only
+the string case.
+
+Fixed a problem with the Buffer and Package operators where the
+interpreter would get confused if two such operators were used as
+operands to an ASL operator (such as
+LLess(Buffer(1){0},Buffer(1){1}). The internal result stack was
+not being popped after the execution of these operators,
+resulting in an AE_NO_RETURN_VALUE exception.
+
+Fixed a problem with constructs of the form
+Store(Index(...),...). The reference object returned from Index
+was inadvertently resolved to an actual value. This problem was
+introduced in version 20050114 when the behavior of Store() was
+modified to restrict the object types that can be used as the
+source operand (to match the ACPI specification.)
+
+Reduced excessive stack use within the AcpiGetObjectInfo
+procedure.
+
+Added a fix to aclinux.h to allow generation of AcpiExec on
+Linux.
+
+Updated the AcpiSrc utility to add the FADT_DESCRIPTOR_REV2_MINUS
+struct.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.1K Code, 11.5K Data, 89.6K Total
+ Debug Version: 164.8K Code, 69.2K Data, 234.0K Total
+ Current Release:
+ Non-Debug Version: 78.2K Code, 11.5K Data, 89.7K Total
+ Debug Version: 164.9K Code, 69.2K Data, 234.1K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed a code generation problem in the constant folding
+optimization code where incorrect code was generated if a
+constant was reduced to a buffer object (i.e., a reduced type 5
+opcode.)
+
+Fixed a typechecking problem for the ToBuffer operator. Caused by
+an incorrect return type in the internal opcode information
+table.
+
+----------------------------------------
+25 January 2005. Summary of changes for version 20050125:
+
+1) ACPI CA Core Subsystem:
+
+Fixed a recently introduced problem with the Global Lock where
+the underlying semaphore was not created. This problem was
+introduced in version 20050114, and caused an AE_AML_NO_OPERAND
+exception during an Acquire() operation on _GL.
+
+The local object cache is now optional, and is disabled by
+default. Both AcpiExec and the iASL compiler enable the cache
+because they run in user mode and this enhances their
+performance. #define ACPI_ENABLE_OBJECT_CACHE to enable the local
+cache.
+
+Fixed an issue in the internal function AcpiUtEvaluateObject
+concerning the optional "implicit return" support where an error
+was returned if no return object was expected, but one was
+implicitly returned. AE_OK is now returned in this case and the
+implicitly returned object is deleted. AcpiUtEvaluateObject is
+only occasionally used, and only to execute reserved methods such
+as _STA and _INI where the return type is known up front.
+
+Fixed a few issues with the internal convert-to-integer code. It
+now returns an error if an attempt is made to convert a null
+string, a string of only blanks/tabs, or a zero-length buffer.
+This affects both implicit conversion and explicit conversion via
+the ToInteger() operator.
+
+The internal debug code in AcpiUtAcquireMutex has been commented
+out. It is not needed for normal operation and should increase
+the performance of the entire subsystem. The code remains in case
+it is needed for debug purposes again.
+
+The AcpiExec source and makefile are included in the Unix/Linux
+package for the first time.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.4K Code, 11.5K Data, 89.9K Total
+ Debug Version: 165.4K Code, 69.4K Data, 234.8K Total
+ Current Release:
+ Non-Debug Version: 78.1K Code, 11.5K Data, 89.6K Total
+ Debug Version: 164.8K Code, 69.2K Data, 234.0K Total
+
+2) iASL Compiler/Disassembler:
+
+Switch/Case support: A warning is now issued if the type of the
+Switch value cannot be determined at compile time. For example,
+Switch(Arg0) will generate the warning, and the type is assumed
+to be an integer. As per the ACPI spec, use a construct such as
+Switch(ToInteger(Arg0)) to eliminate the warning.
+
+Switch/Case support: Implemented support for buffer and string
+objects as the switch value. This is an ACPI 3.0 feature, now
+that LEqual supports buffers and strings.
+
+Switch/Case support: The emitted code for the LEqual()
+comparisons now uses the switch value as the first operand, not
+the second. The case value is now the second operand, and this
+allows the case value to be implicitly converted to the type of
+the switch value, not the other way around.
+
+Switch/Case support: Temporary variables are now emitted
+immediately within the control method, not at the global level.
+This means that there are now 36 temps available per-method, not
+36 temps per-module as was the case with the earlier
+implementation (_T_0 through _T_9 and _T_A through _T_Z.)
+
+----------------------------------------
+14 January 2005. Summary of changes for version 20050114:
+
+Added 2005 copyright to all module headers. This affects every
+module in the core subsystem, iASL compiler, and the utilities.
+
+1) ACPI CA Core Subsystem:
+
+Fixed an issue with the String-to-Buffer conversion code where
+the string null terminator was not included in the buffer after
+conversion, but there is existing ASL that assumes the string
+null terminator is included. This is the root of the
+ACPI_AML_BUFFER_LIMIT regression. This problem was introduced in
+the previous version when the code was updated to correctly set
+the converted buffer size as per the ACPI specification. The ACPI
+spec is ambiguous and will be updated to specify that the null
+terminator must be included in the converted buffer. This also
+affects the ToBuffer() ASL operator.
+
+Fixed a problem with the Mid() ASL/AML operator where it did not
+work correctly on Buffer objects. Newly created sub-buffers were
+not being marked as initialized.
+
+
+Fixed a problem in AcpiTbFindTable where incorrect string
+compares were performed on the OemId and OemTableId table header
+fields. These fields are not null terminated, so strncmp is now
+used instead of strcmp.
+
+Implemented a restriction on the Store() ASL/AML operator to
+align the behavior with the ACPI specification. Previously, any
+object could be used as the source operand. Now, the only
+objects that may be used are Integers, Buffers, Strings,
+Packages, Object References, and DDB Handles. If necessary, the
+original behavior can be restored by enabling the
+EnableInterpreterSlack flag.
+
+Enhanced the optional "implicit return" support to allow an
+implicit return value from methods that are invoked externally
+via the AcpiEvaluateObject interface. This enables implicit
+returns from the _STA and _INI methods, for example.
+
+Changed the Revision() ASL/AML operator to return the current
+version of the AML interpreter, in the YYYYMMDD format.
+Previously, it incorrectly returned the supported ACPI version
+(This is the function of the _REV method).
+
+Updated the _REV predefined method to return the currently
+supported version of ACPI, now 3.
+
+Implemented batch mode option for the AcpiExec utility (-b).
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 165.3K Code, 69.4K Data, 234.7K Total
+ Current Release:
+ Non-Debug Version: 78.4K Code, 11.5K Data, 89.9K Total
+ Debug Version: 165.4K Code, 69.4K Data, 234.8K Total
+
+----------------------------------------
+10 December 2004. Summary of changes for version 20041210:
+
+ACPI 3.0 support is nearing completion in both the iASL compiler
+and the ACPI CA core subsystem.
+
+1) ACPI CA Core Subsystem:
+
+Fixed a problem in the ToDecimalString operator where the
+resulting string length was incorrectly calculated. The length is
+now calculated exactly, eliminating incorrect AE_STRING_LIMIT
+exceptions.
+
+Fixed a problem in the ToHexString operator to allow a maximum
+200 character string to be produced.
+
+Fixed a problem in the internal string-to-buffer and buffer-to-
+buffer copy routine where the length of the resulting buffer was
+not truncated to the new size (if the target buffer already
+existed).
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 164.7K Code, 68.5K Data, 233.2K Total
+ Current Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 165.3K Code, 69.4K Data, 234.7K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Implemented the new ACPI 3.0 resource template macros -
+DWordSpace, ExtendedIO, ExtendedMemory, ExtendedSpace,
+QWordSpace, and WordSpace. Includes support in the disassembler.
+
+Implemented support for the new (ACPI 3.0) parameter to the
+Register macro, AccessSize.
+
+Fixed a problem where the _HE resource name for the Interrupt
+macro was referencing bit 0 instead of bit 1.
+
+Implemented check for maximum 255 interrupts in the Interrupt
+macro.
+
+Fixed a problem with the predefined resource descriptor names
+where incorrect AML code was generated if the offset within the
+resource buffer was 0 or 1. The optimizer shortened the AML code
+to a single byte opcode but did not update the surrounding
+package lengths.
+
+Changes to the Dma macro: All channels within the channel list
+must be in the range 0-7. Maximum 8 channels can be specified.
+BusMaster operand is optional (default is BusMaster).
+
+Implemented check for maximum 7 data bytes for the VendorShort
+macro.
+
+The ReadWrite parameter is now optional for the Memory32 and
+similar macros.
+
+----------------------------------------
+03 December 2004. Summary of changes for version 20041203:
+
+1) ACPI CA Core Subsystem:
+
+The low-level field insertion/extraction code (exfldio) has been
+completely rewritten to eliminate unnecessary complexity, bugs,
+and boundary conditions.
+
+Fixed a problem in the ToInteger, ToBuffer, ToHexString, and
+ToDecimalString operators where the input operand could be
+inadvertently deleted if no conversion was necessary (e.g., if
+the input to ToInteger was an Integer object.)
+
+Fixed a problem with the ToDecimalString and ToHexString where an
+incorrect exception code was returned if the resulting string
+would be > 200 chars. AE_STRING_LIMIT is now returned.
+
+Fixed a problem with the Concatenate operator where AE_OK was
+always returned, even if the operation failed.
+
+Fixed a problem in oswinxf (used by AcpiExec and iASL) to allow >
+128 semaphores to be allocated.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total
+ Debug Version: 165.2K Code, 68.6K Data, 233.8K Total
+ Current Release:
+ Non-Debug Version: 78.3K Code, 11.5K Data, 89.8K Total
+ Debug Version: 164.7K Code, 68.5K Data, 233.2K Total
+
+
+2) iASL Compiler/Disassembler:
+
+Fixed typechecking for the ObjectType and SizeOf operators.
+Problem was recently introduced in 20041119.
+
+Fixed a problem with the ToUUID macro where the upper nybble of
+each buffer byte was inadvertently set to zero.
+
+----------------------------------------
19 November 2004. Summary of changes for version 20041119:
1) ACPI CA Core Subsystem:
-Fixed a problem in the internal ConvertToInteger routine where new
-integers were not truncated to 32 bits for 32-bit ACPI tables. This
-routine converts buffers and strings to integers.
-
-Implemented support to store a value to an Index() on a String object.
-This is an ACPI 2.0 feature that had not yet been implemented.
-
-Implemented new behavior for storing objects to individual package
-elements (via the Index() operator). The previous behavior was to invoke
-the implicit conversion rules if an object was already present at the
-index. The new behavior is to simply delete any existing object and
-directly store the new object. Although the ACPI specification seems
-unclear on this subject, other ACPI implementations behave in this
-manner. (This is the root of the AE_BAD_HEX_CONSTANT issue.)
-
-Modified the RSDP memory scan mechanism to support the extended checksum
-for ACPI 2.0 (and above) RSDPs. Note that the search continues until a
-valid RSDP signature is found with a valid checksum.
-
-Code and Data Size: Current and previous core subsystem library sizes
-are shown below. These are the code and data sizes for the acpica.lib
-produced by the Microsoft Visual C++ 6.0 compiler, and these values do
-not include any ACPI driver or OSPM code. The debug version of the code
-includes the debug output trace mechanism and has a much larger code and
-data size. Note that these values will vary depending on the efficiency
-of the compiler and the compiler options used during generation.
-
- Previous Release:
- Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total
- Debug Version: 165.2K Code, 68.6K Data, 233.8K Total
- Current Release:
- Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total
- Debug Version: 165.2K Code, 68.6K Data, 233.8K Total
+Fixed a problem in the internal ConvertToInteger routine where
+new integers were not truncated to 32 bits for 32-bit ACPI
+tables. This routine converts buffers and strings to integers.
+
+Implemented support to store a value to an Index() on a String
+object. This is an ACPI 2.0 feature that had not yet been
+implemented.
+
+Implemented new behavior for storing objects to individual
+package elements (via the Index() operator). The previous
+behavior was to invoke the implicit conversion rules if an object
+was already present at the index. The new behavior is to simply
+delete any existing object and directly store the new object.
+Although the ACPI specification seems unclear on this subject,
+other ACPI implementations behave in this manner. (This is the
+root of the AE_BAD_HEX_CONSTANT issue.)
+
+Modified the RSDP memory scan mechanism to support the extended
+checksum for ACPI 2.0 (and above) RSDPs. Note that the search
+continues until a valid RSDP signature is found with a valid
+checksum.
+
+Code and Data Size: Current and previous core subsystem library
+sizes are shown below. These are the code and data sizes for the
+acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
+these values do not include any ACPI driver or OSPM code. The
+debug version of the code includes the debug output trace
+mechanism and has a much larger code and data size. Note that
+these values will vary depending on the efficiency of the
+compiler and the compiler options used during generation.
+
+ Previous Release:
+ Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total
+ Debug Version: 165.2K Code, 68.6K Data, 233.8K Total
+ Current Release:
+ Non-Debug Version: 78.5K Code, 11.5K Data, 90.0K Total
+ Debug Version: 165.2K Code, 68.6K Data, 233.8K Total
2) iASL Compiler/Disassembler:
@@ -160,6 +3217,7 @@
Debug Version: 164.8K Code, 68.6K Data, 233.4K Total
+
2) iASL Compiler/Disassembler:
Allow the use of the ObjectType operator on uninitialized Locals
@@ -381,7 +3439,7 @@
of an explicit Return() operator. A few machines depend on this
behavior, even though it is not explicitly supported by the ASL
language. It is optional support that can be enabled at runtime
-via the AcpiGbl_EnableInterpeterSlack flag.
+via the AcpiGbl_EnableInterpreterSlack flag.
Removed support for the PCI_Config address space from the
internal low level hardware interfaces (AcpiHwLowLevelRead and
@@ -479,6 +3537,7 @@
within Case blocks (TermLists) as there is some question about
backward compatibility with ACPI 1.0 interpreters.
+
Fixed a problem where complex terms were not supported properly
within the Switch() operator.
@@ -516,6 +3575,7 @@
Previous Release:
Non-Debug Version: 77.7K Code, 11.5K Data, 89.2K Total
Debug Version: 163.3K Code, 67.2K Data, 230.5K Total
+
Current Release:
Non-Debug Version: 77.8K Code, 11.5K Data, 89.3K Total
Debug Version: 163.8K Code, 68.2K Data, 232.0K Total
@@ -568,6 +3628,7 @@
Rolled in a couple of changes to the FreeBSD-specific header.
+
Code and Data Size: Current and previous core subsystem library
sizes are shown below. These are the code and data sizes for the
acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
@@ -756,6 +3817,7 @@
Non-Debug Version: 77.0K Code, 11.4K Data, 88.4K Total
Debug Version: 161.0K Code, 66.3K Data, 227.3K Total
Current Release:
+
Non-Debug Version: 77.6K Code, 11.5K Data, 89.1K Total
Debug Version: 162.9K Code, 67.0K Data, 229.9K Total
@@ -862,6 +3924,7 @@
compiler and the compiler options used during generation.
Previous Release:
+
Non-Debug Version: 76.5K Code, 11.3K Data, 87.8K Total
Debug Version: 160.3K Code, 66.0K Data, 226.3K Total
Current Release:
@@ -933,6 +3996,7 @@
----------------------------------------
20 February 2004. Summary of changes for version 20040220:
+
1) ACPI CA Core Subsystem:
Implemented execution of _SxD methods for Device objects in the
@@ -960,6 +4024,7 @@
----------------------------------------
11 February 2004. Summary of changes for version 20040211:
+
1) ACPI CA Core Subsystem:
Completed investigation and implementation of the call-by-
@@ -1078,6 +4143,7 @@
1) ACPI CA Core Subsystem:
+
Fixed a problem where a level-triggered GPE with an associated
_Lxx control method was incorrectly cleared twice.
@@ -1134,6 +4200,7 @@
sizes are shown below. These are the code and data sizes for the
acpica.lib produced by the Microsoft Visual C++ 6.0 compiler, and
these values do not include any ACPI driver or OSPM code. The
+
debug version of the code includes the debug output trace
mechanism and has a much larger code and data size. Note that
these values will vary depending on the efficiency of the
@@ -1259,6 +4326,7 @@
and the compiler options used during generation.
Previous Release:
+
Non-Debug Version: 73.7K Code, 9.7K Data, 83.4K Total
Debug Version: 156.9K Code, 64.2K Data, 221.1K Total
Current Release:
@@ -1321,6 +4389,7 @@
Mention acpismp=force in config help
Re-add acpitable.c and acpismp=force. This improves backwards
+
compatibility and also cleans up the code to a significant
degree.
@@ -1532,6 +4601,7 @@
2) Linux:
A fix for SMP systems with link devices was contributed by
+
Compaq's Dan Zink.
(2.5) Return whether we handled the interrupt in our IRQ handler.
@@ -1540,6 +4610,7 @@
return value from the ACPI CA core back to the OS.)
+
3) Documentation:
The ACPI CA Programmer Reference has been updated to reflect new
@@ -2019,6 +5090,7 @@
ASM and C (the -i switch). This simplifies BIOS development by
automatically creating include files that contain external
declarations for the symbols that are created within the
+
(optionally generated) ASM and C AML source files.
@@ -2028,6 +5100,7 @@
1) ACPI CA Core Subsystem:
Fixed a memory leak problem where an error during resolution of
+
method arguments during a method invocation from another method
failed to cleanup properly by deleting all successfully resolved
argument objects.
@@ -2639,6 +5712,7 @@
Added a warning message for invalid escapes (a backslash followed
by any character other than the allowable escapes). This catches
the quoted string error "\_SB_" (which should be "\\_SB_" ).
+
Also, there are numerous instances in the ACPI specification
where
this error occurs.
@@ -2737,6 +5811,7 @@
size with the correct value.
+
----------------------------------------
02 July 2002. Summary of changes for this release.
@@ -2792,6 +5867,7 @@
scheme instead of calling AcpiEvaluate Object twice.
Added support for ECDT. This allows the use of the Embedded
+
Controller before the namespace has been fully initialized, which
is necessary for ACPI 2.0 support, and for some laptops to
initialize properly. (Laptops using ECDT are still rare, so only
@@ -2872,6 +5948,7 @@
2) Linux
+
Added preliminary support for obtaining _TRA data for PCI root
bridges (Bjorn Helgaas).
@@ -3010,6 +6087,7 @@
Fixed a problem with the output of both acpidump and adump16
where
the indentation of closing parentheses and brackets was not
+
aligned properly with the parent block.
@@ -3020,6 +6098,7 @@
1) ACPI CA Core Subsystem Version 20020503:
Added support a new OSL interface that allows the host operating
+
system software to override the DSDT found in the firmware -
AcpiOsTableOverride. With this interface, the OSL can examine
the
@@ -3140,6 +6219,7 @@
the OSL) are now bubbled up and will abort a running control
method.
+
Fixed a problem where the per-ACPI-table integer width (32 or 64)
was stored only with control method nodes, causing a fault when
non-control method code was executed during table loading. The
@@ -3251,6 +6331,7 @@
Fixed a problem where a notify handler could only be
installed/removed on an object of type Device. All "notify"
+
objects are now supported -- Devices, Processor, Power, and
Thermal.
@@ -3365,6 +6446,7 @@
Writing to the processor limit interface should now work. "echo
1"
will increase the limit, 2 will decrease, and 0 will reset to the
+
default.
@@ -3569,6 +6651,7 @@
Most TBDs in comments within the source code have been resolved
and eliminated.
+
Fixed a problem in the interpreter where a standalone parent
prefix (^) was not handled correctly in the interpreter and
debugger.
@@ -3705,6 +6788,7 @@
with the Intel 64-bit C/C++ compiler. Most notably, the pointer
add and subtract (diff) macros have changed considerably.
+
Created and deployed a new ACPI_SIZE type that is 64-bits wide on
64-bit platforms, 32-bits on all others. This type is used
wherever memory allocation and/or the C sizeof() operator is
@@ -3736,6 +6820,7 @@
Now checks for (and generates an error if detected) the use of a
Break or Continue statement without an enclosing While statement.
+
Successfully generated the compiler with the Intel 64-bit C
compiler.
@@ -3909,6 +6994,7 @@
+
----------------------------------------
Summary of changes for this label: 11_09_01
@@ -3922,6 +7008,7 @@
Fixed a problem where a Field starting bit offset (within the
parent operation region) was calculated incorrectly if the
+
alignment of the field differed from the access width. This
affected CreateWordField, CreateDwordField, CreateQwordField, and
possibly other fields that use the "AccessAny" keyword.
@@ -4104,11 +7191,13 @@
to output in a more human-readable form.
Current core subsystem library code sizes are shown below. These
+
are the code and data sizes for the acpica.lib produced by the
Microsoft Visual C++ 6.0 compiler, and these values do not
include
any ACPI driver or OSPM code. The debug version of the code
includes the full debug trace mechanism -- leading to a much
+
larger code and data size. Note that these values will vary
depending on the efficiency of the compiler and the compiler
options used during generation.
@@ -4280,6 +7369,7 @@
ASL Compiler, version X2026:
Fixed a problem introduced in the previous label where the AML
+
code emitted for package objects produced packages with zero
length.
@@ -4415,6 +7505,7 @@
interface will simply call down to the CA core to perform the low-
memory search for the table. On IA-64, the RSDP is obtained from
EFI. Migrating this interface to the OSL allows the CA core to
+
remain OS and platform independent.
Added a new interface named AcpiOsSignal to provide a generic
@@ -4576,6 +7667,7 @@
ASL Compiler, version X2018:
+
Added error detection for ASL Fields that extend beyond the
length
of the parent operation region (only if the length of the region
@@ -4604,6 +7696,7 @@
string "ACPI_" for consistency. This may effect existing code.
The data types affected are the external callback typedefs -
e.g.,
+
WALK_CALLBACK becomes ACPI_WALK_CALLBACK.
Linux:
@@ -4759,6 +7852,7 @@
ASL/AML Mutex object semantics are now fully supported. This
includes multiple acquires/releases by owner and support for the
+
Mutex SyncLevel parameter.
A new "Force Release" mechanism automatically frees all ASL
@@ -4832,6 +7926,7 @@
the actual data (in the resource interfaces).
References to named objects within packages are resolved to the
+
full pathname string before packages are returned directly (via
the AcpiEvaluateObject interface) or indirectly via the resource
interfaces.
@@ -5085,6 +8180,7 @@
The new initialization architecture is implemented. New
interfaces are: AcpiInitializeSubsystem (replaces AcpiInitialize)
AcpiEnableSubsystem Obsolete Interfaces: AcpiLoadNamespace
+
(Namespace is automatically loaded when a table is loaded)
The ACPI_OPERAND_OBJECT has been optimized to shrink its size
@@ -5186,6 +8282,7 @@
manifested itself when a Field was created with WordAccess or
DwordAccess, but the field unit defined within the Field was
less
+
than a Word or Dword.
Fixed a problem in AmlDumpOperands() module's loop to pull
@@ -5308,10 +8405,12 @@
A "MaxUnits" parameter has been added to AcpiOsCreateSemaphore.
When set to one, this indicates that the caller wants to use the
+
semaphore as a mutex, not a counting semaphore. ACPI CA uses
both types. However, implementers of this call may want to use
different OS primitives depending on the type of semaphore
requested. For example, some operating systems provide separate
+
"mutex" and "semaphore" interfaces - where the mutex interface
is
much faster because it doesn't have all the overhead of a full
Index: acdispat.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acdispat.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acdispat.h -L sys/contrib/dev/acpica/acdispat.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acdispat.h
+++ sys/contrib/dev/acpica/acdispat.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdispat.h - dispatcher (parser to interpreter interface)
- * $Revision: 58 $
+ * $Revision: 1.76 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,38 +123,9 @@
#define NAMEOF_ARG_NTE "__A0"
-/* Common interfaces */
-
-ACPI_STATUS
-AcpiDsObjStackPush (
- void *Object,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiDsObjStackPop (
- UINT32 PopCount,
- ACPI_WALK_STATE *WalkState);
-
-void *
-AcpiDsObjStackGetValue (
- UINT32 Index,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiDsObjStackPopObject (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState);
-
-
-/* dsopcode - support for late evaluation */
-
-ACPI_STATUS
-AcpiDsExecuteArguments (
- ACPI_NAMESPACE_NODE *Node,
- ACPI_NAMESPACE_NODE *ScopeNode,
- UINT32 AmlLength,
- UINT8 *AmlStart);
-
+/*
+ * dsopcode - support for late evaluation
+ */
ACPI_STATUS
AcpiDsGetBufferFieldArguments (
ACPI_OPERAND_OBJECT *ObjDesc);
@@ -172,15 +143,6 @@
ACPI_OPERAND_OBJECT *ObjDesc);
ACPI_STATUS
-AcpiDsInitBufferField (
- UINT16 AmlOpcode,
- ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_OPERAND_OBJECT *BufferDesc,
- ACPI_OPERAND_OBJECT *OffsetDesc,
- ACPI_OPERAND_OBJECT *LengthDesc,
- ACPI_OPERAND_OBJECT *ResultDesc);
-
-ACPI_STATUS
AcpiDsEvalBufferFieldOperands (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op);
@@ -201,9 +163,9 @@
ACPI_HANDLE ObjHandle);
-/* dsctrl - Parser/Interpreter interface, control stack routines */
-
-
+/*
+ * dsctrl - Parser/Interpreter interface, control stack routines
+ */
ACPI_STATUS
AcpiDsExecBeginControlOp (
ACPI_WALK_STATE *WalkState,
@@ -215,9 +177,9 @@
ACPI_PARSE_OBJECT *Op);
-/* dsexec - Parser/Interpreter interface, method execution callbacks */
-
-
+/*
+ * dsexec - Parser/Interpreter interface, method execution callbacks
+ */
ACPI_STATUS
AcpiDsGetPredicateValue (
ACPI_WALK_STATE *WalkState,
@@ -233,14 +195,9 @@
ACPI_WALK_STATE *State);
-/* dsfield - Parser/Interpreter interface for AML fields */
-
-ACPI_STATUS
-AcpiDsGetFieldNames (
- ACPI_CREATE_FIELD_INFO *Info,
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Arg);
-
+/*
+ * dsfield - Parser/Interpreter interface for AML fields
+ */
ACPI_STATUS
AcpiDsCreateField (
ACPI_PARSE_OBJECT *Op,
@@ -270,8 +227,9 @@
ACPI_WALK_STATE *WalkState);
-/* dsload - Parser/Interpreter interface, namespace load callbacks */
-
+/*
+ * dsload - Parser/Interpreter interface, namespace load callbacks
+ */
ACPI_STATUS
AcpiDsLoad1BeginOp (
ACPI_WALK_STATE *WalkState,
@@ -296,9 +254,9 @@
UINT32 PassNumber);
-/* dsmthdat - method data (locals/args) */
-
-
+/*
+ * dsmthdat - method data (locals/args)
+ */
ACPI_STATUS
AcpiDsStoreObjectToLocal (
UINT16 Opcode,
@@ -321,12 +279,6 @@
AcpiDsIsMethodValue (
ACPI_OPERAND_OBJECT *ObjDesc);
-ACPI_OBJECT_TYPE
-AcpiDsMethodDataGetType (
- UINT16 Opcode,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState);
-
ACPI_STATUS
AcpiDsMethodDataGetValue (
UINT16 Opcode,
@@ -334,12 +286,6 @@
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT **DestDesc);
-void
-AcpiDsMethodDataDeleteValue (
- UINT16 Opcode,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState);
-
ACPI_STATUS
AcpiDsMethodDataInitArgs (
ACPI_OPERAND_OBJECT **Params,
@@ -357,19 +303,13 @@
AcpiDsMethodDataInit (
ACPI_WALK_STATE *WalkState);
-ACPI_STATUS
-AcpiDsMethodDataSetValue (
- UINT16 Opcode,
- UINT32 Index,
- ACPI_OPERAND_OBJECT *Object,
- ACPI_WALK_STATE *WalkState);
-
-
-/* dsmethod - Parser/Interpreter interface - control method parsing */
+/*
+ * dsmethod - Parser/Interpreter interface - control method parsing
+ */
ACPI_STATUS
AcpiDsParseMethod (
- ACPI_HANDLE ObjHandle);
+ ACPI_NAMESPACE_NODE *Node);
ACPI_STATUS
AcpiDsCallControlMethod (
@@ -382,31 +322,34 @@
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ReturnDesc);
-ACPI_STATUS
+void
AcpiDsTerminateControlMethod (
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState);
ACPI_STATUS
AcpiDsBeginMethodExecution (
ACPI_NAMESPACE_NODE *MethodNode,
ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_NAMESPACE_NODE *CallingMethodNode);
-
-
-/* dsobj - Parser/Interpreter interface - object initialization and conversion */
+ ACPI_WALK_STATE *WalkState);
ACPI_STATUS
-AcpiDsInitOneObject (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Context,
- void **ReturnValue);
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState);
+/*
+ * dsinit
+ */
ACPI_STATUS
AcpiDsInitializeObjects (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *StartNode);
+
+/*
+ * dsobject - Parser/Interpreter interface - object initialization and conversion
+ */
ACPI_STATUS
AcpiDsBuildInternalBufferObj (
ACPI_WALK_STATE *WalkState,
@@ -422,12 +365,6 @@
ACPI_OPERAND_OBJECT **ObjDesc);
ACPI_STATUS
-AcpiDsBuildInternalObject (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op,
- ACPI_OPERAND_OBJECT **ObjDescPtr);
-
-ACPI_STATUS
AcpiDsInitObjectFromOp (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Op,
@@ -441,7 +378,18 @@
ACPI_PARSE_OBJECT *Op);
-/* dsutils - Parser/Interpreter interface utility routines */
+/*
+ * dsutils - Parser/Interpreter interface utility routines
+ */
+void
+AcpiDsClearImplicitReturn (
+ ACPI_WALK_STATE *WalkState);
+
+BOOLEAN
+AcpiDsDoImplicitReturn (
+ ACPI_OPERAND_OBJECT *ReturnDesc,
+ ACPI_WALK_STATE *WalkState,
+ BOOLEAN AddReference);
BOOLEAN
AcpiDsIsResultUsed (
@@ -473,11 +421,14 @@
AcpiDsClearOperands (
ACPI_WALK_STATE *WalkState);
+ACPI_STATUS
+AcpiDsEvaluateNamePath (
+ ACPI_WALK_STATE *WalkState);
+
/*
* dswscope - Scope Stack manipulation
*/
-
ACPI_STATUS
AcpiDsScopeStackPush (
ACPI_NAMESPACE_NODE *Node,
@@ -494,7 +445,18 @@
ACPI_WALK_STATE *WalkState);
-/* dswstate - parser WALK_STATE management routines */
+/*
+ * dswstate - parser WALK_STATE management routines
+ */
+ACPI_STATUS
+AcpiDsObjStackPush (
+ void *Object,
+ ACPI_WALK_STATE *WalkState);
+
+ACPI_STATUS
+AcpiDsObjStackPop (
+ UINT32 PopCount,
+ ACPI_WALK_STATE *WalkState);
ACPI_WALK_STATE *
AcpiDsCreateWalkState (
@@ -510,14 +472,10 @@
ACPI_NAMESPACE_NODE *MethodNode,
UINT8 *AmlStart,
UINT32 AmlLength,
- ACPI_PARAMETER_INFO *Info,
- UINT32 PassNumber);
-
-ACPI_STATUS
-AcpiDsObjStackDeleteAll (
- ACPI_WALK_STATE *WalkState);
+ ACPI_EVALUATE_INFO *Info,
+ UINT8 PassNumber);
-ACPI_STATUS
+void
AcpiDsObjStackPopAndDelete (
UINT32 PopCount,
ACPI_WALK_STATE *WalkState);
@@ -536,14 +494,6 @@
ACPI_THREAD_STATE *Thread);
ACPI_STATUS
-AcpiDsResultStackPop (
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiDsResultStackPush (
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
AcpiDsResultStackClear (
ACPI_WALK_STATE *WalkState);
@@ -551,22 +501,6 @@
AcpiDsGetCurrentWalkState (
ACPI_THREAD_STATE *Thread);
-void
-AcpiDsDeleteWalkStateCache (
- void);
-
-ACPI_STATUS
-AcpiDsResultInsert (
- void *Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState);
-
-ACPI_STATUS
-AcpiDsResultRemove (
- ACPI_OPERAND_OBJECT **Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState);
-
ACPI_STATUS
AcpiDsResultPop (
ACPI_OPERAND_OBJECT **Object,
@@ -577,9 +511,4 @@
ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState);
-ACPI_STATUS
-AcpiDsResultPopFromBottom (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState);
-
#endif /* _ACDISPAT_H_ */
Index: rsirq.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsirq.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsirq.c -L sys/contrib/dev/acpica/rsirq.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsirq.c
+++ sys/contrib/dev/acpica/rsirq.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsirq - IRQ resource descriptors
- * $Revision: 38 $
+ * $Revision: 1.50 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,563 +125,189 @@
/*******************************************************************************
*
- * FUNCTION: AcpiRsIrqResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsGetIrq
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsIrqResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsGetIrq[7] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- UINT8 Index;
- UINT8 i;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IRQ);
-
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IRQ,
+ ACPI_RS_SIZE (ACPI_RESOURCE_IRQ),
+ ACPI_RSC_TABLE_SIZE (AcpiRsGetIrq)},
- ACPI_FUNCTION_TRACE ("RsIrqResource");
+ /* Get the IRQ mask (bytes 1:2) */
+ {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]),
+ AML_OFFSET (Irq.IrqMask),
+ ACPI_RS_OFFSET (Data.Irq.InterruptCount)},
- /*
- * The number of bytes consumed are contained in the descriptor
- * (Bits:0-1)
- */
- Temp8 = *Buffer;
- *BytesConsumed = (Temp8 & 0x03) + 1;
- OutputStruct->Id = ACPI_RSTYPE_IRQ;
+ /* Set default flags (others are zero) */
- /*
- * Point to the 16-bits of Bytes 1 and 2
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.Irq.Triggering),
+ ACPI_EDGE_SENSITIVE,
+ 1},
- OutputStruct->Data.Irq.NumberOfInterrupts = 0;
+ /* All done if no flag byte present in descriptor */
- /* Decode the IRQ bits */
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 3},
- for (i = 0, Index = 0; Index < 16; Index++)
- {
- if ((Temp16 >> Index) & 0x01)
- {
- OutputStruct->Data.Irq.Interrupts[i] = Index;
- i++;
- }
- }
-
- /* Zero interrupts is valid */
-
- OutputStruct->Data.Irq.NumberOfInterrupts = i;
- if (i > 0)
- {
- /*
- * Calculate the structure size based upon the number of interrupts
- */
- StructSize += ((ACPI_SIZE) i - 1) * 4;
- }
+ /* Get flags: Triggering[0], Polarity[3], Sharing[4] */
- /*
- * Point to Byte 3 if it is used
- */
- if (4 == *BytesConsumed)
- {
- Buffer += 2;
- Temp8 = *Buffer;
-
- /*
- * Check for HE, LL interrupts
- */
- switch (Temp8 & 0x09)
- {
- case 0x01: /* HE */
- OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE;
- OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH;
- break;
-
- case 0x08: /* LL */
- OutputStruct->Data.Irq.EdgeLevel = ACPI_LEVEL_SENSITIVE;
- OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_LOW;
- break;
-
- default:
- /*
- * Only _LL and _HE polarity/trigger interrupts
- * are allowed (ACPI spec, section "IRQ Format")
- * so 0x00 and 0x09 are illegal.
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid interrupt polarity/trigger in resource list, %X\n", Temp8));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
-
- /*
- * Check for sharable
- */
- OutputStruct->Data.Irq.SharedExclusive = (Temp8 >> 3) & 0x01;
- }
- else
- {
- /*
- * Assume Edge Sensitive, Active High, Non-Sharable
- * per ACPI Specification
- */
- OutputStruct->Data.Irq.EdgeLevel = ACPI_EDGE_SENSITIVE;
- OutputStruct->Data.Irq.ActiveHighLow = ACPI_ACTIVE_HIGH;
- OutputStruct->Data.Irq.SharedExclusive = ACPI_EXCLUSIVE;
- }
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering),
+ AML_OFFSET (Irq.Flags),
+ 0},
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity),
+ AML_OFFSET (Irq.Flags),
+ 3},
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable),
+ AML_OFFSET (Irq.Flags),
+ 4}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsIrqStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsSetIrq
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsIrqStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsSetIrq[9] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- UINT8 Index;
- BOOLEAN IRQInfoByteNeeded;
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IRQ,
+ sizeof (AML_RESOURCE_IRQ),
+ ACPI_RSC_TABLE_SIZE (AcpiRsSetIrq)},
+ /* Convert interrupt list to 16-bit IRQ bitmask */
- ACPI_FUNCTION_TRACE ("RsIrqStream");
+ {ACPI_RSC_BITMASK16,ACPI_RS_OFFSET (Data.Irq.Interrupts[0]),
+ AML_OFFSET (Irq.IrqMask),
+ ACPI_RS_OFFSET (Data.Irq.InterruptCount)},
+ /* Set the flags byte by default */
- /*
- * The descriptor field is set based upon whether a third byte is
- * needed to contain the IRQ Information.
- */
- if (ACPI_EDGE_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
- ACPI_ACTIVE_HIGH == LinkedList->Data.Irq.ActiveHighLow &&
- ACPI_EXCLUSIVE == LinkedList->Data.Irq.SharedExclusive)
- {
- *Buffer = 0x22;
- IRQInfoByteNeeded = FALSE;
- }
- else
- {
- *Buffer = 0x23;
- IRQInfoByteNeeded = TRUE;
- }
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Triggering),
+ AML_OFFSET (Irq.Flags),
+ 0},
- Buffer += 1;
- Temp16 = 0;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Polarity),
+ AML_OFFSET (Irq.Flags),
+ 3},
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Irq.Sharable),
+ AML_OFFSET (Irq.Flags),
+ 4},
/*
- * Loop through all of the interrupts and set the mask bits
+ * Check if the flags byte is necessary. Not needed if the flags are:
+ * ACPI_EDGE_SENSITIVE, ACPI_ACTIVE_HIGH, ACPI_EXCLUSIVE
*/
- for(Index = 0;
- Index < LinkedList->Data.Irq.NumberOfInterrupts;
- Index++)
- {
- Temp8 = (UINT8) LinkedList->Data.Irq.Interrupts[Index];
- Temp16 |= 0x1 << Temp8;
- }
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET (Data.Irq.Triggering),
+ ACPI_EDGE_SENSITIVE},
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET (Data.Irq.Polarity),
+ ACPI_ACTIVE_HIGH},
- /*
- * Set the IRQ Info byte if needed.
- */
- if (IRQInfoByteNeeded)
- {
- Temp8 = 0;
- Temp8 = (UINT8) ((LinkedList->Data.Irq.SharedExclusive &
- 0x01) << 4);
-
- if (ACPI_LEVEL_SENSITIVE == LinkedList->Data.Irq.EdgeLevel &&
- ACPI_ACTIVE_LOW == LinkedList->Data.Irq.ActiveHighLow)
- {
- Temp8 |= 0x08;
- }
- else
- {
- Temp8 |= 0x01;
- }
-
- *Buffer = Temp8;
- Buffer += 1;
- }
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET (Data.Irq.Sharable),
+ ACPI_EXCLUSIVE},
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
+ /* IrqNoFlags() descriptor can be used */
+
+ {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_IRQ_NOFLAGS)}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsExtendedIrqResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertExtIrq
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsExtendedIrqResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[9] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- UINT8 *TempPtr;
- UINT8 Index;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ);
-
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_EXTENDED_IRQ,
+ ACPI_RS_SIZE (ACPI_RESOURCE_EXTENDED_IRQ),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertExtIrq)},
- ACPI_FUNCTION_TRACE ("RsExtendedIrqResource");
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_EXTENDED_IRQ,
+ sizeof (AML_RESOURCE_EXTENDED_IRQ),
+ 0},
+ /* Flag bits */
- /*
- * Point past the Descriptor to get the number of bytes consumed
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- /* Validate minimum descriptor length */
-
- if (Temp16 < 6)
- {
- return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
- }
-
- *BytesConsumed = Temp16 + 3;
- OutputStruct->Id = ACPI_RSTYPE_EXT_IRQ;
-
- /*
- * Point to the Byte3
- */
- Buffer += 2;
- Temp8 = *Buffer;
-
- OutputStruct->Data.ExtendedIrq.ProducerConsumer = Temp8 & 0x01;
-
- /*
- * Check for Interrupt Mode
- *
- * The definition of an Extended IRQ changed between ACPI spec v1.0b
- * and ACPI spec 2.0 (section 6.4.3.6 in both).
- *
- * - Edge/Level are defined opposite in the table vs the headers
- */
- OutputStruct->Data.ExtendedIrq.EdgeLevel =
- (Temp8 & 0x2) ? ACPI_EDGE_SENSITIVE : ACPI_LEVEL_SENSITIVE;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.ProducerConsumer),
+ AML_OFFSET (ExtendedIrq.Flags),
+ 0},
- /*
- * Check Interrupt Polarity
- */
- OutputStruct->Data.ExtendedIrq.ActiveHighLow = (Temp8 >> 2) & 0x1;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Triggering),
+ AML_OFFSET (ExtendedIrq.Flags),
+ 1},
- /*
- * Check for sharable
- */
- OutputStruct->Data.ExtendedIrq.SharedExclusive = (Temp8 >> 3) & 0x01;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Polarity),
+ AML_OFFSET (ExtendedIrq.Flags),
+ 2},
- /*
- * Point to Byte4 (IRQ Table length)
- */
- Buffer += 1;
- Temp8 = *Buffer;
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.ExtendedIrq.Sharable),
+ AML_OFFSET (ExtendedIrq.Flags),
+ 3},
- /* Must have at least one IRQ */
+ /* IRQ Table length (Byte4) */
- if (Temp8 < 1)
- {
- return_ACPI_STATUS (AE_AML_BAD_RESOURCE_LENGTH);
- }
+ {ACPI_RSC_COUNT, ACPI_RS_OFFSET (Data.ExtendedIrq.InterruptCount),
+ AML_OFFSET (ExtendedIrq.InterruptCount),
+ sizeof (UINT32)},
- OutputStruct->Data.ExtendedIrq.NumberOfInterrupts = Temp8;
+ /* Copy every IRQ in the table, each is 32 bits */
- /*
- * Add any additional structure size to properly calculate
- * the next pointer at the end of this function
- */
- StructSize += (Temp8 - 1) * 4;
+ {ACPI_RSC_MOVE32, ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]),
+ AML_OFFSET (ExtendedIrq.Interrupts[0]),
+ 0},
- /*
- * Point to Byte5 (First IRQ Number)
- */
- Buffer += 1;
+ /* Optional ResourceSource (Index and String) */
- /*
- * Cycle through every IRQ in the table
- */
- for (Index = 0; Index < Temp8; Index++)
- {
- ACPI_MOVE_32_TO_32 (
- &OutputStruct->Data.ExtendedIrq.Interrupts[Index], Buffer);
-
- /* Point to the next IRQ */
-
- Buffer += 4;
- }
-
- /*
- * This will leave us pointing to the Resource Source Index
- * If it is present, then save it off and calculate the
- * pointer to where the null terminated string goes:
- * Each Interrupt takes 32-bits + the 5 bytes of the
- * stream that are default.
- *
- * Note: Some resource descriptors will have an additional null, so
- * we add 1 to the length.
- */
- if (*BytesConsumed >
- ((ACPI_SIZE) OutputStruct->Data.ExtendedIrq.NumberOfInterrupts * 4) + (5 + 1))
- {
- /* Dereference the Index */
-
- Temp8 = *Buffer;
- OutputStruct->Data.ExtendedIrq.ResourceSource.Index = (UINT32) Temp8;
-
- /* Point to the String */
-
- Buffer += 1;
-
- /*
- * Point the String pointer to the end of this structure.
- */
- OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr =
- (char *)((char *) OutputStruct + StructSize);
-
- TempPtr = (UINT8 *) OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr;
-
- /* Copy the string into the buffer */
-
- Index = 0;
- while (0x00 != *Buffer)
- {
- *TempPtr = *Buffer;
-
- TempPtr += 1;
- Buffer += 1;
- Index += 1;
- }
-
- /*
- * Add the terminating null
- */
- *TempPtr = 0x00;
- OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = Index + 1;
-
- /*
- * In order for the StructSize to fall on a 32-bit boundary,
- * calculate the length of the string and expand the
- * StructSize to the next 32-bit boundary.
- */
- Temp8 = (UINT8) (Index + 1);
- StructSize += ACPI_ROUND_UP_TO_32BITS (Temp8);
- }
- else
- {
- OutputStruct->Data.ExtendedIrq.ResourceSource.Index = 0x00;
- OutputStruct->Data.ExtendedIrq.ResourceSource.StringLength = 0;
- OutputStruct->Data.ExtendedIrq.ResourceSource.StringPtr = NULL;
- }
-
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_SOURCEX, ACPI_RS_OFFSET (Data.ExtendedIrq.ResourceSource),
+ ACPI_RS_OFFSET (Data.ExtendedIrq.Interrupts[0]),
+ sizeof (AML_RESOURCE_EXTENDED_IRQ)}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsExtendedIrqStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsConvertDma
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsExtendedIrqStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsConvertDma[6] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 *LengthField;
- UINT8 Temp8 = 0;
- UINT8 Index;
- char *TempPointer = NULL;
-
-
- ACPI_FUNCTION_TRACE ("RsExtendedIrqStream");
-
-
- /*
- * The descriptor field is static
- */
- *Buffer = 0x89;
- Buffer += 1;
-
- /*
- * Set a pointer to the Length field - to be filled in later
- */
- LengthField = ACPI_CAST_PTR (UINT16, Buffer);
- Buffer += 2;
-
- /*
- * Set the Interrupt vector flags
- */
- Temp8 = (UINT8)(LinkedList->Data.ExtendedIrq.ProducerConsumer & 0x01);
- Temp8 |= ((LinkedList->Data.ExtendedIrq.SharedExclusive & 0x01) << 3);
-
- /*
- * Set the Interrupt Mode
- *
- * The definition of an Extended IRQ changed between ACPI spec v1.0b
- * and ACPI spec 2.0 (section 6.4.3.6 in both). This code does not
- * implement the more restrictive definition of 1.0b
- *
- * - Edge/Level are defined opposite in the table vs the headers
- */
- if (ACPI_EDGE_SENSITIVE == LinkedList->Data.ExtendedIrq.EdgeLevel)
- {
- Temp8 |= 0x2;
- }
-
- /*
- * Set the Interrupt Polarity
- */
- Temp8 |= ((LinkedList->Data.ExtendedIrq.ActiveHighLow & 0x1) << 2);
-
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the Interrupt table length
- */
- Temp8 = (UINT8) LinkedList->Data.ExtendedIrq.NumberOfInterrupts;
-
- *Buffer = Temp8;
- Buffer += 1;
-
- for (Index = 0; Index < LinkedList->Data.ExtendedIrq.NumberOfInterrupts;
- Index++)
- {
- ACPI_MOVE_32_TO_32 (Buffer,
- &LinkedList->Data.ExtendedIrq.Interrupts[Index]);
- Buffer += 4;
- }
-
- /*
- * Resource Source Index and Resource Source are optional
- */
- if (0 != LinkedList->Data.ExtendedIrq.ResourceSource.StringLength)
- {
- *Buffer = (UINT8) LinkedList->Data.ExtendedIrq.ResourceSource.Index;
- Buffer += 1;
-
- TempPointer = (char *) Buffer;
-
- /*
- * Copy the string
- */
- ACPI_STRCPY (TempPointer,
- LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr);
-
- /*
- * Buffer needs to be set to the length of the sting + one for the
- * terminating null
- */
- Buffer += (ACPI_SIZE)(ACPI_STRLEN (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr) + 1);
- }
-
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
-
- /*
- * Set the length field to the number of bytes consumed
- * minus the header size (3 bytes)
- */
- *LengthField = (UINT16) (*BytesConsumed - 3);
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_DMA,
+ ACPI_RS_SIZE (ACPI_RESOURCE_DMA),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertDma)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_DMA,
+ sizeof (AML_RESOURCE_DMA),
+ 0},
+
+ /* Flags: transfer preference, bus mastering, channel speed */
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Transfer),
+ AML_OFFSET (Dma.Flags),
+ 0},
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Dma.BusMaster),
+ AML_OFFSET (Dma.Flags),
+ 2},
+
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.Dma.Type),
+ AML_OFFSET (Dma.Flags),
+ 5},
+
+ /* DMA channel mask bits */
+
+ {ACPI_RSC_BITMASK, ACPI_RS_OFFSET (Data.Dma.Channels[0]),
+ AML_OFFSET (Dma.DmaChannelMask),
+ ACPI_RS_OFFSET (Data.Dma.ChannelCount)}
+};
Index: nsaccess.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsaccess.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsaccess.c -L sys/contrib/dev/acpica/nsaccess.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsaccess.c
+++ sys/contrib/dev/acpica/nsaccess.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsaccess - Top-level functions for accessing ACPI namespace
- * $Revision: 184 $
+ * $Revision: 1.206 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -141,7 +141,8 @@
******************************************************************************/
ACPI_STATUS
-AcpiNsRootInitialize (void)
+AcpiNsRootInitialize (
+ void)
{
ACPI_STATUS Status;
const ACPI_PREDEFINED_NAMES *InitVal = NULL;
@@ -150,7 +151,7 @@
ACPI_STRING Val = NULL;
- ACPI_FUNCTION_TRACE ("NsRootInitialize");
+ ACPI_FUNCTION_TRACE (NsRootInitialize);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -195,9 +196,9 @@
if (ACPI_FAILURE (Status) || (!NewNode)) /* Must be on same line for code converter */
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not create predefined name %s, %s\n",
- InitVal->Name, AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not create predefined name %s",
+ InitVal->Name));
}
/*
@@ -210,8 +211,8 @@
Status = AcpiOsPredefinedOverride (InitVal, &Val);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not override predefined %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Could not override predefined %s",
InitVal->Name));
}
@@ -239,29 +240,28 @@
switch (InitVal->Type)
{
case ACPI_TYPE_METHOD:
- ObjDesc->Method.ParamCount = (UINT8) ACPI_STRTOUL
- (Val, NULL, 10);
+ ObjDesc->Method.ParamCount = (UINT8) ACPI_TO_INTEGER (Val);
ObjDesc->Common.Flags |= AOPOBJ_DATA_VALID;
-#if defined (_ACPI_ASL_COMPILER) || defined (_ACPI_DUMP_APP)
+#if defined (ACPI_ASL_COMPILER)
- /*
- * iASL Compiler cheats by putting parameter count
- * in the OwnerID
- */
- NewNode->OwnerId = ObjDesc->Method.ParamCount;
+ /* Save the parameter count for the iASL compiler */
+
+ NewNode->Value = ObjDesc->Method.ParamCount;
#else
/* Mark this as a very SPECIAL method */
ObjDesc->Method.MethodFlags = AML_METHOD_INTERNAL_ONLY;
+
+#ifndef ACPI_DUMP_APP
ObjDesc->Method.Implementation = AcpiUtOsiImplementation;
#endif
+#endif
break;
case ACPI_TYPE_INTEGER:
- ObjDesc->Integer.Value =
- (ACPI_INTEGER) ACPI_STRTOUL (Val, NULL, 10);
+ ObjDesc->Integer.Value = ACPI_TO_INTEGER (Val);
break;
@@ -279,35 +279,27 @@
case ACPI_TYPE_MUTEX:
ObjDesc->Mutex.Node = NewNode;
- ObjDesc->Mutex.SyncLevel = (UINT8) ACPI_STRTOUL
- (Val, NULL, 10);
+ ObjDesc->Mutex.SyncLevel = (UINT8) (ACPI_TO_INTEGER (Val) - 1);
- if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)
- {
- /*
- * Create a counting semaphore for the
- * global lock
- */
- Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT,
- 1, &ObjDesc->Mutex.Semaphore);
- if (ACPI_FAILURE (Status))
- {
- AcpiUtRemoveReference (ObjDesc);
- goto UnlockAndExit;
- }
+ /* Create a mutex */
- /*
- * We just created the mutex for the
- * global lock, save it
- */
- AcpiGbl_GlobalLockSemaphore = ObjDesc->Mutex.Semaphore;
+ Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ goto UnlockAndExit;
}
- else
+
+ /* Special case for ACPI Global Lock */
+
+ if (ACPI_STRCMP (InitVal->Name, "_GL_") == 0)
{
- /* Create a mutex */
+ AcpiGbl_GlobalLockMutex = ObjDesc;
- Status = AcpiOsCreateSemaphore (1, 1,
- &ObjDesc->Mutex.Semaphore);
+ /* Create additional counting semaphore for global lock */
+
+ Status = AcpiOsCreateSemaphore (
+ 1, 0, &AcpiGbl_GlobalLockSemaphore);
if (ACPI_FAILURE (Status))
{
AcpiUtRemoveReference (ObjDesc);
@@ -319,7 +311,7 @@
default:
- ACPI_REPORT_ERROR (("Unsupported initial type value %X\n",
+ ACPI_ERROR ((AE_INFO, "Unsupported initial type value %X",
InitVal->Type));
AcpiUtRemoveReference (ObjDesc);
ObjDesc = NULL;
@@ -345,8 +337,8 @@
if (ACPI_SUCCESS (Status))
{
- Status = AcpiNsGetNodeByPath ("\\_GPE", NULL, ACPI_NS_NO_UPSEARCH,
- &AcpiGbl_FadtGpeDevice);
+ Status = AcpiNsGetNode (NULL, "\\_GPE", ACPI_NS_NO_UPSEARCH,
+ &AcpiGbl_FadtGpeDevice);
}
return_ACPI_STATUS (Status);
@@ -357,7 +349,7 @@
*
* FUNCTION: AcpiNsLookup
*
- * PARAMETERS: PrefixNode - Search scope if name is not fully qualified
+ * PARAMETERS: ScopeInfo - Current scope info block
* Pathname - Search pathname, in internal format
* (as represented in the AML stream)
* Type - Type associated with name
@@ -397,11 +389,10 @@
ACPI_OBJECT_TYPE TypeToCheckFor;
ACPI_OBJECT_TYPE ThisSearchType;
UINT32 SearchParentFlag = ACPI_NS_SEARCH_PARENT;
- UINT32 LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND |
- ACPI_NS_SEARCH_PARENT);
+ UINT32 LocalFlags;
- ACPI_FUNCTION_TRACE ("NsLookup");
+ ACPI_FUNCTION_TRACE (NsLookup);
if (!ReturnNode)
@@ -409,8 +400,9 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- AcpiGbl_NsLookupCount++;
+ LocalFlags = Flags & ~(ACPI_NS_ERROR_IF_FOUND | ACPI_NS_SEARCH_PARENT);
*ReturnNode = ACPI_ENTRY_NOT_FOUND;
+ AcpiGbl_NsLookupCount++;
if (!AcpiGbl_RootNode)
{
@@ -435,20 +427,23 @@
PrefixNode = ScopeInfo->Scope.Node;
if (ACPI_GET_DESCRIPTOR_TYPE (PrefixNode) != ACPI_DESC_TYPE_NAMED)
{
- ACPI_REPORT_ERROR (("NsLookup: %p is not a namespace node [%s]\n",
- PrefixNode, AcpiUtGetDescriptorName (PrefixNode)));
+ ACPI_ERROR ((AE_INFO, "%p is not a namespace node [%s]",
+ PrefixNode, AcpiUtGetDescriptorName (PrefixNode)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
- /*
- * This node might not be a actual "scope" node (such as a
- * Device/Method, etc.) It could be a Package or other object node.
- * Backup up the tree to find the containing scope node.
- */
- while (!AcpiNsOpensScope (PrefixNode->Type) &&
- PrefixNode->Type != ACPI_TYPE_ANY)
+ if (!(Flags & ACPI_NS_PREFIX_IS_SCOPE))
{
- PrefixNode = AcpiNsGetParentNode (PrefixNode);
+ /*
+ * This node might not be a actual "scope" node (such as a
+ * Device/Method, etc.) It could be a Package or other object node.
+ * Backup up the tree to find the containing scope node.
+ */
+ while (!AcpiNsOpensScope (PrefixNode->Type) &&
+ PrefixNode->Type != ACPI_TYPE_ANY)
+ {
+ PrefixNode = AcpiNsGetParentNode (PrefixNode);
+ }
}
}
@@ -463,9 +458,9 @@
{
/* A Null NamePath is allowed and refers to the root */
- NumSegments = 0;
- ThisNode = AcpiGbl_RootNode;
- Path = "";
+ NumSegments = 0;
+ ThisNode = AcpiGbl_RootNode;
+ Path = "";
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
"Null Pathname (Zero segments), Flags=%X\n", Flags));
@@ -532,8 +527,8 @@
{
/* Current scope has no parent scope */
- ACPI_REPORT_ERROR (
- ("ACPI path has too many parent prefixes (^) - reached beyond root node\n"));
+ ACPI_ERROR ((AE_INFO,
+ "ACPI path has too many parent prefixes (^) - reached beyond root node"));
return_ACPI_STATUS (AE_NOT_FOUND);
}
}
@@ -602,7 +597,7 @@
Path++;
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Multi Pathname (%d Segments, Flags=%X) \n",
+ "Multi Pathname (%d Segments, Flags=%X)\n",
NumSegments, Flags));
break;
@@ -697,19 +692,20 @@
*
* Then we have a type mismatch. Just warn and ignore it.
*/
- if ((NumSegments == 0) &&
- (TypeToCheckFor != ACPI_TYPE_ANY) &&
- (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) &&
- (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
- (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) &&
- (ThisNode->Type != ACPI_TYPE_ANY) &&
- (ThisNode->Type != TypeToCheckFor))
+ if ((NumSegments == 0) &&
+ (TypeToCheckFor != ACPI_TYPE_ANY) &&
+ (TypeToCheckFor != ACPI_TYPE_LOCAL_ALIAS) &&
+ (TypeToCheckFor != ACPI_TYPE_LOCAL_METHOD_ALIAS) &&
+ (TypeToCheckFor != ACPI_TYPE_LOCAL_SCOPE) &&
+ (ThisNode->Type != ACPI_TYPE_ANY) &&
+ (ThisNode->Type != TypeToCheckFor))
{
/* Complain about a type mismatch */
- ACPI_REPORT_WARNING (
- ("NsLookup: Type mismatch on %4.4s (%s), searching for (%s)\n",
- (char *) &SimpleName, AcpiUtGetTypeName (ThisNode->Type),
+ ACPI_WARNING ((AE_INFO,
+ "NsLookup: Type mismatch on %4.4s (%s), searching for (%s)",
+ ACPI_CAST_PTR (char, &SimpleName),
+ AcpiUtGetTypeName (ThisNode->Type),
AcpiUtGetTypeName (TypeToCheckFor)));
}
Index: dmutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmutils.c -L sys/contrib/dev/acpica/dmutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmutils.c
+++ sys/contrib/dev/acpica/dmutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmutils - AML disassembler utilities
- * $Revision: 10 $
+ * $Revision: 1.25 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,8 +118,10 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/amlcode.h>
#include <contrib/dev/acpica/acdisasm.h>
-#include <contrib/dev/acpica/acnamesp.h>
+#ifdef ACPI_ASL_COMPILER
+#include <contrib/dev/acpica/acnamesp.h>
+#endif
#ifdef ACPI_DISASSEMBLER
@@ -132,15 +134,16 @@
/* Data used in keeping track of fields */
#if 0
-const char *AcpiGbl_FENames[ACPI_NUM_FIELD_NAMES] =
+const char *AcpiGbl_FENames[] =
{
"skip",
"?access?"
}; /* FE = Field Element */
#endif
+/* Operators for Match() */
-const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS] =
+const char *AcpiGbl_MatchOps[] =
{
"MTR",
"MEQ",
@@ -150,10 +153,9 @@
"MGT"
};
-
/* Access type decoding */
-const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES] =
+const char *AcpiGbl_AccessTypes[] =
{
"AnyAcc",
"ByteAcc",
@@ -161,12 +163,13 @@
"DWordAcc",
"QWordAcc",
"BufferAcc",
+ "InvalidAccType",
+ "InvalidAccType"
};
-
/* Lock rule decoding */
-const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES] =
+const char *AcpiGbl_LockRule[] =
{
"NoLock",
"Lock"
@@ -174,123 +177,32 @@
/* Update rule decoding */
-const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES] =
+const char *AcpiGbl_UpdateRules[] =
{
"Preserve",
"WriteAsOnes",
- "WriteAsZeros"
-};
-
-/*
- * Strings used to decode resource descriptors
- */
-const char *AcpiGbl_IoDecode[2] =
-{
- "Decode10",
- "Decode16"
-};
-
-const char *AcpiGbl_WordDecode[4] =
-{
- "WordMemory",
- "WordIO",
- "WordBusNumber",
- "Unknown-resource-type"
-};
-
-const char *AcpiGbl_ConsumeDecode[2] =
-{
- "ResourceProducer",
- "ResourceConsumer"
-};
-
-const char *AcpiGbl_MinDecode[2] =
-{
- "MinNotFixed",
- "MinFixed"
-};
-
-const char *AcpiGbl_MaxDecode[2] =
-{
- "MaxNotFixed",
- "MaxFixed"
-};
-
-const char *AcpiGbl_DECDecode[2] =
-{
- "PosDecode",
- "SubDecode"
-};
-
-const char *AcpiGbl_RNGDecode[4] =
-{
- "InvalidRanges",
- "NonISAOnlyRanges",
- "ISAOnlyRanges",
- "EntireRange"
+ "WriteAsZeros",
+ "InvalidUpdateRule"
};
-const char *AcpiGbl_MEMDecode[4] =
-{
- "NonCacheable",
- "Cacheable",
- "WriteCombining",
- "Prefetchable"
-};
+/* Strings used to decode resource descriptors */
-const char *AcpiGbl_RWDecode[2] =
+const char *AcpiGbl_WordDecode[] =
{
- "ReadOnly",
- "ReadWrite"
+ "Memory",
+ "IO",
+ "BusNumber",
+ "UnknownResourceType"
};
-const char *AcpiGbl_IrqDecode[2] =
+const char *AcpiGbl_IrqDecode[] =
{
"IRQNoFlags",
"IRQ"
};
-const char *AcpiGbl_HEDecode[2] =
-{
- "Level",
- "Edge"
-};
-
-const char *AcpiGbl_LLDecode[2] =
-{
- "ActiveHigh",
- "ActiveLow"
-};
-
-const char *AcpiGbl_SHRDecode[2] =
-{
- "Exclusive",
- "Shared"
-};
-
-const char *AcpiGbl_TYPDecode[4] =
-{
- "Compatibility",
- "TypeA",
- "TypeB",
- "TypeF"
-};
-
-const char *AcpiGbl_BMDecode[2] =
-{
- "NotBusMaster",
- "BusMaster"
-};
-
-const char *AcpiGbl_SIZDecode[4] =
-{
- "Transfer8",
- "Transfer8_16",
- "Transfer16",
- "InvalidSize"
-};
-
+#ifdef ACPI_ASL_COMPILER
/*******************************************************************************
*
* FUNCTION: AcpiDmAddToExternalList
@@ -307,10 +219,14 @@
void
AcpiDmAddToExternalList (
- char *Path)
+ char *Path,
+ UINT8 Type,
+ UINT32 Value)
{
char *ExternalPath;
ACPI_EXTERNAL_LIST *NewExternal;
+ ACPI_EXTERNAL_LIST *NextExternal;
+ ACPI_EXTERNAL_LIST *PrevExternal = NULL;
ACPI_STATUS Status;
@@ -323,22 +239,82 @@
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
NULL, &ExternalPath);
- if (ACPI_SUCCESS (Status))
+ if (ACPI_FAILURE (Status))
{
- /* Allocate and init a new External() descriptor */
+ return;
+ }
- NewExternal = ACPI_MEM_CALLOCATE (sizeof (ACPI_EXTERNAL_LIST));
- NewExternal->Path = ExternalPath;
+ /* Ensure that we don't have duplicate externals */
- /* Link the new descriptor into the global list */
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
+ {
+ /* Allow upgrade of type from ANY */
- if (AcpiGbl_ExternalList)
+ if (!ACPI_STRCMP (ExternalPath, NextExternal->Path))
{
- NewExternal->Next = AcpiGbl_ExternalList;
+ /* Duplicate method, check that the Value (ArgCount) is the same */
+
+ if ((NextExternal->Type == ACPI_TYPE_METHOD) &&
+ (NextExternal->Value != Value))
+ {
+ ACPI_ERROR ((AE_INFO, "Argument count mismatch for method %s %d %d",
+ NextExternal->Path, NextExternal->Value, Value));
+ }
+ if (NextExternal->Type == ACPI_TYPE_ANY)
+ {
+ NextExternal->Type = Type;
+ NextExternal->Value = Value;
+ }
+ ACPI_FREE (ExternalPath);
+ return;
}
+ NextExternal = NextExternal->Next;
+ }
+
+ /* Allocate and init a new External() descriptor */
+
+ NewExternal = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EXTERNAL_LIST));
+ NewExternal->InternalPath = Path;
+ NewExternal->Path = ExternalPath;
+ NewExternal->Type = Type;
+ NewExternal->Value = Value;
+ NewExternal->Length = (UINT16) ACPI_STRLEN (ExternalPath);
+
+ /* Link the new descriptor into the global list, ordered by string length */
+
+ NextExternal = AcpiGbl_ExternalList;
+ while (NextExternal)
+ {
+ if (NewExternal->Length <= NextExternal->Length)
+ {
+ if (PrevExternal)
+ {
+ PrevExternal->Next = NewExternal;
+ }
+ else
+ {
+ AcpiGbl_ExternalList = NewExternal;
+ }
+
+ NewExternal->Next = NextExternal;
+ return;
+ }
+
+ PrevExternal = NextExternal;
+ NextExternal = NextExternal->Next;
+ }
+
+ if (PrevExternal)
+ {
+ PrevExternal->Next = NewExternal;
+ }
+ else
+ {
AcpiGbl_ExternalList = NewExternal;
}
}
+#endif
/*******************************************************************************
@@ -514,5 +490,4 @@
}
}
-
#endif
Index: exsystem.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exsystem.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exsystem.c -L sys/contrib/dev/acpica/exsystem.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exsystem.c
+++ sys/contrib/dev/acpica/exsystem.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exsystem - Interface to OS services
- * $Revision: 81 $
+ * $Revision: 1.93 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,30 +129,29 @@
*
* FUNCTION: AcpiExSystemWaitSemaphore
*
- * PARAMETERS: Semaphore - OSD semaphore to wait on
- * Timeout - Max time to wait
+ * PARAMETERS: Semaphore - Semaphore to wait on
+ * Timeout - Max time to wait
*
* RETURN: Status
*
* DESCRIPTION: Implements a semaphore wait with a check to see if the
* semaphore is available immediately. If it is not, the
- * interpreter is released.
+ * interpreter is released before waiting.
*
******************************************************************************/
ACPI_STATUS
AcpiExSystemWaitSemaphore (
- ACPI_HANDLE Semaphore,
+ ACPI_SEMAPHORE Semaphore,
UINT16 Timeout)
{
ACPI_STATUS Status;
- ACPI_STATUS Status2;
- ACPI_FUNCTION_TRACE ("ExSystemWaitSemaphore");
+ ACPI_FUNCTION_TRACE (ExSystemWaitSemaphore);
- Status = AcpiOsWaitSemaphore (Semaphore, 1, 0);
+ Status = AcpiOsWaitSemaphore (Semaphore, 1, ACPI_DO_NOT_WAIT);
if (ACPI_SUCCESS (Status))
{
return_ACPI_STATUS (Status);
@@ -162,22 +161,70 @@
{
/* We must wait, so unlock the interpreter */
- AcpiExExitInterpreter ();
+ AcpiExRelinquishInterpreter ();
Status = AcpiOsWaitSemaphore (Semaphore, 1, Timeout);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "*** Thread awake after blocking, %s\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "*** Thread awake after blocking, %s\n",
AcpiFormatException (Status)));
/* Reacquire the interpreter */
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status2))
- {
- /* Report fatal error, could not acquire interpreter */
+ AcpiExReacquireInterpreter ();
+ }
+
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiExSystemWaitMutex
+ *
+ * PARAMETERS: Mutex - Mutex to wait on
+ * Timeout - Max time to wait
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Implements a mutex wait with a check to see if the
+ * mutex is available immediately. If it is not, the
+ * interpreter is released before waiting.
+ *
+ ******************************************************************************/
- return_ACPI_STATUS (Status2);
- }
+ACPI_STATUS
+AcpiExSystemWaitMutex (
+ ACPI_MUTEX Mutex,
+ UINT16 Timeout)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (ExSystemWaitMutex);
+
+
+ Status = AcpiOsAcquireMutex (Mutex, ACPI_DO_NOT_WAIT);
+ if (ACPI_SUCCESS (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ if (Status == AE_TIME)
+ {
+ /* We must wait, so unlock the interpreter */
+
+ AcpiExRelinquishInterpreter ();
+
+ Status = AcpiOsAcquireMutex (Mutex, Timeout);
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "*** Thread awake after blocking, %s\n",
+ AcpiFormatException (Status)));
+
+ /* Reacquire the interpreter */
+
+ AcpiExReacquireInterpreter ();
}
return_ACPI_STATUS (Status);
@@ -188,8 +235,8 @@
*
* FUNCTION: AcpiExSystemDoStall
*
- * PARAMETERS: HowLong - The amount of time to stall,
- * in microseconds
+ * PARAMETERS: HowLong - The amount of time to stall,
+ * in microseconds
*
* RETURN: Status
*
@@ -219,7 +266,8 @@
* (ACPI specifies 100 usec as max, but this gives some slack in
* order to support existing BIOSs)
*/
- ACPI_REPORT_ERROR (("Stall: Time parameter is too large (%d)\n", HowLong));
+ ACPI_ERROR ((AE_INFO, "Time parameter is too large (%d)",
+ HowLong));
Status = AE_AML_OPERAND_VALUE;
}
else
@@ -235,8 +283,8 @@
*
* FUNCTION: AcpiExSystemDoSuspend
*
- * PARAMETERS: HowLong - The amount of time to suspend,
- * in milliseconds
+ * PARAMETERS: HowLong - The amount of time to suspend,
+ * in milliseconds
*
* RETURN: None
*
@@ -248,112 +296,19 @@
AcpiExSystemDoSuspend (
ACPI_INTEGER HowLong)
{
- ACPI_STATUS Status;
-
-
ACPI_FUNCTION_ENTRY ();
/* Since this thread will sleep, we must release the interpreter */
- AcpiExExitInterpreter ();
+ AcpiExRelinquishInterpreter ();
AcpiOsSleep (HowLong);
/* And now we must get the interpreter again */
- Status = AcpiExEnterInterpreter ();
- return (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiExSystemAcquireMutex
- *
- * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
- * *ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML. This function will cause a lock to be generated
- * for the Mutex pointed to by ObjDesc.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExSystemAcquireMutex (
- ACPI_OPERAND_OBJECT *TimeDesc,
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE_PTR ("ExSystemAcquireMutex", ObjDesc);
-
-
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * Support for the _GL_ Mutex object -- go get the global lock
- */
- if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
- {
- Status = AcpiEvAcquireGlobalLock ((UINT16) TimeDesc->Integer.Value);
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiExSystemWaitSemaphore (ObjDesc->Mutex.Semaphore,
- (UINT16) TimeDesc->Integer.Value);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiExSystemReleaseMutex
- *
- * PARAMETERS: *ObjDesc - The object descriptor for this op
- *
- * RETURN: Status
- *
- * DESCRIPTION: Provides an access point to perform synchronization operations
- * within the AML. This operation is a request to release a
- * previously acquired Mutex. If the Mutex variable is set then
- * it will be decremented.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiExSystemReleaseMutex (
- ACPI_OPERAND_OBJECT *ObjDesc)
-{
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE ("ExSystemReleaseMutex");
-
-
- if (!ObjDesc)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /*
- * Support for the _GL_ Mutex object -- release the global lock
- */
- if (ObjDesc->Mutex.Semaphore == AcpiGbl_GlobalLockSemaphore)
- {
- Status = AcpiEvReleaseGlobalLock ();
- return_ACPI_STATUS (Status);
- }
-
- Status = AcpiOsSignalSemaphore (ObjDesc->Mutex.Semaphore, 1);
- return_ACPI_STATUS (Status);
+ AcpiExReacquireInterpreter ();
+ return (AE_OK);
}
@@ -361,9 +316,9 @@
*
* FUNCTION: AcpiExSystemSignalEvent
*
- * PARAMETERS: *ObjDesc - The object descriptor for this op
+ * PARAMETERS: ObjDesc - The object descriptor for this op
*
- * RETURN: AE_OK
+ * RETURN: Status
*
* DESCRIPTION: Provides an access point to perform synchronization operations
* within the AML.
@@ -377,12 +332,12 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExSystemSignalEvent");
+ ACPI_FUNCTION_TRACE (ExSystemSignalEvent);
if (ObjDesc)
{
- Status = AcpiOsSignalSemaphore (ObjDesc->Event.Semaphore, 1);
+ Status = AcpiOsSignalSemaphore (ObjDesc->Event.OsSemaphore, 1);
}
return_ACPI_STATUS (Status);
@@ -393,8 +348,8 @@
*
* FUNCTION: AcpiExSystemWaitEvent
*
- * PARAMETERS: *TimeDesc - The 'time to delay' object descriptor
- * *ObjDesc - The object descriptor for this op
+ * PARAMETERS: TimeDesc - The 'time to delay' object descriptor
+ * ObjDesc - The object descriptor for this op
*
* RETURN: Status
*
@@ -412,13 +367,13 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExSystemWaitEvent");
+ ACPI_FUNCTION_TRACE (ExSystemWaitEvent);
if (ObjDesc)
{
- Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.Semaphore,
- (UINT16) TimeDesc->Integer.Value);
+ Status = AcpiExSystemWaitSemaphore (ObjDesc->Event.OsSemaphore,
+ (UINT16) TimeDesc->Integer.Value);
}
return_ACPI_STATUS (Status);
@@ -429,7 +384,7 @@
*
* FUNCTION: AcpiExSystemResetEvent
*
- * PARAMETERS: *ObjDesc - The object descriptor for this op
+ * PARAMETERS: ObjDesc - The object descriptor for this op
*
* RETURN: Status
*
@@ -442,7 +397,7 @@
ACPI_OPERAND_OBJECT *ObjDesc)
{
ACPI_STATUS Status = AE_OK;
- void *TempSemaphore;
+ ACPI_SEMAPHORE TempSemaphore;
ACPI_FUNCTION_ENTRY ();
@@ -455,8 +410,8 @@
Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0, &TempSemaphore);
if (ACPI_SUCCESS (Status))
{
- (void) AcpiOsDeleteSemaphore (ObjDesc->Event.Semaphore);
- ObjDesc->Event.Semaphore = TempSemaphore;
+ (void) AcpiOsDeleteSemaphore (ObjDesc->Event.OsSemaphore);
+ ObjDesc->Event.OsSemaphore = TempSemaphore;
}
return (Status);
Index: exconvrt.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exconvrt.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exconvrt.c -L sys/contrib/dev/acpica/exconvrt.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exconvrt.c
+++ sys/contrib/dev/acpica/exconvrt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconvrt - Object conversion routines
- * $Revision: 59 $
+ * $Revision: 1.74 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,15 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconvrt")
+/* Local prototypes */
+
+static UINT32
+AcpiExConvertToAscii (
+ ACPI_INTEGER Integer,
+ UINT16 Base,
+ UINT8 *String,
+ UINT8 MaxLength);
+
/*******************************************************************************
*
@@ -155,7 +164,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExConvertToInteger", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExConvertToInteger, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
@@ -191,9 +200,8 @@
*/
Result = 0;
- /*
- * String conversion is different than Buffer conversion
- */
+ /* String conversion is different than Buffer conversion */
+
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
case ACPI_TYPE_STRING:
@@ -214,6 +222,13 @@
case ACPI_TYPE_BUFFER:
+ /* Check for zero-length buffer */
+
+ if (!Count)
+ {
+ return_ACPI_STATUS (AE_AML_BUFFER_LIMIT);
+ }
+
/* Transfer no more than an integer's worth of data */
if (Count > AcpiGbl_IntegerByteWidth)
@@ -242,15 +257,17 @@
break;
}
- /*
- * Create a new integer
- */
+ /* Create a new integer */
+
ReturnDesc = AcpiUtCreateInternalObject (ACPI_TYPE_INTEGER);
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Converted value: %8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (Result)));
+
/* Save the Result */
ReturnDesc->Integer.Value = Result;
@@ -283,7 +300,7 @@
UINT8 *NewBuf;
- ACPI_FUNCTION_TRACE_PTR ("ExConvertToBuffer", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExConvertToBuffer, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
@@ -322,8 +339,14 @@
/*
* Create a new Buffer object
* Size will be the string length
+ *
+ * NOTE: Add one to the string length to include the null terminator.
+ * The ACPI spec is unclear on this subject, but there is existing
+ * ASL/AML code that depends on the null being transferred to the new
+ * buffer.
*/
- ReturnDesc = AcpiUtCreateBufferObject ((ACPI_SIZE) ObjDesc->String.Length);
+ ReturnDesc = AcpiUtCreateBufferObject (
+ (ACPI_SIZE) ObjDesc->String.Length + 1);
if (!ReturnDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -364,7 +387,7 @@
*
******************************************************************************/
-UINT32
+static UINT32
AcpiExConvertToAscii (
ACPI_INTEGER Integer,
UINT16 Base,
@@ -436,8 +459,9 @@
case 16:
- HexLength = ACPI_MUL_2 (DataWidth); /* 2 ascii hex chars per data byte */
+ /* HexLength: 2 ascii hex chars per data byte */
+ HexLength = (ACPI_NATIVE_UINT) ACPI_MUL_2 (DataWidth);
for (i = 0, j = (HexLength-1); i < HexLength; i++, j--)
{
/* Get one hex digit, most significant digits first */
@@ -491,13 +515,13 @@
{
ACPI_OPERAND_OBJECT *ReturnDesc;
UINT8 *NewBuf;
+ UINT32 i;
UINT32 StringLength = 0;
UINT16 Base = 16;
- UINT32 i;
UINT8 Separator = ',';
- ACPI_FUNCTION_TRACE_PTR ("ExConvertToString", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExConvertToString, ObjDesc);
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
@@ -556,17 +580,37 @@
case ACPI_TYPE_BUFFER:
+ /* Setup string length, base, and separator */
+
switch (Type)
{
- case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by ToDecimalString operator */
+ case ACPI_EXPLICIT_CONVERT_DECIMAL: /* Used by ToDecimalString */
/*
* From ACPI: "If Data is a buffer, it is converted to a string of
* decimal values separated by commas."
*/
Base = 10;
- StringLength = ObjDesc->Buffer.Length; /* 4 chars for each decimal */
- /*lint -fallthrough */
+ /*
+ * Calculate the final string length. Individual string values
+ * are variable length (include separator for each)
+ */
+ for (i = 0; i < ObjDesc->Buffer.Length; i++)
+ {
+ if (ObjDesc->Buffer.Pointer[i] >= 100)
+ {
+ StringLength += 4;
+ }
+ else if (ObjDesc->Buffer.Pointer[i] >= 10)
+ {
+ StringLength += 3;
+ }
+ else
+ {
+ StringLength += 2;
+ }
+ }
+ break;
case ACPI_IMPLICIT_CONVERT_HEX:
/*
@@ -574,60 +618,52 @@
*"The entire contents of the buffer are converted to a string of
* two-character hexadecimal numbers, each separated by a space."
*/
- if (Type == ACPI_IMPLICIT_CONVERT_HEX)
- {
- Separator = ' ';
- }
-
- /*lint -fallthrough */
+ Separator = ' ';
+ StringLength = (ObjDesc->Buffer.Length * 3);
+ break;
- case ACPI_EXPLICIT_CONVERT_HEX: /* Used by ToHexString operator */
+ case ACPI_EXPLICIT_CONVERT_HEX: /* Used by ToHexString */
/*
* From ACPI: "If Data is a buffer, it is converted to a string of
* hexadecimal values separated by commas."
*/
- StringLength += (ObjDesc->Buffer.Length * 3);
- if (StringLength > ACPI_MAX_STRING_CONVERSION) /* ACPI limit */
- {
- return_ACPI_STATUS (AE_AML_STRING_LIMIT);
- }
-
- /* Create a new string object and string buffer */
-
- ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) StringLength -1);
- if (!ReturnDesc)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- NewBuf = ReturnDesc->Buffer.Pointer;
-
- /*
- * Convert buffer bytes to hex or decimal values
- * (separated by commas)
- */
- for (i = 0; i < ObjDesc->Buffer.Length; i++)
- {
- NewBuf += AcpiExConvertToAscii (
- (ACPI_INTEGER) ObjDesc->Buffer.Pointer[i], Base,
- NewBuf, 1);
- *NewBuf++ = Separator; /* each separated by a comma or space */
- }
-
- /* Null terminate the string (overwrites final comma from above) */
-
- NewBuf--;
- *NewBuf = 0;
-
- /* Recalculate length */
-
- ReturnDesc->String.Length = (UINT32)
- ACPI_STRLEN (ReturnDesc->String.Pointer);
+ StringLength = (ObjDesc->Buffer.Length * 3);
break;
default:
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+
+ /*
+ * Create a new string object and string buffer
+ * (-1 because of extra separator included in StringLength from above)
+ */
+ ReturnDesc = AcpiUtCreateStringObject ((ACPI_SIZE) (StringLength - 1));
+ if (!ReturnDesc)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ NewBuf = ReturnDesc->Buffer.Pointer;
+
+ /*
+ * Convert buffer bytes to hex or decimal values
+ * (separated by commas or spaces)
+ */
+ for (i = 0; i < ObjDesc->Buffer.Length; i++)
+ {
+ NewBuf += AcpiExConvertToAscii (
+ (ACPI_INTEGER) ObjDesc->Buffer.Pointer[i], Base,
+ NewBuf, 1);
+ *NewBuf++ = Separator; /* each separated by a comma or space */
+ }
+
+ /*
+ * Null terminate the string
+ * (overwrites final comma/space from above)
+ */
+ NewBuf--;
+ *NewBuf = 0;
break;
default:
@@ -664,7 +700,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExConvertToTargetType");
+ ACPI_FUNCTION_TRACE (ExConvertToTargetType);
/* Default behavior */
@@ -722,7 +758,6 @@
case ACPI_TYPE_STRING:
-
/*
* The operand must be a String. We can convert an
* Integer or Buffer if necessary
@@ -733,7 +768,6 @@
case ACPI_TYPE_BUFFER:
-
/*
* The operand must be a Buffer. We can convert an
* Integer or String if necessary
@@ -743,7 +777,7 @@
default:
- ACPI_REPORT_ERROR (("Bad destination type during conversion: %X\n",
+ ACPI_ERROR ((AE_INFO, "Bad destination type during conversion: %X",
DestinationType));
Status = AE_AML_INTERNAL;
break;
@@ -759,13 +793,10 @@
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown Target type ID 0x%X Op %s DestType %s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Target type ID 0x%X AmlOpcode %X DestType %s",
GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs),
- WalkState->OpInfo->Name, AcpiUtGetTypeName (DestinationType)));
-
- ACPI_REPORT_ERROR (("Bad Target Type (ARGI): %X\n",
- GET_CURRENT_ARG_TYPE (WalkState->OpInfo->RuntimeArgs)))
+ WalkState->Opcode, AcpiUtGetTypeName (DestinationType)));
Status = AE_AML_INTERNAL;
}
Index: nsnames.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsnames.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsnames.c -L sys/contrib/dev/acpica/nsnames.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsnames.c
+++ sys/contrib/dev/acpica/nsnames.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: nsnames - Name manipulation and search
- * $Revision: 86 $
+ * $Revision: 1.98 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -150,7 +150,7 @@
ACPI_NAMESPACE_NODE *ParentNode;
- ACPI_FUNCTION_NAME ("NsBuildExternalPath");
+ ACPI_FUNCTION_ENTRY ();
/* Special case for root */
@@ -189,8 +189,8 @@
if (Index != 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not construct pathname; index=%X, size=%X, Path=%s\n",
+ ACPI_ERROR ((AE_INFO,
+ "Could not construct pathname; index=%X, size=%X, Path=%s",
(UINT32) Index, (UINT32) Size, &NameBuffer[Size]));
}
@@ -203,7 +203,7 @@
*
* FUNCTION: AcpiNsGetExternalPathname
*
- * PARAMETERS: Node - NS node whose pathname is needed
+ * PARAMETERS: Node - Namespace node whose pathname is needed
*
* RETURN: Pointer to storage containing the fully qualified name of
* the node, In external format (name segments separated by path
@@ -221,7 +221,7 @@
ACPI_SIZE Size;
- ACPI_FUNCTION_TRACE_PTR ("NsGetExternalPathname", Node);
+ ACPI_FUNCTION_TRACE_PTR (NsGetExternalPathname, Node);
/* Calculate required buffer size based on depth below root */
@@ -230,10 +230,10 @@
/* Allocate a buffer to be returned to caller */
- NameBuffer = ACPI_MEM_CALLOCATE (Size);
+ NameBuffer = ACPI_ALLOCATE_ZEROED (Size);
if (!NameBuffer)
{
- ACPI_REPORT_ERROR (("NsGetTablePathname: allocation failure\n"));
+ ACPI_ERROR ((AE_INFO, "Allocation failure"));
return_PTR (NULL);
}
@@ -314,7 +314,7 @@
ACPI_SIZE RequiredSize;
- ACPI_FUNCTION_TRACE_PTR ("NsHandleToPathname", TargetHandle);
+ ACPI_FUNCTION_TRACE_PTR (NsHandleToPathname, TargetHandle);
Node = AcpiNsMapHandleToNode (TargetHandle);
@@ -339,7 +339,7 @@
AcpiNsBuildExternalPath (Node, RequiredSize, Buffer->Pointer);
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X] \n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s [%X]\n",
(char *) Buffer->Pointer, (UINT32) RequiredSize));
return_ACPI_STATUS (AE_OK);
}
Index: acpixf.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acpixf.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acpixf.h -L sys/contrib/dev/acpica/acpixf.h -u -r1.1.1.1 -r1.2
--- sys/contrib/dev/acpica/acpixf.h
+++ sys/contrib/dev/acpica/acpixf.h
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,9 +122,14 @@
#include <contrib/dev/acpica/actbl.h>
- /*
+/*
* Global interfaces
*/
+ACPI_STATUS
+AcpiInitializeTables (
+ ACPI_TABLE_DESC *InitialStorage,
+ UINT32 InitialTableCount,
+ BOOLEAN AllowResize);
ACPI_STATUS
AcpiInitializeSubsystem (
@@ -172,9 +177,8 @@
UINT32 Function);
/*
- * ACPI Memory manager
+ * ACPI Memory managment
*/
-
void *
AcpiAllocate (
UINT32 Size);
@@ -191,48 +195,39 @@
/*
* ACPI table manipulation interfaces
*/
+ACPI_STATUS
+AcpiReallocateRootTable (
+ void);
ACPI_STATUS
AcpiFindRootPointer (
- UINT32 Flags,
- ACPI_POINTER *RsdpAddress);
+ ACPI_NATIVE_UINT *RsdpAddress);
ACPI_STATUS
AcpiLoadTables (
void);
ACPI_STATUS
-AcpiLoadTable (
- ACPI_TABLE_HEADER *TablePtr);
-
-ACPI_STATUS
-AcpiUnloadTable (
- ACPI_TABLE_TYPE TableType);
-
-ACPI_STATUS
AcpiGetTableHeader (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
+ ACPI_STRING Signature,
+ ACPI_NATIVE_UINT Instance,
ACPI_TABLE_HEADER *OutTableHeader);
ACPI_STATUS
AcpiGetTable (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_BUFFER *RetBuffer);
+ ACPI_STRING Signature,
+ ACPI_NATIVE_UINT Instance,
+ ACPI_TABLE_HEADER **OutTable);
ACPI_STATUS
-AcpiGetFirmwareTable (
- ACPI_STRING Signature,
- UINT32 Instance,
- UINT32 Flags,
- ACPI_TABLE_HEADER **TablePointer);
+AcpiGetTableByIndex (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_TABLE_HEADER **OutTable);
/*
* Namespace and name interfaces
*/
-
ACPI_STATUS
AcpiWalkNamespace (
ACPI_OBJECT_TYPE Type,
@@ -278,11 +273,17 @@
ACPI_OBJECT_HANDLER Handler,
void **Data);
+ACPI_STATUS
+AcpiDebugTrace (
+ char *Name,
+ UINT32 DebugLevel,
+ UINT32 DebugLayer,
+ UINT32 Flags);
+
/*
* Object manipulation and enumeration
*/
-
ACPI_STATUS
AcpiEvaluateObject (
ACPI_HANDLE Object,
@@ -324,7 +325,6 @@
/*
* Event handler interfaces
*/
-
ACPI_STATUS
AcpiInstallFixedEventHandler (
UINT32 AcpiEvent,
@@ -379,7 +379,6 @@
/*
* Event interfaces
*/
-
ACPI_STATUS
AcpiAcquireGlobalLock (
UINT16 Timeout,
@@ -450,7 +449,7 @@
ACPI_HANDLE GpeDevice,
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
- UINT32 InterruptLevel);
+ UINT32 InterruptNumber);
ACPI_STATUS
AcpiRemoveGpeBlock (
@@ -460,12 +459,17 @@
/*
* Resource interfaces
*/
-
typedef
ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
ACPI_RESOURCE *Resource,
void *Context);
+ACPI_STATUS
+AcpiGetVendorResource (
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_VENDOR_UUID *Uuid,
+ ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiGetCurrentResources(
@@ -479,10 +483,10 @@
ACPI_STATUS
AcpiWalkResources (
- ACPI_HANDLE DeviceHandle,
- char *Path,
- ACPI_WALK_RESOURCE_CALLBACK UserFunction,
- void *Context);
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_WALK_RESOURCE_CALLBACK UserFunction,
+ void *Context);
ACPI_STATUS
AcpiSetCurrentResources (
@@ -502,18 +506,15 @@
/*
* Hardware (ACPI device) interfaces
*/
-
ACPI_STATUS
AcpiGetRegister (
UINT32 RegisterId,
- UINT32 *ReturnValue,
- UINT32 Flags);
+ UINT32 *ReturnValue);
ACPI_STATUS
AcpiSetRegister (
UINT32 RegisterId,
- UINT32 Value,
- UINT32 Flags);
+ UINT32 Value);
ACPI_STATUS
AcpiSetFirmwareWakingVector (
Index: rscalc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rscalc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rscalc.c -L sys/contrib/dev/acpica/rscalc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rscalc.c
+++ sys/contrib/dev/acpica/rscalc.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rscalc - Calculate stream and list lengths
- * $Revision: 52 $
+ * $Revision: 1.80 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,681 +125,457 @@
ACPI_MODULE_NAME ("rscalc")
+/* Local prototypes */
+
+static UINT8
+AcpiRsCountSetBits (
+ UINT16 BitField);
+
+static ACPI_RS_LENGTH
+AcpiRsStructOptionLength (
+ ACPI_RESOURCE_SOURCE *ResourceSource);
+
+static UINT32
+AcpiRsStreamOptionLength (
+ UINT32 ResourceLength,
+ UINT32 MinimumTotalLength);
+
+
/*******************************************************************************
*
- * FUNCTION: AcpiRsGetByteStreamLength
+ * FUNCTION: AcpiRsCountSetBits
*
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * SizeNeeded - UINT32 pointer of the size buffer needed
- * to properly return the parsed data
+ * PARAMETERS: BitField - Field in which to count bits
*
- * RETURN: Status
+ * RETURN: Number of bits set within the field
*
- * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
- * the size buffer needed to hold the linked list that conveys
- * the resource data.
+ * DESCRIPTION: Count the number of bits set in a resource field. Used for
+ * (Short descriptor) interrupt and DMA lists.
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsGetByteStreamLength (
- ACPI_RESOURCE *LinkedList,
- ACPI_SIZE *SizeNeeded)
+static UINT8
+AcpiRsCountSetBits (
+ UINT16 BitField)
{
- ACPI_SIZE ByteStreamSizeNeeded = 0;
- ACPI_SIZE SegmentSize;
- BOOLEAN Done = FALSE;
+ UINT8 BitsSet;
- ACPI_FUNCTION_TRACE ("RsGetByteStreamLength");
+ ACPI_FUNCTION_ENTRY ();
- while (!Done)
+ for (BitsSet = 0; BitField; BitsSet++)
{
- /*
- * Init the variable that will hold the size to add to the total.
- */
- SegmentSize = 0;
+ /* Zero the least significant bit that is set */
- switch (LinkedList->Id)
- {
- case ACPI_RSTYPE_IRQ:
- /*
- * IRQ Resource
- * For an IRQ Resource, Byte 3, although optional, will always be
- * created - it holds IRQ information.
- */
- SegmentSize = 4;
- break;
-
- case ACPI_RSTYPE_DMA:
- /*
- * DMA Resource
- * For this resource the size is static
- */
- SegmentSize = 3;
- break;
-
- case ACPI_RSTYPE_START_DPF:
- /*
- * Start Dependent Functions Resource
- * For a StartDependentFunctions Resource, Byte 1, although
- * optional, will always be created.
- */
- SegmentSize = 2;
- break;
-
- case ACPI_RSTYPE_END_DPF:
- /*
- * End Dependent Functions Resource
- * For this resource the size is static
- */
- SegmentSize = 1;
- break;
-
- case ACPI_RSTYPE_IO:
- /*
- * IO Port Resource
- * For this resource the size is static
- */
- SegmentSize = 8;
- break;
-
- case ACPI_RSTYPE_FIXED_IO:
- /*
- * Fixed IO Port Resource
- * For this resource the size is static
- */
- SegmentSize = 4;
- break;
-
- case ACPI_RSTYPE_VENDOR:
- /*
- * Vendor Defined Resource
- * For a Vendor Specific resource, if the Length is between 1 and 7
- * it will be created as a Small Resource data type, otherwise it
- * is a Large Resource data type.
- */
- if (LinkedList->Data.VendorSpecific.Length > 7)
- {
- SegmentSize = 3;
- }
- else
- {
- SegmentSize = 1;
- }
- SegmentSize += LinkedList->Data.VendorSpecific.Length;
- break;
+ BitField &= (BitField - 1);
+ }
- case ACPI_RSTYPE_END_TAG:
- /*
- * End Tag
- * For this resource the size is static
- */
- SegmentSize = 2;
- Done = TRUE;
- break;
+ return (BitsSet);
+}
- case ACPI_RSTYPE_MEM24:
- /*
- * 24-Bit Memory Resource
- * For this resource the size is static
- */
- SegmentSize = 12;
- break;
- case ACPI_RSTYPE_MEM32:
- /*
- * 32-Bit Memory Range Resource
- * For this resource the size is static
- */
- SegmentSize = 20;
- break;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsStructOptionLength
+ *
+ * PARAMETERS: ResourceSource - Pointer to optional descriptor field
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Common code to handle optional ResourceSourceIndex and
+ * ResourceSource fields in some Large descriptors. Used during
+ * list-to-stream conversion
+ *
+ ******************************************************************************/
- case ACPI_RSTYPE_FIXED_MEM32:
- /*
- * 32-Bit Fixed Memory Resource
- * For this resource the size is static
- */
- SegmentSize = 12;
- break;
+static ACPI_RS_LENGTH
+AcpiRsStructOptionLength (
+ ACPI_RESOURCE_SOURCE *ResourceSource)
+{
+ ACPI_FUNCTION_ENTRY ();
- case ACPI_RSTYPE_ADDRESS16:
- /*
- * 16-Bit Address Resource
- * The base size of this byte stream is 16. If a Resource Source
- * string is not NULL, add 1 for the Index + the length of the null
- * terminated string Resource Source + 1 for the null.
- */
- SegmentSize = 16;
- if (LinkedList->Data.Address16.ResourceSource.StringPtr)
- {
- SegmentSize += LinkedList->Data.Address16.ResourceSource.StringLength;
- SegmentSize++;
- }
- break;
+ /*
+ * If the ResourceSource string is valid, return the size of the string
+ * (StringLength includes the NULL terminator) plus the size of the
+ * ResourceSourceIndex (1).
+ */
+ if (ResourceSource->StringPtr)
+ {
+ return ((ACPI_RS_LENGTH) (ResourceSource->StringLength + 1));
+ }
- case ACPI_RSTYPE_ADDRESS32:
- /*
- * 32-Bit Address Resource
- * The base size of this byte stream is 26. If a Resource
- * Source string is not NULL, add 1 for the Index + the
- * length of the null terminated string Resource Source +
- * 1 for the null.
- */
- SegmentSize = 26;
+ return (0);
+}
- if (LinkedList->Data.Address32.ResourceSource.StringPtr)
- {
- SegmentSize += LinkedList->Data.Address32.ResourceSource.StringLength;
- SegmentSize++;
- }
- break;
- case ACPI_RSTYPE_ADDRESS64:
- /*
- * 64-Bit Address Resource
- * The base size of this byte stream is 46. If a ResourceSource
- * string is not NULL, add 1 for the Index + the length of the null
- * terminated string Resource Source + 1 for the null.
- */
- SegmentSize = 46;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsStreamOptionLength
+ *
+ * PARAMETERS: ResourceLength - Length from the resource header
+ * MinimumTotalLength - Minimum length of this resource, before
+ * any optional fields. Includes header size
+ *
+ * RETURN: Length of optional string (0 if no string present)
+ *
+ * DESCRIPTION: Common code to handle optional ResourceSourceIndex and
+ * ResourceSource fields in some Large descriptors. Used during
+ * stream-to-list conversion
+ *
+ ******************************************************************************/
- if (LinkedList->Data.Address64.ResourceSource.StringPtr)
- {
- SegmentSize += LinkedList->Data.Address64.ResourceSource.StringLength;
- SegmentSize++;
- }
- break;
+static UINT32
+AcpiRsStreamOptionLength (
+ UINT32 ResourceLength,
+ UINT32 MinimumAmlResourceLength)
+{
+ UINT32 StringLength = 0;
- case ACPI_RSTYPE_EXT_IRQ:
- /*
- * Extended IRQ Resource
- * The base size of this byte stream is 9. This is for an Interrupt
- * table length of 1. For each additional interrupt, add 4.
- * If a Resource Source string is not NULL, add 1 for the
- * Index + the length of the null terminated string
- * Resource Source + 1 for the null.
- */
- SegmentSize = 9 +
- (((ACPI_SIZE) LinkedList->Data.ExtendedIrq.NumberOfInterrupts - 1) * 4);
- if (LinkedList->Data.ExtendedIrq.ResourceSource.StringPtr)
- {
- SegmentSize += LinkedList->Data.ExtendedIrq.ResourceSource.StringLength;
- SegmentSize++;
- }
- break;
+ ACPI_FUNCTION_ENTRY ();
- default:
- /*
- * If we get here, everything is out of sync, exit with error
- */
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
- } /* switch (LinkedList->Id) */
+ /*
+ * The ResourceSourceIndex and ResourceSource are optional elements of some
+ * Large-type resource descriptors.
+ */
- /*
- * Update the total
- */
- ByteStreamSizeNeeded += SegmentSize;
+ /*
+ * If the length of the actual resource descriptor is greater than the ACPI
+ * spec-defined minimum length, it means that a ResourceSourceIndex exists
+ * and is followed by a (required) null terminated string. The string length
+ * (including the null terminator) is the resource length minus the minimum
+ * length, minus one byte for the ResourceSourceIndex itself.
+ */
+ if (ResourceLength > MinimumAmlResourceLength)
+ {
+ /* Compute the length of the optional string */
- /*
- * Point to the next object
- */
- LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE,
- LinkedList, LinkedList->Length);
+ StringLength = ResourceLength - MinimumAmlResourceLength - 1;
}
/*
- * This is the data the caller needs
+ * Round the length up to a multiple of the native word in order to
+ * guarantee that the entire resource descriptor is native word aligned
*/
- *SizeNeeded = ByteStreamSizeNeeded;
- return_ACPI_STATUS (AE_OK);
+ return ((UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (StringLength));
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsGetListLength
+ * FUNCTION: AcpiRsGetAmlLength
*
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
- * ByteStreamBufferLength - Size of ByteStreamBuffer
- * SizeNeeded - UINT32 pointer of the size buffer
- * needed to properly return the
- * parsed data
+ * PARAMETERS: Resource - Pointer to the resource linked list
+ * SizeNeeded - Where the required size is returned
*
* RETURN: Status
*
- * DESCRIPTION: Takes the resource byte stream and parses it once, calculating
- * the size buffer needed to hold the linked list that conveys
- * the resource data.
+ * DESCRIPTION: Takes a linked list of internal resource descriptors and
+ * calculates the size buffer needed to hold the corresponding
+ * external resource byte stream.
*
******************************************************************************/
ACPI_STATUS
-AcpiRsGetListLength (
- UINT8 *ByteStreamBuffer,
- UINT32 ByteStreamBufferLength,
+AcpiRsGetAmlLength (
+ ACPI_RESOURCE *Resource,
ACPI_SIZE *SizeNeeded)
{
- UINT32 BufferSize = 0;
- UINT32 BytesParsed = 0;
- UINT8 NumberOfInterrupts = 0;
- UINT8 NumberOfChannels = 0;
- UINT8 ResourceType;
- UINT32 StructureSize;
- UINT32 BytesConsumed;
- UINT8 *Buffer;
- UINT8 Temp8;
- UINT16 Temp16;
- UINT8 Index;
- UINT8 AdditionalBytes;
+ ACPI_SIZE AmlSizeNeeded = 0;
+ ACPI_RS_LENGTH TotalSize;
- ACPI_FUNCTION_TRACE ("RsGetListLength");
+ ACPI_FUNCTION_TRACE (RsGetAmlLength);
- while (BytesParsed < ByteStreamBufferLength)
+ /* Traverse entire list of internal resource descriptors */
+
+ while (Resource)
{
- /*
- * The next byte in the stream is the resource type
- */
- ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer);
+ /* Validate the descriptor type */
- switch (ResourceType)
+ if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
{
- case ACPI_RDESC_TYPE_MEMORY_24:
- /*
- * 24-Bit Memory Resource
- */
- BytesConsumed = 12;
-
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM24);
- break;
-
-
- case ACPI_RDESC_TYPE_LARGE_VENDOR:
- /*
- * Vendor Defined Resource
- */
- Buffer = ByteStreamBuffer;
- ++Buffer;
-
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- BytesConsumed = Temp16 + 3;
-
- /*
- * Ensure a 32-bit boundary for the structure
- */
- Temp16 = (UINT16) ACPI_ROUND_UP_TO_32BITS (Temp16);
+ return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ }
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
- (Temp16 * sizeof (UINT8));
- break;
+ /* Get the base size of the (external stream) resource descriptor */
+ TotalSize = AcpiGbl_AmlResourceSizes [Resource->Type];
- case ACPI_RDESC_TYPE_MEMORY_32:
+ /*
+ * Augment the base size for descriptors with optional and/or
+ * variable-length fields
+ */
+ switch (Resource->Type)
+ {
+ case ACPI_RESOURCE_TYPE_VENDOR:
/*
- * 32-Bit Memory Range Resource
+ * Vendor Defined Resource:
+ * For a Vendor Specific resource, if the Length is between 1 and 7
+ * it will be created as a Small Resource data type, otherwise it
+ * is a Large Resource data type.
*/
- BytesConsumed = 20;
-
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_MEM32);
- break;
+ if (Resource->Data.Vendor.ByteLength > 7)
+ {
+ /* Base size of a Large resource descriptor */
+ TotalSize = sizeof (AML_RESOURCE_LARGE_HEADER);
+ }
- case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
- /*
- * 32-Bit Fixed Memory Resource
- */
- BytesConsumed = 12;
+ /* Add the size of the vendor-specific data */
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_MEM32);
+ TotalSize = (ACPI_RS_LENGTH)
+ (TotalSize + Resource->Data.Vendor.ByteLength);
break;
- case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
+ case ACPI_RESOURCE_TYPE_END_TAG:
/*
- * 64-Bit Address Resource
+ * End Tag:
+ * We are done -- return the accumulated total size.
*/
- Buffer = ByteStreamBuffer;
+ *SizeNeeded = AmlSizeNeeded + TotalSize;
- ++Buffer;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ /* Normal exit */
- BytesConsumed = Temp16 + 3;
+ return_ACPI_STATUS (AE_OK);
- /*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 43,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
- */
- if (43 < Temp16)
- {
- Temp8 = (UINT8) (Temp16 - 44);
- }
- else
- {
- Temp8 = 0;
- }
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
/*
- * Ensure a 64-bit boundary for the structure
+ * 16-Bit Address Resource:
+ * Add the size of the optional ResourceSource info
*/
- Temp8 = (UINT8) ACPI_ROUND_UP_TO_64BITS (Temp8);
-
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS64) +
- (Temp8 * sizeof (UINT8));
+ TotalSize = (ACPI_RS_LENGTH)
+ (TotalSize + AcpiRsStructOptionLength (
+ &Resource->Data.Address16.ResourceSource));
break;
- case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
/*
- * 32-Bit Address Resource
+ * 32-Bit Address Resource:
+ * Add the size of the optional ResourceSource info
*/
- Buffer = ByteStreamBuffer;
-
- ++Buffer;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ TotalSize = (ACPI_RS_LENGTH)
+ (TotalSize + AcpiRsStructOptionLength (
+ &Resource->Data.Address32.ResourceSource));
+ break;
- BytesConsumed = Temp16 + 3;
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
/*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 23,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
+ * 64-Bit Address Resource:
+ * Add the size of the optional ResourceSource info
*/
- if (23 < Temp16)
- {
- Temp8 = (UINT8) (Temp16 - 24);
- }
- else
- {
- Temp8 = 0;
- }
-
- /*
- * Ensure a 32-bit boundary for the structure
- */
- Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
-
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS32) +
- (Temp8 * sizeof (UINT8));
+ TotalSize = (ACPI_RS_LENGTH)
+ (TotalSize + AcpiRsStructOptionLength (
+ &Resource->Data.Address64.ResourceSource));
break;
- case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
+ case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
/*
- * 16-Bit Address Resource
+ * Extended IRQ Resource:
+ * Add the size of each additional optional interrupt beyond the
+ * required 1 (4 bytes for each UINT32 interrupt number)
*/
- Buffer = ByteStreamBuffer;
-
- ++Buffer;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- BytesConsumed = Temp16 + 3;
+ TotalSize = (ACPI_RS_LENGTH)
+ (TotalSize +
+ ((Resource->Data.ExtendedIrq.InterruptCount - 1) * 4) +
- /*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 13,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
- */
- if (13 < Temp16)
- {
- Temp8 = (UINT8) (Temp16 - 14);
- }
- else
- {
- Temp8 = 0;
- }
+ /* Add the size of the optional ResourceSource info */
- /*
- * Ensure a 32-bit boundary for the structure
- */
- Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
-
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_ADDRESS16) +
- (Temp8 * sizeof (UINT8));
+ AcpiRsStructOptionLength (
+ &Resource->Data.ExtendedIrq.ResourceSource));
break;
- case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
- /*
- * Extended IRQ
- */
- Buffer = ByteStreamBuffer;
-
- ++Buffer;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ default:
+ break;
+ }
- BytesConsumed = Temp16 + 3;
+ /* Update the total */
- /*
- * Point past the length field and the Interrupt vector flags to
- * save off the Interrupt table length to the Temp8 variable.
- */
- Buffer += 3;
- Temp8 = *Buffer;
+ AmlSizeNeeded += TotalSize;
- /*
- * To compensate for multiple interrupt numbers, add 4 bytes for
- * each additional interrupts greater than 1
- */
- AdditionalBytes = (UINT8) ((Temp8 - 1) * 4);
+ /* Point to the next object */
- /*
- * Resource Source Index and Resource Source are optional elements.
- * Check the length of the Bytestream. If it is greater than 9,
- * that means that an Index exists and is followed by a null
- * terminated string. Therefore, set the temp variable to the
- * length minus the minimum byte stream length plus the byte for
- * the Index to determine the size of the NULL terminated string.
- */
- if (9 + AdditionalBytes < Temp16)
- {
- Temp8 = (UINT8) (Temp16 - (9 + AdditionalBytes));
- }
- else
- {
- Temp8 = 0;
- }
+ Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
+ }
- /*
- * Ensure a 32-bit boundary for the structure
- */
- Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
+ /* Did not find an EndTag resource descriptor */
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_EXT_IRQ) +
- (AdditionalBytes * sizeof (UINT8)) +
- (Temp8 * sizeof (UINT8));
- break;
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+}
- case ACPI_RDESC_TYPE_IRQ_FORMAT:
- /*
- * IRQ Resource.
- * Determine if it there are two or three trailing bytes
- */
- Buffer = ByteStreamBuffer;
- Temp8 = *Buffer;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsGetListLength
+ *
+ * PARAMETERS: AmlBuffer - Pointer to the resource byte stream
+ * AmlBufferLength - Size of AmlBuffer
+ * SizeNeeded - Where the size needed is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Takes an external resource byte stream and calculates the size
+ * buffer needed to hold the corresponding internal resource
+ * descriptor linked list.
+ *
+ ******************************************************************************/
- if(Temp8 & 0x01)
- {
- BytesConsumed = 4;
- }
- else
- {
- BytesConsumed = 3;
- }
+ACPI_STATUS
+AcpiRsGetListLength (
+ UINT8 *AmlBuffer,
+ UINT32 AmlBufferLength,
+ ACPI_SIZE *SizeNeeded)
+{
+ ACPI_STATUS Status;
+ UINT8 *EndAml;
+ UINT8 *Buffer;
+ UINT32 BufferSize;
+ UINT16 Temp16;
+ UINT16 ResourceLength;
+ UINT32 ExtraStructBytes;
+ UINT8 ResourceIndex;
+ UINT8 MinimumAmlResourceLength;
- /* Point past the descriptor */
- ++Buffer;
+ ACPI_FUNCTION_TRACE (RsGetListLength);
- /*
- * Look at the number of bits set
- */
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
- for (Index = 0; Index < 16; Index++)
- {
- if (Temp16 & 0x1)
- {
- ++NumberOfInterrupts;
- }
+ *SizeNeeded = 0;
+ EndAml = AmlBuffer + AmlBufferLength;
- Temp16 >>= 1;
- }
+ /* Walk the list of AML resource descriptors */
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO) +
- (NumberOfInterrupts * sizeof (UINT32));
- break;
+ while (AmlBuffer < EndAml)
+ {
+ /* Validate the Resource Type and Resource Length */
+ Status = AcpiUtValidateResource (AmlBuffer, &ResourceIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- case ACPI_RDESC_TYPE_DMA_FORMAT:
- /*
- * DMA Resource
- */
- Buffer = ByteStreamBuffer;
- BytesConsumed = 3;
+ /* Get the resource length and base (minimum) AML size */
- /* Point past the descriptor */
+ ResourceLength = AcpiUtGetResourceLength (AmlBuffer);
+ MinimumAmlResourceLength = AcpiGbl_ResourceAmlSizes[ResourceIndex];
- ++Buffer;
+ /*
+ * Augment the size for descriptors with optional
+ * and/or variable length fields
+ */
+ ExtraStructBytes = 0;
+ Buffer = AmlBuffer + AcpiUtGetResourceHeaderLength (AmlBuffer);
+ switch (AcpiUtGetResourceType (AmlBuffer))
+ {
+ case ACPI_RESOURCE_NAME_IRQ:
/*
- * Look at the number of bits set
+ * IRQ Resource:
+ * Get the number of bits set in the 16-bit IRQ mask
*/
- Temp8 = *Buffer;
-
- for(Index = 0; Index < 8; Index++)
- {
- if(Temp8 & 0x1)
- {
- ++NumberOfChannels;
- }
-
- Temp8 >>= 1;
- }
-
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA) +
- (NumberOfChannels * sizeof (UINT32));
+ ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
+ ExtraStructBytes = AcpiRsCountSetBits (Temp16);
break;
- case ACPI_RDESC_TYPE_START_DEPENDENT:
+ case ACPI_RESOURCE_NAME_DMA:
/*
- * Start Dependent Functions Resource
- * Determine if it there are two or three trailing bytes
+ * DMA Resource:
+ * Get the number of bits set in the 8-bit DMA mask
*/
- Buffer = ByteStreamBuffer;
- Temp8 = *Buffer;
-
- if(Temp8 & 0x01)
- {
- BytesConsumed = 2;
- }
- else
- {
- BytesConsumed = 1;
- }
-
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_START_DPF);
+ ExtraStructBytes = AcpiRsCountSetBits (*Buffer);
break;
- case ACPI_RDESC_TYPE_END_DEPENDENT:
+ case ACPI_RESOURCE_NAME_VENDOR_SMALL:
+ case ACPI_RESOURCE_NAME_VENDOR_LARGE:
/*
- * End Dependent Functions Resource
+ * Vendor Resource:
+ * Get the number of vendor data bytes
*/
- BytesConsumed = 1;
- StructureSize = ACPI_RESOURCE_LENGTH;
+ ExtraStructBytes = ResourceLength;
break;
- case ACPI_RDESC_TYPE_IO_PORT:
+ case ACPI_RESOURCE_NAME_END_TAG:
/*
- * IO Port Resource
+ * End Tag:
+ * This is the normal exit, add size of EndTag
*/
- BytesConsumed = 8;
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
- break;
+ *SizeNeeded += ACPI_RS_SIZE_MIN;
+ return_ACPI_STATUS (AE_OK);
- case ACPI_RDESC_TYPE_FIXED_IO_PORT:
+ case ACPI_RESOURCE_NAME_ADDRESS32:
+ case ACPI_RESOURCE_NAME_ADDRESS16:
+ case ACPI_RESOURCE_NAME_ADDRESS64:
/*
- * Fixed IO Port Resource
+ * Address Resource:
+ * Add the size of the optional ResourceSource
*/
- BytesConsumed = 4;
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
+ ExtraStructBytes = AcpiRsStreamOptionLength (
+ ResourceLength, MinimumAmlResourceLength);
break;
- case ACPI_RDESC_TYPE_SMALL_VENDOR:
+ case ACPI_RESOURCE_NAME_EXTENDED_IRQ:
/*
- * Vendor Specific Resource
+ * Extended IRQ Resource:
+ * Using the InterruptTableLength, add 4 bytes for each additional
+ * interrupt. Note: at least one interrupt is required and is
+ * included in the minimum descriptor size (reason for the -1)
*/
- Buffer = ByteStreamBuffer;
+ ExtraStructBytes = (Buffer[1] - 1) * sizeof (UINT32);
- Temp8 = *Buffer;
- Temp8 = (UINT8) (Temp8 & 0x7);
- BytesConsumed = Temp8 + 1;
+ /* Add the size of the optional ResourceSource */
- /*
- * Ensure a 32-bit boundary for the structure
- */
- Temp8 = (UINT8) ACPI_ROUND_UP_TO_32BITS (Temp8);
- StructureSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_VENDOR) +
- (Temp8 * sizeof (UINT8));
- break;
-
-
- case ACPI_RDESC_TYPE_END_TAG:
- /*
- * End Tag
- */
- BytesConsumed = 2;
- StructureSize = ACPI_RESOURCE_LENGTH;
- ByteStreamBufferLength = BytesParsed;
+ ExtraStructBytes += AcpiRsStreamOptionLength (
+ ResourceLength - ExtraStructBytes, MinimumAmlResourceLength);
break;
default:
- /*
- * If we get here, everything is out of sync,
- * exit with an error
- */
- return_ACPI_STATUS (AE_AML_INVALID_RESOURCE_TYPE);
+ break;
}
/*
- * Update the return value and counter
+ * Update the required buffer size for the internal descriptor structs
+ *
+ * Important: Round the size up for the appropriate alignment. This
+ * is a requirement on IA64.
*/
- BufferSize += (UINT32) ACPI_ALIGN_RESOURCE_SIZE (StructureSize);
- BytesParsed += BytesConsumed;
+ BufferSize = AcpiGbl_ResourceStructSizes[ResourceIndex] +
+ ExtraStructBytes;
+ BufferSize = (UINT32) ACPI_ROUND_UP_TO_NATIVE_WORD (BufferSize);
+
+ *SizeNeeded += BufferSize;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES,
+ "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
+ AcpiUtGetResourceType (AmlBuffer),
+ AcpiUtGetDescriptorLength (AmlBuffer), BufferSize));
/*
- * Set the byte stream to point to the next resource
+ * Point to the next resource within the AML stream using the length
+ * contained in the resource descriptor header
*/
- ByteStreamBuffer += BytesConsumed;
+ AmlBuffer += AcpiUtGetDescriptorLength (AmlBuffer);
}
- /*
- * This is the data the caller needs
- */
- *SizeNeeded = BufferSize;
- return_ACPI_STATUS (AE_OK);
+ /* Did not find an EndTag resource descriptor */
+
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
@@ -835,7 +611,7 @@
UINT32 TableIndex;
- ACPI_FUNCTION_TRACE ("RsGetPciRoutingTableLength");
+ ACPI_FUNCTION_TRACE (RsGetPciRoutingTableLength);
NumberOfElements = PackageObject->Package.Count;
@@ -854,9 +630,8 @@
for (Index = 0; Index < NumberOfElements; Index++)
{
- /*
- * Dereference the sub-package
- */
+ /* Dereference the sub-package */
+
PackageElement = *TopObjectList;
/*
@@ -865,33 +640,37 @@
*/
SubObjectList = PackageElement->Package.Elements;
- /*
- * Scan the IrqTableElements for the Source Name String
- */
+ /* Scan the IrqTableElements for the Source Name String */
+
NameFound = FALSE;
for (TableIndex = 0; TableIndex < 4 && !NameFound; TableIndex++)
{
- if ((ACPI_TYPE_STRING == ACPI_GET_OBJECT_TYPE (*SubObjectList)) ||
- ((ACPI_TYPE_LOCAL_REFERENCE == ACPI_GET_OBJECT_TYPE (*SubObjectList)) &&
- ((*SubObjectList)->Reference.Opcode == AML_INT_NAMEPATH_OP)))
+ if (*SubObjectList && /* Null object allowed */
+
+ ((ACPI_TYPE_STRING ==
+ ACPI_GET_OBJECT_TYPE (*SubObjectList)) ||
+
+ ((ACPI_TYPE_LOCAL_REFERENCE ==
+ ACPI_GET_OBJECT_TYPE (*SubObjectList)) &&
+
+ ((*SubObjectList)->Reference.Opcode ==
+ AML_INT_NAMEPATH_OP))))
{
NameFound = TRUE;
}
else
{
- /*
- * Look at the next element
- */
+ /* Look at the next element */
+
SubObjectList++;
}
}
TempSizeNeeded += (sizeof (ACPI_PCI_ROUTING_TABLE) - 4);
- /*
- * Was a String type found?
- */
+ /* Was a String type found? */
+
if (NameFound)
{
if (ACPI_GET_OBJECT_TYPE (*SubObjectList) == ACPI_TYPE_STRING)
@@ -900,7 +679,8 @@
* The length String.Length field does not include the
* terminating NULL, add 1
*/
- TempSizeNeeded += ((ACPI_SIZE) (*SubObjectList)->String.Length + 1);
+ TempSizeNeeded += ((ACPI_SIZE)
+ (*SubObjectList)->String.Length + 1);
}
else
{
@@ -919,16 +699,16 @@
/* Round up the size since each element must be aligned */
- TempSizeNeeded = ACPI_ROUND_UP_TO_64BITS (TempSizeNeeded);
+ TempSizeNeeded = ACPI_ROUND_UP_TO_64BIT (TempSizeNeeded);
+
+ /* Point to the next ACPI_OPERAND_OBJECT */
- /*
- * Point to the next ACPI_OPERAND_OBJECT
- */
TopObjectList++;
}
/*
- * Adding an extra element to the end of the list, essentially a NULL terminator
+ * Add an extra element to the end of the list, essentially a
+ * NULL terminator
*/
*BufferSizeNeeded = TempSizeNeeded + sizeof (ACPI_PCI_ROUTING_TABLE);
return_ACPI_STATUS (AE_OK);
Index: dswload.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dswload.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dswload.c -L sys/contrib/dev/acpica/dswload.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dswload.c
+++ sys/contrib/dev/acpica/dswload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 88 $
+ * $Revision: 1.117 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,7 +124,7 @@
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acevents.h>
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
#include <contrib/dev/acpica/acdisasm.h>
#endif
@@ -154,20 +154,23 @@
switch (PassNumber)
{
case 1:
- WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
+ ACPI_PARSE_DELETE_TREE;
WalkState->DescendingCallback = AcpiDsLoad1BeginOp;
WalkState->AscendingCallback = AcpiDsLoad1EndOp;
break;
case 2:
- WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 | ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags = ACPI_PARSE_LOAD_PASS1 |
+ ACPI_PARSE_DELETE_TREE;
WalkState->DescendingCallback = AcpiDsLoad2BeginOp;
WalkState->AscendingCallback = AcpiDsLoad2EndOp;
break;
case 3:
#ifndef ACPI_NO_METHOD_EXECUTION
- WalkState->ParseFlags |= ACPI_PARSE_EXECUTE | ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags |= ACPI_PARSE_EXECUTE |
+ ACPI_PARSE_DELETE_TREE;
WalkState->DescendingCallback = AcpiDsExecBeginOp;
WalkState->AscendingCallback = AcpiDsExecEndOp;
#endif
@@ -186,8 +189,7 @@
* FUNCTION: AcpiDsLoad1BeginOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been reached in the
- * walk; Arguments have not been evaluated yet.
+ * OutOp - Where to return op if a new one is created
*
* RETURN: Status
*
@@ -208,7 +210,7 @@
UINT32 Flags;
- ACPI_FUNCTION_NAME ("DsLoad1BeginOp");
+ ACPI_FUNCTION_TRACE (DsLoad1BeginOp);
Op = WalkState->Op;
@@ -220,17 +222,8 @@
{
if (!(WalkState->OpInfo->Flags & AML_NAMED))
{
-#if 0
- if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
- (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
- {
- AcpiOsPrintf ("\n\n***EXECUTABLE OPCODE %s***\n\n", WalkState->OpInfo->Name);
- *OutOp = Op;
- return (AE_CTRL_SKIP);
- }
-#endif
*OutOp = Op;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/* Check if this object has already been installed in the namespace */
@@ -238,7 +231,7 @@
if (Op->Common.Node)
{
*OutOp = Op;
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
}
@@ -262,23 +255,24 @@
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
if (Status == AE_NOT_FOUND)
{
/*
* Table disassembly:
- * Target of Scope() not found. Generate an External for it, and
+ * Target of Scope() not found. Generate an External for it, and
* insert the name into the namespace.
*/
- AcpiDmAddToExternalList (Path);
+ AcpiDmAddToExternalList (Path, ACPI_TYPE_DEVICE, 0);
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_SEARCH_PARENT,
+ WalkState, &Node);
}
#endif
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Path, Status);
- return (Status);
+ ACPI_ERROR_NAMESPACE (Path, Status);
+ return_ACPI_STATUS (Status);
}
/*
@@ -287,6 +281,7 @@
*/
switch (Node->Type)
{
+ case ACPI_TYPE_ANY:
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
@@ -301,16 +296,17 @@
case ACPI_TYPE_BUFFER:
/*
- * These types we will allow, but we will change the type. This
+ * These types we will allow, but we will change the type. This
* enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*
- * Note: silently change the type here. On the second pass, we will report a warning
+ * Note: silently change the type here. On the second pass, we will report
+ * a warning
*/
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
Path, AcpiUtGetTypeName (Node->Type)));
Node->Type = ACPI_TYPE_ANY;
@@ -321,18 +317,19 @@
/* All other types are an error */
- ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid type (%s) for target of Scope operator [%4.4s] (Cannot override)",
AcpiUtGetTypeName (Node->Type), Path));
- return (AE_AML_OPERAND_TYPE);
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
break;
default:
-
/*
- * For all other named opcodes, we will enter the name into the namespace.
+ * For all other named opcodes, we will enter the name into
+ * the namespace.
*
* Setup the search flags.
* Since we are entering a name into the namespace, we do not want to
@@ -355,6 +352,17 @@
break;
}
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (WalkState->MethodNode)
+ {
+ Node = NULL;
+ Status = AE_OK;
+ break;
+ }
+
Flags = ACPI_NS_NO_UPSEARCH;
if ((WalkState->Opcode != AML_SCOPE_OP) &&
(!(WalkState->ParseFlags & ACPI_PARSE_DEFERRED_OP)))
@@ -365,26 +373,58 @@
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "[%s] Both Find or Create allowed\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "[%s] Both Find or Create allowed\n",
AcpiUtGetTypeName (ObjectType)));
}
/*
- * Enter the named type into the internal namespace. We enter the name
- * as we go downward in the parse tree. Any necessary subobjects that involve
- * arguments to the opcode must be created as we go back up the parse tree later.
+ * Enter the named type into the internal namespace. We enter the name
+ * as we go downward in the parse tree. Any necessary subobjects that
+ * involve arguments to the opcode must be created as we go back up the
+ * parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (Path, Status);
- return (Status);
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ /* The name already exists in this scope */
+
+ if (Node->Flags & ANOBJ_IS_EXTERNAL)
+ {
+ /*
+ * Allow one create on an object or segment that was
+ * previously declared External
+ */
+ Node->Flags &= ~ANOBJ_IS_EXTERNAL;
+ Node->Type = (UINT8) ObjectType;
+
+ /* Just retyped a node, probably will need to open a scope */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+
+ Status = AE_OK;
+ }
+ }
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR_NAMESPACE (Path, Status);
+ return_ACPI_STATUS (Status);
+ }
}
break;
}
-
/* Common exit */
if (!Op)
@@ -394,28 +434,29 @@
Op = AcpiPsAllocOp (WalkState->Opcode);
if (!Op)
{
- return (AE_NO_MEMORY);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
}
- /* Initialize */
-
- Op->Named.Name = Node->Name.Integer;
+ /* Initialize the op */
#if (defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY))
- Op->Named.Path = (UINT8 *) Path;
+ Op->Named.Path = ACPI_CAST_PTR (UINT8, Path);
#endif
+ if (Node)
+ {
+ /*
+ * Put the Node in the "op" object that the parser uses, so we
+ * can get it again quickly when this scope is closed
+ */
+ Op->Common.Node = Node;
+ Op->Named.Name = Node->Name.Integer;
+ }
- /*
- * Put the Node in the "op" object that the parser uses, so we
- * can get it again quickly when this scope is closed
- */
- Op->Common.Node = Node;
AcpiPsAppendArg (AcpiPsGetParentScope (&WalkState->ParserState), Op);
-
*OutOp = Op;
- return (Status);
+ return_ACPI_STATUS (Status);
}
@@ -424,8 +465,6 @@
* FUNCTION: AcpiDsLoad1EndOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been completed in the
- * walk; Arguments have now been evaluated.
*
* RETURN: Status
*
@@ -443,7 +482,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_NAME ("DsLoad1EndOp");
+ ACPI_FUNCTION_TRACE (DsLoad1EndOp);
Op = WalkState->Op;
@@ -453,7 +492,7 @@
if (!(WalkState->OpInfo->Flags & (AML_NAMED | AML_FIELD)))
{
- return (AE_OK);
+ return_ACPI_STATUS (AE_OK);
}
/* Get the object type to determine if we should pop the scope */
@@ -463,23 +502,37 @@
#ifndef ACPI_NO_METHOD_EXECUTION
if (WalkState->OpInfo->Flags & AML_FIELD)
{
- if (WalkState->Opcode == AML_FIELD_OP ||
- WalkState->Opcode == AML_BANK_FIELD_OP ||
- WalkState->Opcode == AML_INDEX_FIELD_OP)
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (!WalkState->MethodNode)
{
- Status = AcpiDsInitFieldObjects (Op, WalkState);
+ if (WalkState->Opcode == AML_FIELD_OP ||
+ WalkState->Opcode == AML_BANK_FIELD_OP ||
+ WalkState->Opcode == AML_INDEX_FIELD_OP)
+ {
+ Status = AcpiDsInitFieldObjects (Op, WalkState);
+ }
}
- return (Status);
+ return_ACPI_STATUS (Status);
}
-
- if (Op->Common.AmlOpcode == AML_REGION_OP)
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (!WalkState->MethodNode)
{
- Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
- (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer), WalkState);
- if (ACPI_FAILURE (Status))
+ if (Op->Common.AmlOpcode == AML_REGION_OP)
{
- return (Status);
+ Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
+ (ACPI_ADR_SPACE_TYPE) ((Op->Common.Value.Arg)->Common.Value.Integer),
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
}
#endif
@@ -490,49 +543,65 @@
if (Op->Common.Value.Arg)
{
- ObjectType = (AcpiPsGetOpcodeInfo ((Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType;
- Op->Common.Node->Type = (UINT8) ObjectType;
+ ObjectType = (AcpiPsGetOpcodeInfo (
+ (Op->Common.Value.Arg)->Common.AmlOpcode))->ObjectType;
+
+ /* Set node type if we have a namespace node */
+
+ if (Op->Common.Node)
+ {
+ Op->Common.Node->Type = (UINT8) ObjectType;
+ }
}
}
- if (Op->Common.AmlOpcode == AML_METHOD_OP)
+ /*
+ * If we are executing a method, do not create any namespace objects
+ * during the load phase, only during execution.
+ */
+ if (!WalkState->MethodNode)
{
- /*
- * MethodOp PkgLength NameString MethodFlags TermList
- *
- * Note: We must create the method node/object pair as soon as we
- * see the method declaration. This allows later pass1 parsing
- * of invocations of the method (need to know the number of
- * arguments.)
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
- WalkState, Op, Op->Named.Node));
-
- if (!AcpiNsGetAttachedObject (Op->Named.Node))
+ if (Op->Common.AmlOpcode == AML_METHOD_OP)
{
- WalkState->Operands[0] = (void *) Op->Named.Node;
- WalkState->NumOperands = 1;
+ /*
+ * MethodOp PkgLength NameString MethodFlags TermList
+ *
+ * Note: We must create the method node/object pair as soon as we
+ * see the method declaration. This allows later pass1 parsing
+ * of invocations of the method (need to know the number of
+ * arguments.)
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
+ WalkState, Op, Op->Named.Node));
- Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
- if (ACPI_SUCCESS (Status))
+ if (!AcpiNsGetAttachedObject (Op->Named.Node))
{
- Status = AcpiExCreateMethod (Op->Named.Data,
- Op->Named.Length, WalkState);
- }
- WalkState->Operands[0] = NULL;
- WalkState->NumOperands = 0;
+ WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
+ WalkState->NumOperands = 1;
- if (ACPI_FAILURE (Status))
- {
- return (Status);
+ Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExCreateMethod (Op->Named.Data,
+ Op->Named.Length, WalkState);
+ }
+
+ WalkState->Operands[0] = NULL;
+ WalkState->NumOperands = 0;
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
}
}
- /* Pop the scope stack */
+ /* Pop the scope stack (only if loading a table) */
- if (AcpiNsOpensScope (ObjectType))
+ if (!WalkState->MethodNode &&
+ AcpiNsOpensScope (ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s): Popping scope for Op %p\n",
AcpiUtGetTypeName (ObjectType), Op));
@@ -540,7 +609,7 @@
Status = AcpiDsScopeStackPop (WalkState);
}
- return (Status);
+ return_ACPI_STATUS (Status);
}
@@ -549,8 +618,7 @@
* FUNCTION: AcpiDsLoad2BeginOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been reached in the
- * walk; Arguments have not been evaluated yet.
+ * OutOp - Wher to return op if a new one is created
*
* RETURN: Status
*
@@ -568,9 +636,10 @@
ACPI_STATUS Status;
ACPI_OBJECT_TYPE ObjectType;
char *BufferPtr;
+ UINT32 Flags;
- ACPI_FUNCTION_TRACE ("DsLoad2BeginOp");
+ ACPI_FUNCTION_TRACE (DsLoad2BeginOp);
Op = WalkState->Op;
@@ -578,17 +647,41 @@
if (Op)
{
+ if ((WalkState->ControlState) &&
+ (WalkState->ControlState->Common.State ==
+ ACPI_CONTROL_CONDITIONAL_EXECUTING))
+ {
+ /* We are executing a while loop outside of a method */
+
+ Status = AcpiDsExecBeginOp (WalkState, OutOp);
+ return_ACPI_STATUS (Status);
+ }
+
/* We only care about Namespace opcodes here */
- if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) && (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
+ if ((!(WalkState->OpInfo->Flags & AML_NSOPCODE) &&
+ (WalkState->Opcode != AML_INT_NAMEPATH_OP)) ||
(!(WalkState->OpInfo->Flags & AML_NAMED)))
{
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+ if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
+ (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Begin/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
+ WalkState->OpInfo->Flags));
+
+ /* Executing a type1 or type2 opcode outside of a method */
+
+ Status = AcpiDsExecBeginOp (WalkState, OutOp);
+ return_ACPI_STATUS (Status);
+ }
+#endif
return_ACPI_STATUS (AE_OK);
}
- /*
- * Get the name we are going to enter or lookup in the namespace
- */
+ /* Get the name we are going to enter or lookup in the namespace */
+
if (WalkState->Opcode == AML_INT_NAMEPATH_OP)
{
/* For Namepath op, get the path string */
@@ -605,7 +698,7 @@
{
/* Get name from the op */
- BufferPtr = (char *) &Op->Named.Name;
+ BufferPtr = ACPI_CAST_PTR (char, &Op->Named.Name);
}
}
else
@@ -622,7 +715,6 @@
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"State=%p Op=%p Type=%X\n", WalkState, Op, ObjectType));
-
switch (WalkState->Opcode)
{
case AML_FIELD_OP:
@@ -634,45 +726,49 @@
break;
case AML_INT_NAMEPATH_OP:
-
/*
- * The NamePath is an object reference to an existing object. Don't enter the
- * name into the namespace, but look it up for use later
+ * The NamePath is an object reference to an existing object.
+ * Don't enter the name into the namespace, but look it up
+ * for use later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+ WalkState, &(Node));
break;
case AML_SCOPE_OP:
-
/*
- * The Path is an object reference to an existing object. Don't enter the
- * name into the namespace, but look it up for use later
+ * The Path is an object reference to an existing object.
+ * Don't enter the name into the namespace, but look it up
+ * for use later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+ WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
-#ifdef _ACPI_ASL_COMPILER
+#ifdef ACPI_ASL_COMPILER
if (Status == AE_NOT_FOUND)
{
Status = AE_OK;
}
else
{
- ACPI_REPORT_NSERROR (BufferPtr, Status);
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
}
#else
- ACPI_REPORT_NSERROR (BufferPtr, Status);
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
#endif
return_ACPI_STATUS (Status);
}
+
/*
* We must check to make sure that the target is
* one of the opcodes that actually opens a scope
*/
switch (Node->Type)
{
+ case ACPI_TYPE_ANY:
case ACPI_TYPE_LOCAL_SCOPE: /* Scope */
case ACPI_TYPE_DEVICE:
case ACPI_TYPE_POWER:
@@ -687,14 +783,14 @@
case ACPI_TYPE_BUFFER:
/*
- * These types we will allow, but we will change the type. This
+ * These types we will allow, but we will change the type. This
* enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
*/
-
- ACPI_REPORT_WARNING (("Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)\n",
+ ACPI_WARNING ((AE_INFO,
+ "Type override - [%4.4s] had invalid type (%s) for Scope operator, changed to (Scope)",
BufferPtr, AcpiUtGetTypeName (Node->Type)));
Node->Type = ACPI_TYPE_ANY;
@@ -705,7 +801,8 @@
/* All other types are an error */
- ACPI_REPORT_ERROR (("Invalid type (%s) for target of Scope operator [%4.4s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Invalid type (%s) for target of Scope operator [%4.4s]",
AcpiUtGetTypeName (Node->Type), BufferPtr));
return (AE_AML_OPERAND_TYPE);
@@ -729,15 +826,16 @@
{
return_ACPI_STATUS (Status);
}
-
}
+
return_ACPI_STATUS (AE_OK);
}
/*
- * Enter the named type into the internal namespace. We enter the name
- * as we go downward in the parse tree. Any necessary subobjects that involve
- * arguments to the opcode must be created as we go back up the parse tree later.
+ * Enter the named type into the internal namespace. We enter the name
+ * as we go downward in the parse tree. Any necessary subobjects that
+ * involve arguments to the opcode must be created as we go back up the
+ * parse tree later.
*
* Note: Name may already exist if we are executing a deferred opcode.
*/
@@ -750,18 +848,27 @@
break;
}
+ Flags = ACPI_NS_NO_UPSEARCH;
+ if (WalkState->PassNumber == ACPI_IMODE_EXECUTE)
+ {
+ /* Execution mode, node cannot already exist, node is temporary */
+
+ Flags |= (ACPI_NS_ERROR_IF_FOUND | ACPI_NS_TEMPORARY);
+ }
+
+ /* Add new entry or lookup existing entry */
+
Status = AcpiNsLookup (WalkState->ScopeInfo, BufferPtr, ObjectType,
- ACPI_IMODE_EXECUTE, ACPI_NS_NO_UPSEARCH, WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS2, Flags, WalkState, &Node);
break;
}
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (BufferPtr, Status);
+ ACPI_ERROR_NAMESPACE (BufferPtr, Status);
return_ACPI_STATUS (Status);
}
-
if (!Op)
{
/* Create a new op */
@@ -778,10 +885,7 @@
{
Op->Named.Name = Node->Name.Integer;
}
- if (OutOp)
- {
- *OutOp = Op;
- }
+ *OutOp = Op;
}
/*
@@ -789,7 +893,6 @@
* can get it again quickly when this scope is closed
*/
Op->Common.Node = Node;
-
return_ACPI_STATUS (Status);
}
@@ -799,8 +902,6 @@
* FUNCTION: AcpiDsLoad2EndOp
*
* PARAMETERS: WalkState - Current state of the parse tree walk
- * Op - Op that has been just been completed in the
- * walk; Arguments have now been evaluated.
*
* RETURN: Status
*
@@ -824,16 +925,34 @@
#endif
- ACPI_FUNCTION_TRACE ("DsLoad2EndOp");
+ ACPI_FUNCTION_TRACE (DsLoad2EndOp);
Op = WalkState->Op;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Opcode [%s] Op %p State %p\n",
WalkState->OpInfo->Name, Op, WalkState));
- /* Only interested in opcodes that have namespace objects */
+ /* Check if opcode had an associated namespace object */
if (!(WalkState->OpInfo->Flags & AML_NSOBJECT))
{
+#ifndef ACPI_NO_METHOD_EXECUTION
+#ifdef ACPI_ENABLE_MODULE_LEVEL_CODE
+ /* No namespace object. Executable opcode? */
+
+ if ((WalkState->OpInfo->Class == AML_CLASS_EXECUTE) ||
+ (WalkState->OpInfo->Class == AML_CLASS_CONTROL))
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "End/EXEC: %s (fl %8.8X)\n", WalkState->OpInfo->Name,
+ WalkState->OpInfo->Flags));
+
+ /* Executing a type1 or type2 opcode outside of a method */
+
+ Status = AcpiDsExecEndOp (WalkState);
+ return_ACPI_STATUS (Status);
+ }
+#endif
+#endif
return_ACPI_STATUS (AE_OK);
}
@@ -843,7 +962,6 @@
"Ending scope Op=%p State=%p\n", Op, WalkState));
}
-
ObjectType = WalkState->OpInfo->ObjectType;
/*
@@ -861,7 +979,8 @@
/* Pop the scope stack */
- if (AcpiNsOpensScope (ObjectType) && (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
+ if (AcpiNsOpensScope (ObjectType) &&
+ (Op->Common.AmlOpcode != AML_INT_METHODCALL_OP))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "(%s) Popping scope for Op %p\n",
AcpiUtGetTypeName (ObjectType), Op));
@@ -914,7 +1033,6 @@
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_TYPE_CREATE_FIELD:
-
/*
* Create the field object, but the field buffer and index must
* be evaluated later during the execution phase
@@ -924,13 +1042,20 @@
case AML_TYPE_NAMED_FIELD:
+ /*
+ * If we are executing a method, initialize the field
+ */
+ if (WalkState->MethodNode)
+ {
+ Status = AcpiDsInitFieldObjects (Op, WalkState);
+ }
switch (Op->Common.AmlOpcode)
{
case AML_INDEX_FIELD_OP:
Status = AcpiDsCreateIndexField (Op, (ACPI_HANDLE) Arg->Common.Node,
- WalkState);
+ WalkState);
break;
case AML_BANK_FIELD_OP:
@@ -1014,15 +1139,37 @@
{
#ifndef ACPI_NO_METHOD_EXECUTION
case AML_REGION_OP:
+
+ /*
+ * If we are executing a method, initialize the region
+ */
+ if (WalkState->MethodNode)
+ {
+ Status = AcpiExCreateRegion (Op->Named.Data, Op->Named.Length,
+ (ACPI_ADR_SPACE_TYPE)
+ ((Op->Common.Value.Arg)->Common.Value.Integer),
+ WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
/*
- * The OpRegion is not fully parsed at this time. Only valid argument is the SpaceId.
- * (We must save the address of the AML of the address and length operands)
+ * The OpRegion is not fully parsed at this time. Only valid
+ * argument is the SpaceId. (We must save the address of the
+ * AML of the address and length operands)
*/
+
/*
* If we have a valid region, initialize it
* Namespace is NOT locked at this point.
+ *
+ * TBD: need to unlock interpreter if it is locked, in order
+ * to allow _REG methods to be run.
*/
- Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node), FALSE);
+ Status = AcpiEvInitializeRegion (AcpiNsGetAttachedObject (Node),
+ FALSE);
if (ACPI_FAILURE (Status))
{
/*
@@ -1042,12 +1189,46 @@
Status = AcpiDsCreateNode (WalkState, Node, Op);
break;
-#endif /* ACPI_NO_METHOD_EXECUTION */
+ case AML_METHOD_OP:
+ /*
+ * MethodOp PkgLength NameString MethodFlags TermList
+ *
+ * Note: We must create the method node/object pair as soon as we
+ * see the method declaration. This allows later pass1 parsing
+ * of invocations of the method (need to know the number of
+ * arguments.)
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "LOADING-Method: State=%p Op=%p NamedObj=%p\n",
+ WalkState, Op, Op->Named.Node));
+
+ if (!AcpiNsGetAttachedObject (Op->Named.Node))
+ {
+ WalkState->Operands[0] = ACPI_CAST_PTR (void, Op->Named.Node);
+ WalkState->NumOperands = 1;
+
+ Status = AcpiDsCreateOperands (WalkState, Op->Common.Value.Arg);
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AcpiExCreateMethod (Op->Named.Data,
+ Op->Named.Length, WalkState);
+ }
+ WalkState->Operands[0] = NULL;
+ WalkState->NumOperands = 0;
+
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
+ break;
+
+#endif /* ACPI_NO_METHOD_EXECUTION */
+
default:
/* All NAMED_COMPLEX opcodes must be handled above */
- /* Note: Method objects were already created in Pass 1 */
break;
}
break;
@@ -1076,22 +1257,23 @@
{
/*
* Make sure that what we found is indeed a method
- * We didn't search for a method on purpose, to see if the name would resolve
+ * We didn't search for a method on purpose, to see if the name
+ * would resolve
*/
if (NewNode->Type != ACPI_TYPE_METHOD)
{
Status = AE_AML_OPERAND_TYPE;
}
- /* We could put the returned object (Node) on the object stack for later, but
- * for now, we will put it in the "op" object that the parser uses, so we
- * can get it again at the end of this scope
+ /* We could put the returned object (Node) on the object stack for
+ * later, but for now, we will put it in the "op" object that the
+ * parser uses, so we can get it again at the end of this scope
*/
Op->Common.Node = NewNode;
}
else
{
- ACPI_REPORT_NSERROR (Arg->Common.Value.String, Status);
+ ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
}
break;
Index: evgpeblk.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evgpeblk.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evgpeblk.c -L sys/contrib/dev/acpica/evgpeblk.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evgpeblk.c
+++ sys/contrib/dev/acpica/evgpeblk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpeblk - GPE block creation and initialization.
- * $Revision: 39 $
+ * $Revision: 1.60 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,39 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpeblk")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiEvSaveMethodInfo (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *ObjDesc,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiEvMatchPrwAndGpe (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Info,
+ void **ReturnValue);
+
+static ACPI_GPE_XRUPT_INFO *
+AcpiEvGetGpeXruptBlock (
+ UINT32 InterruptNumber);
+
+static ACPI_STATUS
+AcpiEvDeleteGpeXrupt (
+ ACPI_GPE_XRUPT_INFO *GpeXrupt);
+
+static ACPI_STATUS
+AcpiEvInstallGpeBlock (
+ ACPI_GPE_BLOCK_INFO *GpeBlock,
+ UINT32 InterruptNumber);
+
+static ACPI_STATUS
+AcpiEvCreateGpeInfoBlocks (
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
/*******************************************************************************
*
@@ -130,7 +163,7 @@
*
* RETURN: TRUE if the GpeEvent is valid
*
- * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
+ * DESCRIPTION: Validate a GPE event. DO NOT CALL FROM INTERRUPT LEVEL.
* Should be called only when the GPE lists are semaphore locked
* and not subject to change.
*
@@ -181,7 +214,6 @@
* FUNCTION: AcpiEvWalkGpeList
*
* PARAMETERS: GpeWalkCallback - Routine called for each GPE block
- * Flags - ACPI_NOT_ISR or ACPI_ISR
*
* RETURN: Status
*
@@ -191,18 +223,18 @@
ACPI_STATUS
AcpiEvWalkGpeList (
- ACPI_GPE_CALLBACK GpeWalkCallback,
- UINT32 Flags)
+ ACPI_GPE_CALLBACK GpeWalkCallback)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
ACPI_STATUS Status = AE_OK;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvWalkGpeList");
+ ACPI_FUNCTION_TRACE (EvWalkGpeList);
- AcpiOsAcquireLock (AcpiGbl_GpeLock, Flags);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
/* Walk the interrupt level descriptor list */
@@ -234,7 +266,7 @@
}
-/******************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiEvDeleteGpeHandlers
*
@@ -258,7 +290,7 @@
ACPI_NATIVE_UINT j;
- ACPI_FUNCTION_TRACE ("EvDeleteGpeHandlers");
+ ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
/* Examine each GPE Register within the block */
@@ -271,9 +303,10 @@
{
GpeEventInfo = &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j];
- if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_HANDLER)
+ if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+ ACPI_GPE_DISPATCH_HANDLER)
{
- ACPI_MEM_FREE (GpeEventInfo->Dispatch.Handler);
+ ACPI_FREE (GpeEventInfo->Dispatch.Handler);
GpeEventInfo->Dispatch.Handler = NULL;
GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
}
@@ -292,7 +325,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
+ * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
* control method under the _GPE portion of the namespace.
* Extract the name and GPE type from the object, saving this
* information for quick lookup during GPE dispatch
@@ -321,7 +354,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvSaveMethodInfo");
+ ACPI_FUNCTION_TRACE (EvSaveMethodInfo);
/*
@@ -329,15 +362,15 @@
*
* 1) Extract the name from the object and convert to a string
*/
- ACPI_MOVE_32_TO_32 (Name,
- &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
+ ACPI_MOVE_32_TO_32 (
+ Name, &((ACPI_NAMESPACE_NODE *) ObjHandle)->Name.Integer);
Name[ACPI_NAME_SIZE] = 0;
/*
* 2) Edge/Level determination is based on the 2nd character
* of the method name
*
- * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
+ * NOTE: Default GPE type is RUNTIME. May be changed later to WAKE
* if a _PRW object is found that points to this GPE.
*/
switch (Name[1])
@@ -353,8 +386,8 @@
default:
/* Unknown method type, just ignore it! */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unknown GPE method type: %s (name not of form _Lxx or _Exx)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
+ "Ignoring unknown GPE method type: %s (name not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@@ -366,8 +399,8 @@
{
/* Conversion failed; invalid method, just ignore it */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
+ "Could not extract GPE number from name: %s (name is not of form _Lxx or _Exx)",
Name));
return_ACPI_STATUS (AE_OK);
}
@@ -387,13 +420,13 @@
/*
* Now we can add this information to the GpeEventInfo block
- * for use during dispatch of this GPE. Default type is RUNTIME, although
+ * for use during dispatch of this GPE. Default type is RUNTIME, although
* this may change when the _PRW methods are executed later.
*/
GpeEventInfo = &GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber];
- GpeEventInfo->Flags = (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD |
- ACPI_GPE_TYPE_RUNTIME);
+ GpeEventInfo->Flags = (UINT8)
+ (Type | ACPI_GPE_DISPATCH_METHOD | ACPI_GPE_TYPE_RUNTIME);
GpeEventInfo->Dispatch.MethodNode = (ACPI_NAMESPACE_NODE *) ObjHandle;
@@ -414,11 +447,11 @@
*
* PARAMETERS: Callback from WalkNamespace
*
- * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
+ * RETURN: Status. NOTE: We ignore errors so that the _PRW walk is
* not aborted on a single _PRW failure.
*
- * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
- * Device. Run the _PRW method. If present, extract the GPE
+ * DESCRIPTION: Called from AcpiWalkNamespace. Expects each object to be a
+ * Device. Run the _PRW method. If present, extract the GPE
* number and mark the GPE as a WAKE GPE.
*
******************************************************************************/
@@ -441,7 +474,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvMatchPrwAndGpe");
+ ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe);
/* Check for a _PRW method under this device */
@@ -523,6 +556,7 @@
/* Mark GPE for WAKE-ONLY but WAKE_DISABLED */
GpeEventInfo->Flags &= ~(ACPI_GPE_WAKE_ENABLED | ACPI_GPE_RUN_ENABLED);
+
Status = AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
if (ACPI_FAILURE (Status))
{
@@ -541,11 +575,11 @@
*
* FUNCTION: AcpiEvGetGpeXruptBlock
*
- * PARAMETERS: InterruptLevel - Interrupt for a GPE block
+ * PARAMETERS: InterruptNumber - Interrupt for a GPE block
*
* RETURN: A GPE interrupt block
*
- * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
+ * DESCRIPTION: Get or Create a GPE interrupt block. There is one interrupt
* block per unique interrupt level used for GPEs.
* Should be called only when the GPE lists are semaphore locked
* and not subject to change.
@@ -554,22 +588,23 @@
static ACPI_GPE_XRUPT_INFO *
AcpiEvGetGpeXruptBlock (
- UINT32 InterruptLevel)
+ UINT32 InterruptNumber)
{
ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
ACPI_GPE_XRUPT_INFO *GpeXrupt;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvGetGpeXruptBlock");
+ ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
- /* No need for spin lock since we are not changing any list elements here */
+ /* No need for lock since we are not changing any list elements here */
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
while (NextGpeXrupt)
{
- if (NextGpeXrupt->InterruptLevel == InterruptLevel)
+ if (NextGpeXrupt->InterruptNumber == InterruptNumber)
{
return_PTR (NextGpeXrupt);
}
@@ -579,17 +614,17 @@
/* Not found, must allocate a new xrupt descriptor */
- GpeXrupt = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_XRUPT_INFO));
+ GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
if (!GpeXrupt)
{
return_PTR (NULL);
}
- GpeXrupt->InterruptLevel = InterruptLevel;
+ GpeXrupt->InterruptNumber = InterruptNumber;
/* Install new interrupt descriptor with spin lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (AcpiGbl_GpeXruptListHead)
{
NextGpeXrupt = AcpiGbl_GpeXruptListHead;
@@ -605,19 +640,19 @@
{
AcpiGbl_GpeXruptListHead = GpeXrupt;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Install new interrupt handler if not SCI_INT */
- if (InterruptLevel != AcpiGbl_FADT->SciInt)
+ if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
{
- Status = AcpiOsInstallInterruptHandler (InterruptLevel,
+ Status = AcpiOsInstallInterruptHandler (InterruptNumber,
AcpiEvGpeXruptHandler, GpeXrupt);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not install GPE interrupt handler at level 0x%X\n",
- InterruptLevel));
+ ACPI_ERROR ((AE_INFO,
+ "Could not install GPE interrupt handler at level 0x%X",
+ InterruptNumber));
return_PTR (NULL);
}
}
@@ -634,7 +669,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
+ * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
* interrupt handler if not the SCI interrupt.
*
******************************************************************************/
@@ -644,14 +679,15 @@
ACPI_GPE_XRUPT_INFO *GpeXrupt)
{
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvDeleteGpeXrupt");
+ ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
/* We never want to remove the SCI interrupt handler */
- if (GpeXrupt->InterruptLevel == AcpiGbl_FADT->SciInt)
+ if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
{
GpeXrupt->GpeBlockListHead = NULL;
return_ACPI_STATUS (AE_OK);
@@ -659,8 +695,8 @@
/* Disable this interrupt */
- Status = AcpiOsRemoveInterruptHandler (GpeXrupt->InterruptLevel,
- AcpiEvGpeXruptHandler);
+ Status = AcpiOsRemoveInterruptHandler (
+ GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -668,7 +704,7 @@
/* Unlink the interrupt block with lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeXrupt->Previous)
{
GpeXrupt->Previous->Next = GpeXrupt->Next;
@@ -678,11 +714,11 @@
{
GpeXrupt->Next->Previous = GpeXrupt->Previous;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
/* Free the block */
- ACPI_MEM_FREE (GpeXrupt);
+ ACPI_FREE (GpeXrupt);
return_ACPI_STATUS (AE_OK);
}
@@ -692,7 +728,7 @@
* FUNCTION: AcpiEvInstallGpeBlock
*
* PARAMETERS: GpeBlock - New GPE block
- * InterruptLevel - Level to be associated with this GPE block
+ * InterruptNumber - Xrupt to be associated with this GPE block
*
* RETURN: Status
*
@@ -703,14 +739,15 @@
static ACPI_STATUS
AcpiEvInstallGpeBlock (
ACPI_GPE_BLOCK_INFO *GpeBlock,
- UINT32 InterruptLevel)
+ UINT32 InterruptNumber)
{
ACPI_GPE_BLOCK_INFO *NextGpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+ ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -719,16 +756,16 @@
return_ACPI_STATUS (Status);
}
- GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptLevel);
+ GpeXruptBlock = AcpiEvGetGpeXruptBlock (InterruptNumber);
if (!GpeXruptBlock)
{
Status = AE_NO_MEMORY;
goto UnlockAndExit;
}
- /* Install the new block at the end of the list for this interrupt with lock */
+ /* Install the new block at the end of the list with lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeXruptBlock->GpeBlockListHead)
{
NextGpeBlock = GpeXruptBlock->GpeBlockListHead;
@@ -746,7 +783,8 @@
}
GpeBlock->XruptBlock = GpeXruptBlock;
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+
UnlockAndExit:
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
@@ -771,9 +809,10 @@
ACPI_GPE_BLOCK_INFO *GpeBlock)
{
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
- ACPI_FUNCTION_TRACE ("EvInstallGpeBlock");
+ ACPI_FUNCTION_TRACE (EvInstallGpeBlock);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -800,7 +839,7 @@
{
/* Remove the block on this interrupt with lock */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
if (GpeBlock->Previous)
{
GpeBlock->Previous->Next = GpeBlock->Next;
@@ -814,14 +853,14 @@
{
GpeBlock->Next->Previous = GpeBlock->Previous;
}
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_NOT_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
}
/* Free the GpeBlock */
- ACPI_MEM_FREE (GpeBlock->RegisterInfo);
- ACPI_MEM_FREE (GpeBlock->EventInfo);
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock->RegisterInfo);
+ ACPI_FREE (GpeBlock->EventInfo);
+ ACPI_FREE (GpeBlock);
UnlockAndExit:
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
@@ -854,31 +893,33 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvCreateGpeInfoBlocks");
+ ACPI_FUNCTION_TRACE (EvCreateGpeInfoBlocks);
/* Allocate the GPE register information block */
- GpeRegisterInfo = ACPI_MEM_CALLOCATE (
- (ACPI_SIZE) GpeBlock->RegisterCount *
- sizeof (ACPI_GPE_REGISTER_INFO));
+ GpeRegisterInfo = ACPI_ALLOCATE_ZEROED (
+ (ACPI_SIZE) GpeBlock->RegisterCount *
+ sizeof (ACPI_GPE_REGISTER_INFO));
if (!GpeRegisterInfo)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not allocate the GpeRegisterInfo table\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate the GpeRegisterInfo table"));
return_ACPI_STATUS (AE_NO_MEMORY);
}
/*
- * Allocate the GPE EventInfo block. There are eight distinct GPEs
- * per register. Initialization to zeros is sufficient.
+ * Allocate the GPE EventInfo block. There are eight distinct GPEs
+ * per register. Initialization to zeros is sufficient.
*/
- GpeEventInfo = ACPI_MEM_CALLOCATE (
- ((ACPI_SIZE) GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) *
+ GpeEventInfo = ACPI_ALLOCATE_ZEROED (
+ ((ACPI_SIZE) GpeBlock->RegisterCount *
+ ACPI_GPE_REGISTER_WIDTH) *
sizeof (ACPI_GPE_EVENT_INFO));
if (!GpeEventInfo)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not allocate the GpeEventInfo table\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate the GpeEventInfo table"));
Status = AE_NO_MEMORY;
goto ErrorExit;
}
@@ -889,9 +930,9 @@
GpeBlock->EventInfo = GpeEventInfo;
/*
- * Initialize the GPE Register and Event structures. A goal of these
+ * Initialize the GPE Register and Event structures. A goal of these
* tables is to hide the fact that there are two separate GPE register sets
- * in a given gpe hardware block, the status registers occupy the first half,
+ * in a given GPE hardware block, the status registers occupy the first half,
* and the enable registers occupy the second half.
*/
ThisRegister = GpeRegisterInfo;
@@ -902,38 +943,32 @@
/* Init the RegisterInfo for this GPE register (8 GPEs) */
ThisRegister->BaseGpeNumber = (UINT8) (GpeBlock->BlockBaseNumber +
- (i * ACPI_GPE_REGISTER_WIDTH));
+ (i * ACPI_GPE_REGISTER_WIDTH));
+
+ ThisRegister->StatusAddress.Address =
+ GpeBlock->BlockAddress.Address + i;
- ACPI_STORE_ADDRESS (ThisRegister->StatusAddress.Address,
- (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
- + i));
-
- ACPI_STORE_ADDRESS (ThisRegister->EnableAddress.Address,
- (ACPI_GET_ADDRESS (GpeBlock->BlockAddress.Address)
- + i
- + GpeBlock->RegisterCount));
-
- ThisRegister->StatusAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
- ThisRegister->EnableAddress.AddressSpaceId = GpeBlock->BlockAddress.AddressSpaceId;
- ThisRegister->StatusAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
- ThisRegister->EnableAddress.RegisterBitWidth = ACPI_GPE_REGISTER_WIDTH;
- ThisRegister->StatusAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
- ThisRegister->EnableAddress.RegisterBitOffset = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->EnableAddress.Address =
+ GpeBlock->BlockAddress.Address + i + GpeBlock->RegisterCount;
+
+ ThisRegister->StatusAddress.SpaceId = GpeBlock->BlockAddress.SpaceId;
+ ThisRegister->EnableAddress.SpaceId = GpeBlock->BlockAddress.SpaceId;
+ ThisRegister->StatusAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->EnableAddress.BitWidth = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->StatusAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
+ ThisRegister->EnableAddress.BitOffset = ACPI_GPE_REGISTER_WIDTH;
/* Init the EventInfo for each GPE within this register */
for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
{
- ThisEvent->RegisterBit = AcpiGbl_DecodeTo8bit[j];
+ ThisEvent->GpeNumber = (UINT8) (ThisRegister->BaseGpeNumber + j);
ThisEvent->RegisterInfo = ThisRegister;
ThisEvent++;
}
- /*
- * Clear the status/enable registers. Note that status registers
- * are cleared by writing a '1', while enable registers are cleared
- * by writing a '0'.
- */
+ /* Disable all GPEs within this register */
+
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0x00,
&ThisRegister->EnableAddress);
if (ACPI_FAILURE (Status))
@@ -941,6 +976,8 @@
goto ErrorExit;
}
+ /* Clear any pending GPE events within this register */
+
Status = AcpiHwLowLevelWrite (ACPI_GPE_REGISTER_WIDTH, 0xFF,
&ThisRegister->StatusAddress);
if (ACPI_FAILURE (Status))
@@ -957,11 +994,11 @@
ErrorExit:
if (GpeRegisterInfo)
{
- ACPI_MEM_FREE (GpeRegisterInfo);
+ ACPI_FREE (GpeRegisterInfo);
}
if (GpeEventInfo)
{
- ACPI_MEM_FREE (GpeEventInfo);
+ ACPI_FREE (GpeEventInfo);
}
return_ACPI_STATUS (Status);
@@ -976,12 +1013,14 @@
* GpeBlockAddress - Address and SpaceID
* RegisterCount - Number of GPE register pairs in the block
* GpeBlockBaseNumber - Starting GPE number for the block
- * InterruptLevel - H/W interrupt for the block
+ * InterruptNumber - H/W interrupt for the block
* ReturnGpeBlock - Where the new block descriptor is returned
*
* RETURN: Status
*
- * DESCRIPTION: Create and Install a block of GPE registers
+ * DESCRIPTION: Create and Install a block of GPE registers. All GPEs within
+ * the block are disabled at exit.
+ * Note: Assumes namespace is locked.
*
******************************************************************************/
@@ -991,20 +1030,14 @@
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
UINT8 GpeBlockBaseNumber,
- UINT32 InterruptLevel,
+ UINT32 InterruptNumber,
ACPI_GPE_BLOCK_INFO **ReturnGpeBlock)
{
- ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_NATIVE_UINT i;
- ACPI_NATIVE_UINT j;
- UINT32 WakeGpeCount;
- UINT32 GpeEnabledCount;
ACPI_STATUS Status;
- ACPI_GPE_WALK_INFO GpeInfo;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_FUNCTION_TRACE ("EvCreateGpeBlock");
+ ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
if (!RegisterCount)
@@ -1014,7 +1047,7 @@
/* Allocate a new GPE block */
- GpeBlock = ACPI_MEM_CALLOCATE (sizeof (ACPI_GPE_BLOCK_INFO));
+ GpeBlock = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_BLOCK_INFO));
if (!GpeBlock)
{
return_ACPI_STATUS (AE_NO_MEMORY);
@@ -1022,60 +1055,126 @@
/* Initialize the new GPE block */
- GpeBlock->RegisterCount = RegisterCount;
+ GpeBlock->Node = GpeDevice;
+ GpeBlock->RegisterCount = RegisterCount;
GpeBlock->BlockBaseNumber = GpeBlockBaseNumber;
- GpeBlock->Node = GpeDevice;
- ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress, sizeof (ACPI_GENERIC_ADDRESS));
-
- /* Create the RegisterInfo and EventInfo sub-structures */
+ ACPI_MEMCPY (&GpeBlock->BlockAddress, GpeBlockAddress,
+ sizeof (ACPI_GENERIC_ADDRESS));
+ /*
+ * Create the RegisterInfo and EventInfo sub-structures
+ * Note: disables and clears all GPEs in the block
+ */
Status = AcpiEvCreateGpeInfoBlocks (GpeBlock);
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock);
return_ACPI_STATUS (Status);
}
- /* Install the new block in the global list(s) */
+ /* Install the new block in the global lists */
- Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptLevel);
+ Status = AcpiEvInstallGpeBlock (GpeBlock, InterruptNumber);
if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (GpeBlock);
+ ACPI_FREE (GpeBlock);
return_ACPI_STATUS (Status);
}
/* Find all GPE methods (_Lxx, _Exx) for this block */
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
- ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK, AcpiEvSaveMethodInfo,
- GpeBlock, NULL);
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+ AcpiEvSaveMethodInfo, GpeBlock, NULL);
+
+ /* Return the new block */
+
+ if (ReturnGpeBlock)
+ {
+ (*ReturnGpeBlock) = GpeBlock;
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
+ "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
+ (UINT32) GpeBlock->BlockBaseNumber,
+ (UINT32) (GpeBlock->BlockBaseNumber +
+ ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
+ GpeDevice->Name.Ascii,
+ GpeBlock->RegisterCount,
+ InterruptNumber));
+
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvInitializeGpeBlock
+ *
+ * PARAMETERS: GpeDevice - Handle to the parent GPE block
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize and enable a GPE block. First find and run any
+ * _PRT methods associated with the block, then enable the
+ * appropriate GPEs.
+ * Note: Assumes namespace is locked.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvInitializeGpeBlock (
+ ACPI_NAMESPACE_NODE *GpeDevice,
+ ACPI_GPE_BLOCK_INFO *GpeBlock)
+{
+ ACPI_STATUS Status;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ ACPI_GPE_WALK_INFO GpeInfo;
+ UINT32 WakeGpeCount;
+ UINT32 GpeEnabledCount;
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+
+
+ ACPI_FUNCTION_TRACE (EvInitializeGpeBlock);
+
+
+ /* Ignore a null GPE block (e.g., if no GPE block 1 exists) */
+
+ if (!GpeBlock)
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
/*
- * Runtime option: Should Wake GPEs be enabled at runtime? The default
- * is No,they should only be enabled just as the machine goes to sleep.
+ * Runtime option: Should wake GPEs be enabled at runtime? The default
+ * is no, they should only be enabled just as the machine goes to sleep.
*/
if (AcpiGbl_LeaveWakeGpesDisabled)
{
/*
- * Differentiate RUNTIME vs WAKE GPEs, via the _PRW control methods.
- * (Each GPE that has one or more _PRWs that reference it is by
- * definition a WAKE GPE and will not be enabled while the machine
- * is running.)
+ * Differentiate runtime vs wake GPEs, via the _PRW control methods.
+ * Each GPE that has one or more _PRWs that reference it is by
+ * definition a wake GPE and will not be enabled while the machine
+ * is running.
*/
GpeInfo.GpeBlock = GpeBlock;
GpeInfo.GpeDevice = GpeDevice;
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK, AcpiEvMatchPrwAndGpe,
- &GpeInfo, NULL);
+ ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
+ AcpiEvMatchPrwAndGpe, &GpeInfo, NULL);
}
/*
- * Enable all GPEs in this block that are 1) "runtime" or "run/wake" GPEs,
- * and 2) have a corresponding _Lxx or _Exx method. All other GPEs must
- * be enabled via the AcpiEnableGpe() external interface.
+ * Enable all GPEs in this block that have these attributes:
+ * 1) are "runtime" or "run/wake" GPEs, and
+ * 2) have a corresponding _Lxx or _Exx method
+ *
+ * Any other GPEs within this block must be enabled via the AcpiEnableGpe()
+ * external interface.
*/
WakeGpeCount = 0;
GpeEnabledCount = 0;
@@ -1101,33 +1200,20 @@
}
}
- /* Dump info about this GPE block */
-
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
- "GPE %02X to %02X [%4.4s] %u regs on int 0x%X\n",
- (UINT32) GpeBlock->BlockBaseNumber,
- (UINT32) (GpeBlock->BlockBaseNumber +
- ((GpeBlock->RegisterCount * ACPI_GPE_REGISTER_WIDTH) -1)),
- GpeDevice->Name.Ascii,
- GpeBlock->RegisterCount,
- InterruptLevel));
+ "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
+ WakeGpeCount, GpeEnabledCount));
- /* Enable all valid GPEs found above */
+ /* Enable all valid runtime GPEs found above */
Status = AcpiHwEnableRuntimeGpeBlock (NULL, GpeBlock);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
- "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
- WakeGpeCount, GpeEnabledCount));
-
- /* Return the new block */
-
- if (ReturnGpeBlock)
+ if (ACPI_FAILURE (Status))
{
- (*ReturnGpeBlock) = GpeBlock;
+ ACPI_ERROR ((AE_INFO, "Could not enable GPEs in GpeBlock %p",
+ GpeBlock));
}
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
@@ -1153,7 +1239,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvGpeInitialize");
+ ACPI_FUNCTION_TRACE (EvGpeInitialize);
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
@@ -1187,44 +1273,44 @@
* If EITHER the register length OR the block address are zero, then that
* particular block is not supported.
*/
- if (AcpiGbl_FADT->Gpe0BlkLen &&
- ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe0Blk.Address))
+ if (AcpiGbl_FADT.Gpe0BlockLength &&
+ AcpiGbl_FADT.XGpe0Block.Address)
{
/* GPE block 0 exists (has both length and address > 0) */
- RegisterCount0 = (UINT16) (AcpiGbl_FADT->Gpe0BlkLen / 2);
+ RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
/* Install GPE Block 0 */
- Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, &AcpiGbl_FADT->XGpe0Blk,
- RegisterCount0, 0, AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[0]);
+ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
+ &AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0,
+ AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Could not create GPE Block 0, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not create GPE Block 0"));
}
}
- if (AcpiGbl_FADT->Gpe1BlkLen &&
- ACPI_GET_ADDRESS (AcpiGbl_FADT->XGpe1Blk.Address))
+ if (AcpiGbl_FADT.Gpe1BlockLength &&
+ AcpiGbl_FADT.XGpe1Block.Address)
{
/* GPE block 1 exists (has both length and address > 0) */
- RegisterCount1 = (UINT16) (AcpiGbl_FADT->Gpe1BlkLen / 2);
+ RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
/* Check for GPE0/GPE1 overlap (if both banks exist) */
if ((RegisterCount0) &&
- (GpeNumberMax >= AcpiGbl_FADT->Gpe1Base))
+ (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
{
- ACPI_REPORT_ERROR ((
- "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1\n",
- GpeNumberMax, AcpiGbl_FADT->Gpe1Base,
- AcpiGbl_FADT->Gpe1Base +
+ ACPI_ERROR ((AE_INFO,
+ "GPE0 block (GPE 0 to %d) overlaps the GPE1 block (GPE %d to %d) - Ignoring GPE1",
+ GpeNumberMax, AcpiGbl_FADT.Gpe1Base,
+ AcpiGbl_FADT.Gpe1Base +
((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1)));
/* Ignore GPE1 block by setting the register count to zero */
@@ -1235,23 +1321,23 @@
{
/* Install GPE Block 1 */
- Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice, &AcpiGbl_FADT->XGpe1Blk,
- RegisterCount1, AcpiGbl_FADT->Gpe1Base,
- AcpiGbl_FADT->SciInt, &AcpiGbl_GpeFadtBlocks[1]);
+ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
+ &AcpiGbl_FADT.XGpe1Block, RegisterCount1,
+ AcpiGbl_FADT.Gpe1Base,
+ AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "Could not create GPE Block 1, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not create GPE Block 1"));
}
/*
* GPE0 and GPE1 do not have to be contiguous in the GPE number
* space. However, GPE0 always starts at GPE number zero.
*/
- GpeNumberMax = AcpiGbl_FADT->Gpe1Base +
- ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
+ GpeNumberMax = AcpiGbl_FADT.Gpe1Base +
+ ((RegisterCount1 * ACPI_GPE_REGISTER_WIDTH) - 1);
}
}
@@ -1262,7 +1348,7 @@
/* GPEs are not required by ACPI, this is OK */
ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
- "There are no GPE blocks defined in the FADT\n"));
+ "There are no GPE blocks defined in the FADT\n"));
Status = AE_OK;
goto Cleanup;
}
@@ -1271,7 +1357,8 @@
if (GpeNumberMax > ACPI_GPE_MAX)
{
- ACPI_REPORT_ERROR (("Maximum GPE number from FADT is too large: 0x%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Maximum GPE number from FADT is too large: 0x%X",
GpeNumberMax));
Status = AE_BAD_VALUE;
goto Cleanup;
Index: acefi.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acefi.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acefi.h -L sys/contrib/dev/acpica/acefi.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acefi.h
+++ sys/contrib/dev/acpica/acefi.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acefi.h - OS specific defines, etc.
- * $Revision: 15 $
+ * $Revision: 1.18 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
Index: nsdumpdv.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsdumpdv.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsdumpdv.c -L sys/contrib/dev/acpica/nsdumpdv.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsdumpdv.c
+++ sys/contrib/dev/acpica/nsdumpdv.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsdump - table dumping routines for debug
- * $Revision: 12 $
+ * $Revision: 1.20 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,15 +118,18 @@
#define __NSDUMPDV_C__
#include <contrib/dev/acpica/acpi.h>
-#include <contrib/dev/acpica/acnamesp.h>
+/* TBD: This entire module is apparently obsolete and should be removed */
+
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsdumpdv")
-
+#ifdef ACPI_OBSOLETE_FUNCTIONS
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+#include <contrib/dev/acpica/acnamesp.h>
+
/*******************************************************************************
*
* FUNCTION: AcpiNsDumpOneDevice
@@ -134,13 +137,16 @@
* PARAMETERS: Handle - Node to be dumped
* Level - Nesting level of the handle
* Context - Passed into WalkNamespace
+ * ReturnValue - Not used
+ *
+ * RETURN: Status
*
* DESCRIPTION: Dump a single Node that represents a device
* This procedure is a UserFunction called by AcpiNsWalkNamespace.
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiNsDumpOneDevice (
ACPI_HANDLE ObjHandle,
UINT32 Level,
@@ -153,7 +159,7 @@
UINT32 i;
- ACPI_FUNCTION_NAME ("NsDumpOneDevice");
+ ACPI_FUNCTION_NAME (NsDumpOneDevice);
Status = AcpiNsDumpOneObject (ObjHandle, Level, Context, ReturnValue);
@@ -172,7 +178,7 @@
" HID: %s, ADR: %8.8X%8.8X, Status: %X\n",
Info->HardwareId.Value, ACPI_FORMAT_UINT64 (Info->Address),
Info->CurrentStatus));
- ACPI_MEM_FREE (Info);
+ ACPI_FREE (Info);
}
return (Status);
@@ -185,18 +191,21 @@
*
* PARAMETERS: None
*
+ * RETURN: None
+ *
* DESCRIPTION: Dump all objects of type "device"
*
******************************************************************************/
void
-AcpiNsDumpRootDevices (void)
+AcpiNsDumpRootDevices (
+ void)
{
ACPI_HANDLE SysBusHandle;
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("NsDumpRootDevices");
+ ACPI_FUNCTION_NAME (NsDumpRootDevices);
/* Only dump the table if tracing is enabled */
@@ -221,5 +230,6 @@
}
#endif
+#endif
Index: utdelete.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utdelete.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utdelete.c -L sys/contrib/dev/acpica/utdelete.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utdelete.c
+++ sys/contrib/dev/acpica/utdelete.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: utdelete - object deletion and reference count utilities
- * $Revision: 100 $
+ * $Revision: 1.123 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,16 +120,28 @@
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acevents.h>
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utdelete")
+/* Local prototypes */
+
+static void
+AcpiUtDeleteInternalObj (
+ ACPI_OPERAND_OBJECT *Object);
+
+static void
+AcpiUtUpdateRefCount (
+ ACPI_OPERAND_OBJECT *Object,
+ UINT32 Action);
+
/*******************************************************************************
*
* FUNCTION: AcpiUtDeleteInternalObj
*
- * PARAMETERS: *Object - Pointer to the list to be deleted
+ * PARAMETERS: Object - Object to be deleted
*
* RETURN: None
*
@@ -138,7 +150,7 @@
*
******************************************************************************/
-void
+static void
AcpiUtDeleteInternalObj (
ACPI_OPERAND_OBJECT *Object)
{
@@ -148,7 +160,7 @@
ACPI_OPERAND_OBJECT *NextDesc;
- ACPI_FUNCTION_TRACE_PTR ("UtDeleteInternalObj", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtDeleteInternalObj, Object);
if (!Object)
@@ -231,41 +243,59 @@
case ACPI_TYPE_MUTEX:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Mutex %p, Semaphore %p\n",
- Object, Object->Mutex.Semaphore));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Mutex %p, OS Mutex %p\n",
+ Object, Object->Mutex.OsMutex));
- AcpiExUnlinkMutex (Object);
- (void) AcpiOsDeleteSemaphore (Object->Mutex.Semaphore);
+ if (Object == AcpiGbl_GlobalLockMutex)
+ {
+ /* Global Lock has extra semaphore */
+
+ (void) AcpiOsDeleteSemaphore (AcpiGbl_GlobalLockSemaphore);
+ AcpiGbl_GlobalLockSemaphore = NULL;
+
+ AcpiOsDeleteMutex (Object->Mutex.OsMutex);
+ AcpiGbl_GlobalLockMutex = NULL;
+ }
+ else
+ {
+ AcpiExUnlinkMutex (Object);
+ AcpiOsDeleteMutex (Object->Mutex.OsMutex);
+ }
break;
case ACPI_TYPE_EVENT:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Event %p, Semaphore %p\n",
- Object, Object->Event.Semaphore));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Event %p, OS Semaphore %p\n",
+ Object, Object->Event.OsSemaphore));
- (void) AcpiOsDeleteSemaphore (Object->Event.Semaphore);
- Object->Event.Semaphore = NULL;
+ (void) AcpiOsDeleteSemaphore (Object->Event.OsSemaphore);
+ Object->Event.OsSemaphore = NULL;
break;
case ACPI_TYPE_METHOD:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Method %p\n", Object));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Method %p\n", Object));
- /* Delete the method semaphore if it exists */
+ /* Delete the method mutex if it exists */
- if (Object->Method.Semaphore)
+ if (Object->Method.Mutex)
{
- (void) AcpiOsDeleteSemaphore (Object->Method.Semaphore);
- Object->Method.Semaphore = NULL;
+ AcpiOsDeleteMutex (Object->Method.Mutex->Mutex.OsMutex);
+ AcpiUtDeleteObjectDesc (Object->Method.Mutex);
+ Object->Method.Mutex = NULL;
}
break;
case ACPI_TYPE_REGION:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Region %p\n", Object));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Region %p\n", Object));
SecondDesc = AcpiNsGetSecondaryObject (Object);
if (SecondDesc)
@@ -278,9 +308,18 @@
HandlerDesc = Object->Region.Handler;
if (HandlerDesc)
{
- if (HandlerDesc->AddressSpace.Hflags & ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
+ if (HandlerDesc->AddressSpace.HandlerFlags &
+ ACPI_ADDR_HANDLER_DEFAULT_INSTALLED)
{
- ObjPointer = SecondDesc->Extra.RegionContext;
+ /* Deactivate region and free region context */
+
+ if (HandlerDesc->AddressSpace.Setup)
+ {
+ (void) HandlerDesc->AddressSpace.Setup (Object,
+ ACPI_REGION_DEACTIVATE,
+ HandlerDesc->AddressSpace.Context,
+ &SecondDesc->Extra.RegionContext);
+ }
}
AcpiUtRemoveReference (HandlerDesc);
@@ -295,7 +334,8 @@
case ACPI_TYPE_BUFFER_FIELD:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "***** Buffer Field %p\n", Object));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "***** Buffer Field %p\n", Object));
SecondDesc = AcpiNsGetSecondaryObject (Object);
if (SecondDesc)
@@ -314,14 +354,14 @@
if (ObjPointer)
{
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object Subptr %p\n",
- ObjPointer));
- ACPI_MEM_FREE (ObjPointer);
+ ObjPointer));
+ ACPI_FREE (ObjPointer);
}
/* Now the object can be safely deleted */
ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Deleting Object %p [%s]\n",
- Object, AcpiUtGetObjectTypeName (Object)));
+ Object, AcpiUtGetObjectTypeName (Object)));
AcpiUtDeleteObjectDesc (Object);
return_VOID;
@@ -332,7 +372,7 @@
*
* FUNCTION: AcpiUtDeleteInternalObjectList
*
- * PARAMETERS: *ObjList - Pointer to the list to be deleted
+ * PARAMETERS: ObjList - Pointer to the list to be deleted
*
* RETURN: None
*
@@ -348,7 +388,7 @@
ACPI_OPERAND_OBJECT **InternalObj;
- ACPI_FUNCTION_TRACE ("UtDeleteInternalObjectList");
+ ACPI_FUNCTION_TRACE (UtDeleteInternalObjectList);
/* Walk the null-terminated internal list */
@@ -360,7 +400,7 @@
/* Free the combined parameter pointer list and object array */
- ACPI_MEM_FREE (ObjList);
+ ACPI_FREE (ObjList);
return_VOID;
}
@@ -369,7 +409,7 @@
*
* FUNCTION: AcpiUtUpdateRefCount
*
- * PARAMETERS: *Object - Object whose ref count is to be updated
+ * PARAMETERS: Object - Object whose ref count is to be updated
* Action - What to do
*
* RETURN: New ref count
@@ -387,7 +427,7 @@
UINT16 NewCount;
- ACPI_FUNCTION_NAME ("UtUpdateRefCount");
+ ACPI_FUNCTION_NAME (UtUpdateRefCount);
if (!Object)
@@ -399,26 +439,26 @@
NewCount = Count;
/*
- * Perform the reference count action (increment, decrement, or force delete)
+ * Perform the reference count action (increment, decrement, force delete)
*/
switch (Action)
{
-
case REF_INCREMENT:
NewCount++;
Object->Common.ReferenceCount = NewCount;
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Incremented]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, [Incremented]\n",
Object, NewCount));
break;
-
case REF_DECREMENT:
if (Count < 1)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, can't decrement! (Set to 0)\n",
Object, NewCount));
NewCount = 0;
@@ -427,14 +467,15 @@
{
NewCount--;
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, [Decremented]\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, [Decremented]\n",
Object, NewCount));
}
if (ACPI_GET_OBJECT_TYPE (Object) == ACPI_TYPE_METHOD)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Method Obj %p Refs=%X, [Decremented]\n",
- Object, NewCount));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Method Obj %p Refs=%X, [Decremented]\n", Object, NewCount));
}
Object->Common.ReferenceCount = NewCount;
@@ -442,24 +483,21 @@
{
AcpiUtDeleteInternalObj (Object);
}
-
break;
-
case REF_FORCE_DELETE:
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Obj %p Refs=%X, Force delete! (Set to 0)\n",
- Object, Count));
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Obj %p Refs=%X, Force delete! (Set to 0)\n", Object, Count));
NewCount = 0;
Object->Common.ReferenceCount = NewCount;
AcpiUtDeleteInternalObj (Object);
break;
-
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown action (%X)\n", Action));
+ ACPI_ERROR ((AE_INFO, "Unknown action (%X)", Action));
break;
}
@@ -469,13 +507,9 @@
*/
if (Count > ACPI_MAX_REFERENCE_COUNT)
{
-
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN,
- "**** Warning **** Large Reference Count (%X) in object %p\n\n",
- Count, Object));
+ ACPI_WARNING ((AE_INFO,
+ "Large Reference Count (%X) in object %p", Count, Object));
}
-
- return;
}
@@ -483,7 +517,7 @@
*
* FUNCTION: AcpiUtUpdateObjectReference
*
- * PARAMETERS: *Object - Increment ref count for this object
+ * PARAMETERS: Object - Increment ref count for this object
* and all sub-objects
* Action - Either REF_INCREMENT or REF_DECREMENT or
* REF_FORCE_DELETE
@@ -506,37 +540,26 @@
ACPI_OPERAND_OBJECT *Object,
UINT16 Action)
{
- ACPI_STATUS Status;
- UINT32 i;
- ACPI_GENERIC_STATE *StateList = NULL;
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_TRACE_PTR ("UtUpdateObjectReference", Object);
+ ACPI_STATUS Status = AE_OK;
+ ACPI_GENERIC_STATE *StateList = NULL;
+ ACPI_OPERAND_OBJECT *NextObject = NULL;
+ ACPI_GENERIC_STATE *State;
+ ACPI_NATIVE_UINT i;
- /* Ignore a null object ptr */
-
- if (!Object)
- {
- return_ACPI_STATUS (AE_OK);
- }
+ ACPI_FUNCTION_TRACE_PTR (UtUpdateObjectReference, Object);
- /* Make sure that this isn't a namespace handle */
- if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
+ while (Object)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Object %p is NS handle\n", Object));
- return_ACPI_STATUS (AE_OK);
- }
+ /* Make sure that this isn't a namespace handle */
- State = AcpiUtCreateUpdateState (Object, Action);
-
- while (State)
- {
- Object = State->Update.Object;
- Action = State->Update.Value;
- AcpiUtDeleteGenericState (State);
+ if (ACPI_GET_DESCRIPTOR_TYPE (Object) == ACPI_DESC_TYPE_NAMED)
+ {
+ ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS,
+ "Object %p is NS handle\n", Object));
+ return_ACPI_STATUS (AE_OK);
+ }
/*
* All sub-objects must have their reference count incremented also.
@@ -545,17 +568,20 @@
switch (ACPI_GET_OBJECT_TYPE (Object))
{
case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_THERMAL:
- AcpiUtUpdateRefCount (Object->Device.SystemNotify, Action);
- AcpiUtUpdateRefCount (Object->Device.DeviceNotify, Action);
- break;
+ /* Update the notify objects for these types (if present) */
+ AcpiUtUpdateRefCount (Object->CommonNotify.SystemNotify, Action);
+ AcpiUtUpdateRefCount (Object->CommonNotify.DeviceNotify, Action);
+ break;
case ACPI_TYPE_PACKAGE:
-
/*
- * We must update all the sub-objects of the package
- * (Each of whom may have their own sub-objects, etc.
+ * We must update all the sub-objects of the package,
+ * each of whom may have their own sub-objects.
*/
for (i = 0; i < Object->Package.Count; i++)
{
@@ -573,38 +599,19 @@
}
break;
-
case ACPI_TYPE_BUFFER_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->BufferField.BufferObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
+ NextObject = Object->BufferField.BufferObj;
break;
-
case ACPI_TYPE_LOCAL_REGION_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->Field.RegionObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
- break;
-
+ NextObject = Object->Field.RegionObj;
+ break;
case ACPI_TYPE_LOCAL_BANK_FIELD:
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->BankField.BankObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
- {
- goto ErrorExit;
- }
-
+ NextObject = Object->BankField.BankObj;
Status = AcpiUtCreateUpdateStateAndPush (
Object->BankField.RegionObj, Action, &StateList);
if (ACPI_FAILURE (Status))
@@ -613,52 +620,62 @@
}
break;
-
case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ NextObject = Object->IndexField.IndexObj;
Status = AcpiUtCreateUpdateStateAndPush (
- Object->IndexField.IndexObj, Action, &StateList);
+ Object->IndexField.DataObj, Action, &StateList);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
}
+ break;
- Status = AcpiUtCreateUpdateStateAndPush (
- Object->IndexField.DataObj, Action, &StateList);
- if (ACPI_FAILURE (Status))
+ case ACPI_TYPE_LOCAL_REFERENCE:
+ /*
+ * The target of an Index (a package, string, or buffer) must track
+ * changes to the ref count of the index.
+ */
+ if (Object->Reference.Opcode == AML_INDEX_OP)
{
- goto ErrorExit;
+ NextObject = Object->Reference.Object;
}
break;
-
case ACPI_TYPE_REGION:
- case ACPI_TYPE_LOCAL_REFERENCE:
default:
-
- /* No subobjects */
- break;
+ break; /* No subobjects for all other types */
}
/*
- * Now we can update the count in the main object. This can only
+ * Now we can update the count in the main object. This can only
* happen after we update the sub-objects in case this causes the
* main object to be deleted.
*/
AcpiUtUpdateRefCount (Object, Action);
+ Object = NULL;
/* Move on to the next object to be updated */
- State = AcpiUtPopGenericState (&StateList);
+ if (NextObject)
+ {
+ Object = NextObject;
+ NextObject = NULL;
+ }
+ else if (StateList)
+ {
+ State = AcpiUtPopGenericState (&StateList);
+ Object = State->Update.Object;
+ AcpiUtDeleteGenericState (State);
+ }
}
return_ACPI_STATUS (AE_OK);
-
ErrorExit:
- ACPI_REPORT_ERROR (("Could not update object reference count, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not update object reference count"));
return_ACPI_STATUS (Status);
}
@@ -668,8 +685,8 @@
*
* FUNCTION: AcpiUtAddReference
*
- * PARAMETERS: *Object - Object whose reference count is to be
- * incremented
+ * PARAMETERS: Object - Object whose reference count is to be
+ * incremented
*
* RETURN: None
*
@@ -682,7 +699,7 @@
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR ("UtAddReference", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtAddReference, Object);
/* Ensure that we have a valid object */
@@ -698,7 +715,7 @@
/* Increment the reference count */
- (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
+ (void) AcpiUtUpdateObjectReference (Object, REF_INCREMENT);
return_VOID;
}
@@ -707,7 +724,7 @@
*
* FUNCTION: AcpiUtRemoveReference
*
- * PARAMETERS: *Object - Object whose ref count will be decremented
+ * PARAMETERS: Object - Object whose ref count will be decremented
*
* RETURN: None
*
@@ -720,12 +737,12 @@
ACPI_OPERAND_OBJECT *Object)
{
- ACPI_FUNCTION_TRACE_PTR ("UtRemoveReference", Object);
+ ACPI_FUNCTION_TRACE_PTR (UtRemoveReference, Object);
/*
- * Allow a NULL pointer to be passed in, just ignore it. This saves
- * each caller from having to check. Also, ignore NS nodes.
+ * Allow a NULL pointer to be passed in, just ignore it. This saves
+ * each caller from having to check. Also, ignore NS nodes.
*
*/
if (!Object ||
@@ -748,10 +765,10 @@
/*
* Decrement the reference count, and only actually delete the object
- * if the reference count becomes 0. (Must also decrement the ref count
+ * if the reference count becomes 0. (Must also decrement the ref count
* of all subobjects!)
*/
- (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
+ (void) AcpiUtUpdateObjectReference (Object, REF_DECREMENT);
return_VOID;
}
Index: utxface.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utxface.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utxface.c -L sys/contrib/dev/acpica/utxface.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utxface.c
+++ sys/contrib/dev/acpica/utxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utxface - External interfaces for "global" ACPI functions
- * $Revision: 106 $
+ * $Revision: 1.125 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,8 +120,6 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acevents.h>
#include <contrib/dev/acpica/acnamesp.h>
-#include <contrib/dev/acpica/acparser.h>
-#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acdebug.h>
#define _COMPONENT ACPI_UTILITIES
@@ -147,33 +145,32 @@
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInitializeSubsystem");
-
- ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
+ ACPI_FUNCTION_TRACE (AcpiInitializeSubsystem);
- /* Initialize all globals used by the subsystem */
-
- AcpiUtInitGlobals ();
+ AcpiGbl_StartupFlags = ACPI_SUBSYSTEM_INITIALIZE;
+ ACPI_DEBUG_EXEC (AcpiUtInitStackPtrTrace ());
/* Initialize the OS-Dependent layer */
Status = AcpiOsInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("OSD failed to initialize, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During OSL initialization"));
return_ACPI_STATUS (Status);
}
+ /* Initialize all globals used by the subsystem */
+
+ AcpiUtInitGlobals ();
+
/* Create the default mutex objects */
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Global mutex creation failure, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Global Mutex creation"));
return_ACPI_STATUS (Status);
}
@@ -181,23 +178,21 @@
* Initialize the namespace manager and
* the root of the namespace tree
*/
-
Status = AcpiNsRootInitialize ();
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Namespace initialization failure, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During Namespace initialization"));
return_ACPI_STATUS (Status);
}
-
/* If configured, initialize the AML debugger */
ACPI_DEBUGGER_EXEC (Status = AcpiDbInitialize ());
-
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInitializeSubsystem)
+
/*******************************************************************************
*
@@ -219,24 +214,9 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiEnableSubsystem");
+ ACPI_FUNCTION_TRACE (AcpiEnableSubsystem);
- /*
- * We must initialize the hardware before we can enable ACPI.
- * The values from the FADT are validated here.
- */
- if (!(Flags & ACPI_NO_HARDWARE_INIT))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI hardware\n"));
-
- Status = AcpiHwInitialize ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
/* Enable ACPI mode */
if (!(Flags & ACPI_NO_ACPI_ENABLE))
@@ -248,7 +228,7 @@
Status = AcpiEnable ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiEnable failed.\n"));
+ ACPI_WARNING ((AE_INFO, "AcpiEnable failed"));
return_ACPI_STATUS (Status);
}
}
@@ -260,7 +240,8 @@
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing default address space handlers\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[Init] Installing default address space handlers\n"));
Status = AcpiEvInstallRegionHandlers ();
if (ACPI_FAILURE (Status))
@@ -272,13 +253,19 @@
/*
* Initialize ACPI Event handling (Fixed and General Purpose)
*
- * NOTE: We must have the hardware AND events initialized before we can execute
- * ANY control methods SAFELY. Any control method can require ACPI hardware
- * support, so the hardware MUST be initialized before execution!
+ * Note1: We must have the hardware and events initialized before we can
+ * execute any control methods safely. Any control method can require
+ * ACPI hardware support, so the hardware must be fully initialized before
+ * any method execution!
+ *
+ * Note2: Fixed events are initialized and enabled here. GPEs are
+ * initialized, but cannot be enabled until after the hardware is
+ * completely initialized (SCI and GlobalLock activated)
*/
if (!(Flags & ACPI_NO_EVENT_INIT))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI events\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[Init] Initializing ACPI events\n"));
Status = AcpiEvInitializeEvents ();
if (ACPI_FAILURE (Status))
@@ -287,11 +274,14 @@
}
}
- /* Install the SCI handler and Global Lock handler */
-
+ /*
+ * Install the SCI handler and Global Lock handler. This completes the
+ * hardware initialization.
+ */
if (!(Flags & ACPI_NO_HANDLER_INIT))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Installing SCI/GL handlers\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[Init] Installing SCI/GL handlers\n"));
Status = AcpiEvInstallXruptHandlers ();
if (ACPI_FAILURE (Status))
@@ -300,9 +290,32 @@
}
}
+ /*
+ * Complete the GPE initialization for the GPE blocks defined in the FADT
+ * (GPE block 0 and 1).
+ *
+ * Note1: This is where the _PRW methods are executed for the GPEs. These
+ * methods can only be executed after the SCI and Global Lock handlers are
+ * installed and initialized.
+ *
+ * Note2: Currently, there seems to be no need to run the _REG methods
+ * before execution of the _PRW methods and enabling of the GPEs.
+ */
+ if (!(Flags & ACPI_NO_EVENT_INIT))
+ {
+ Status = AcpiEvInstallFadtGpes ();
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEnableSubsystem)
+
+
/*******************************************************************************
*
* FUNCTION: AcpiInitializeObjects
@@ -323,19 +336,20 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiInitializeObjects");
+ ACPI_FUNCTION_TRACE (AcpiInitializeObjects);
/*
* Run all _REG methods
*
- * NOTE: Any objects accessed
- * by the _REG methods will be automatically initialized, even if they
- * contain executable AML (see call to AcpiNsInitializeObjects below).
+ * Note: Any objects accessed by the _REG methods will be automatically
+ * initialized, even if they contain executable AML (see the call to
+ * AcpiNsInitializeObjects below).
*/
if (!(Flags & ACPI_NO_ADDRESS_SPACE_INIT))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Executing _REG OpRegion methods\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[Init] Executing _REG OpRegion methods\n"));
Status = AcpiEvInitializeOpRegions ();
if (ACPI_FAILURE (Status))
@@ -345,13 +359,14 @@
}
/*
- * Initialize the objects that remain uninitialized. This
- * runs the executable AML that may be part of the declaration of these
- * objects: OperationRegions, BufferFields, Buffers, and Packages.
+ * Initialize the objects that remain uninitialized. This runs the
+ * executable AML that may be part of the declaration of these objects:
+ * OperationRegions, BufferFields, Buffers, and Packages.
*/
if (!(Flags & ACPI_NO_OBJECT_INIT))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Completing Initialization of ACPI Objects\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[Init] Completing Initialization of ACPI Objects\n"));
Status = AcpiNsInitializeObjects ();
if (ACPI_FAILURE (Status))
@@ -361,12 +376,13 @@
}
/*
- * Initialize all device objects in the namespace
- * This runs the _STA and _INI methods.
+ * Initialize all device objects in the namespace. This runs the device
+ * _STA and _INI methods.
*/
if (!(Flags & ACPI_NO_DEVICE_INIT))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "[Init] Initializing ACPI Devices\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "[Init] Initializing ACPI Devices\n"));
Status = AcpiNsInitializeDevices ();
if (ACPI_FAILURE (Status))
@@ -386,6 +402,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInitializeObjects)
+
/*******************************************************************************
*
@@ -400,12 +418,13 @@
******************************************************************************/
ACPI_STATUS
-AcpiTerminate (void)
+AcpiTerminate (
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiTerminate");
+ ACPI_FUNCTION_TRACE (AcpiTerminate);
/* Terminate the AML Debugger if present */
@@ -435,8 +454,10 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiTerminate)
-/*****************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiSubsystemStatus
*
@@ -445,14 +466,16 @@
* RETURN: Status of the ACPI subsystem
*
* DESCRIPTION: Other drivers that use the ACPI subsystem should call this
- * before making any other calls, to ensure the subsystem initial-
- * ized successfully.
+ * before making any other calls, to ensure the subsystem
+ * initialized successfully.
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
-AcpiSubsystemStatus (void)
+AcpiSubsystemStatus (
+ void)
{
+
if (AcpiGbl_StartupFlags & ACPI_INITIALIZED_OK)
{
return (AE_OK);
@@ -463,14 +486,15 @@
}
}
+ACPI_EXPORT_SYMBOL (AcpiSubsystemStatus)
-/******************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiGetSystemInfo
*
- * PARAMETERS: OutBuffer - a pointer to a buffer to receive the
- * resources for the device
- * BufferLength - the number of bytes available in the buffer
+ * PARAMETERS: OutBuffer - A buffer to receive the resources for the
+ * device
*
* RETURN: Status - the status of the call
*
@@ -488,11 +512,10 @@
ACPI_BUFFER *OutBuffer)
{
ACPI_SYSTEM_INFO *InfoPtr;
- UINT32 i;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiGetSystemInfo");
+ ACPI_FUNCTION_TRACE (AcpiGetSystemInfo);
/* Parameter validation */
@@ -516,19 +539,15 @@
*/
InfoPtr = (ACPI_SYSTEM_INFO *) OutBuffer->Pointer;
- InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
+ InfoPtr->AcpiCaVersion = ACPI_CA_VERSION;
/* System flags (ACPI capabilities) */
- InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
+ InfoPtr->Flags = ACPI_SYS_MODE_ACPI;
/* Timer resolution - 24 or 32 bits */
- if (!AcpiGbl_FADT)
- {
- InfoPtr->TimerResolution = 0;
- }
- else if (AcpiGbl_FADT->TmrValExt == 0)
+ if (AcpiGbl_FADT.Flags & ACPI_FADT_32BIT_TIMER)
{
InfoPtr->TimerResolution = 24;
}
@@ -539,31 +558,26 @@
/* Clear the reserved fields */
- InfoPtr->Reserved1 = 0;
- InfoPtr->Reserved2 = 0;
+ InfoPtr->Reserved1 = 0;
+ InfoPtr->Reserved2 = 0;
/* Current debug levels */
- InfoPtr->DebugLayer = AcpiDbgLayer;
- InfoPtr->DebugLevel = AcpiDbgLevel;
-
- /* Current status of the ACPI tables, per table type */
-
- InfoPtr->NumTableTypes = NUM_ACPI_TABLE_TYPES;
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
- {
- InfoPtr->TableInfo[i].Count = AcpiGbl_TableLists[i].Count;
- }
+ InfoPtr->DebugLayer = AcpiDbgLayer;
+ InfoPtr->DebugLevel = AcpiDbgLevel;
return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetSystemInfo)
+
/*****************************************************************************
*
* FUNCTION: AcpiInstallInitializationHandler
*
* PARAMETERS: Handler - Callback procedure
+ * Function - Not (currently) used, see below
*
* RETURN: Status
*
@@ -593,6 +607,8 @@
return AE_OK;
}
+ACPI_EXPORT_SYMBOL (AcpiInstallInitializationHandler)
+
/*****************************************************************************
*
@@ -607,15 +623,16 @@
****************************************************************************/
ACPI_STATUS
-AcpiPurgeCachedObjects (void)
+AcpiPurgeCachedObjects (
+ void)
{
- ACPI_FUNCTION_TRACE ("AcpiPurgeCachedObjects");
-
-
- AcpiUtDeleteGenericStateCache ();
- AcpiUtDeleteObjectCache ();
- AcpiDsDeleteWalkStateCache ();
- AcpiPsDeleteParseCache ();
+ ACPI_FUNCTION_TRACE (AcpiPurgeCachedObjects);
+ (void) AcpiOsPurgeCache (AcpiGbl_StateCache);
+ (void) AcpiOsPurgeCache (AcpiGbl_OperandCache);
+ (void) AcpiOsPurgeCache (AcpiGbl_PsNodeCache);
+ (void) AcpiOsPurgeCache (AcpiGbl_PsNodeExtCache);
return_ACPI_STATUS (AE_OK);
}
+
+ACPI_EXPORT_SYMBOL (AcpiPurgeCachedObjects)
Index: dsinit.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dsinit.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dsinit.c -L sys/contrib/dev/acpica/dsinit.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dsinit.c
+++ sys/contrib/dev/acpica/dsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsinit - Object initialization namespace walk
- * $Revision: 10 $
+ * $Revision: 1.28 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,16 +119,26 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsinit")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDsInitOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
* FUNCTION: AcpiDsInitOneObject
*
- * PARAMETERS: ObjHandle - Node
+ * PARAMETERS: ObjHandle - Node for the object
* Level - Current nesting level
* Context - Points to a init info struct
* ReturnValue - Not used
@@ -144,27 +154,27 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsInitOneObject (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
+ ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_OBJECT_TYPE Type;
ACPI_STATUS Status;
- ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
- ACPI_FUNCTION_NAME ("DsInitOneObject");
+ ACPI_FUNCTION_ENTRY ();
/*
- * We are only interested in objects owned by the table that
+ * We are only interested in NS nodes owned by the table that
* was just loaded
*/
- if (((ACPI_NAMESPACE_NODE *) ObjHandle)->OwnerId !=
- Info->TableDesc->TableId)
+ if (Node->OwnerId != Info->OwnerId)
{
return (AE_OK);
}
@@ -182,9 +192,9 @@
Status = AcpiDsInitializeRegion (ObjHandle);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Region %p [%4.4s] - Init failure, %s\n",
- ObjHandle, AcpiUtGetNodeName (ObjHandle),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "During Region initialization %p [%4.4s]",
+ ObjHandle, AcpiUtGetNodeName (ObjHandle)));
}
Info->OpRegionCount++;
@@ -194,47 +204,6 @@
case ACPI_TYPE_METHOD:
Info->MethodCount++;
-
- /* Print a dot for each method unless we are going to print the entire pathname */
-
- if (!(AcpiDbgLevel & ACPI_LV_INIT_NAMES))
- {
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
- }
-
- /*
- * Set the execution data width (32 or 64) based upon the
- * revision number of the parent ACPI table.
- * TBD: This is really for possible future support of integer width
- * on a per-table basis. Currently, we just use a global for the width.
- */
- if (Info->TableDesc->Pointer->Revision == 1)
- {
- ((ACPI_NAMESPACE_NODE *) ObjHandle)->Flags |= ANOBJ_DATA_WIDTH_32;
- }
-
- /*
- * Always parse methods to detect errors, we will delete
- * the parse tree below
- */
- Status = AcpiDsParseMethod (ObjHandle);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Method %p [%4.4s] - parse failure, %s\n",
- ObjHandle, AcpiUtGetNodeName (ObjHandle),
- AcpiFormatException (Status)));
-
- /* This parse failed, but we will continue parsing more methods */
-
- break;
- }
-
- /*
- * Delete the parse tree. We simply re-parse the method
- * for every execution since there isn't much overhead
- */
- AcpiNsDeleteNamespaceSubtree (ObjHandle);
- AcpiNsDeleteNamespaceByOwner (((ACPI_NAMESPACE_NODE *) ObjHandle)->Object->Method.OwningId);
break;
@@ -272,16 +241,24 @@
ACPI_STATUS
AcpiDsInitializeObjects (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *StartNode)
{
ACPI_STATUS Status;
ACPI_INIT_WALK_INFO Info;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OWNER_ID OwnerId;
- ACPI_FUNCTION_TRACE ("DsInitializeObjects");
+ ACPI_FUNCTION_TRACE (DsInitializeObjects);
+ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"**** Starting initialization of namespace objects ****\n"));
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "Parsing all Control Methods:"));
@@ -290,7 +267,8 @@
Info.OpRegionCount = 0;
Info.ObjectCount = 0;
Info.DeviceCount = 0;
- Info.TableDesc = TableDesc;
+ Info.TableIndex = TableIndex;
+ Info.OwnerId = OwnerId;
/* Walk entire namespace from the supplied root */
@@ -298,13 +276,18 @@
AcpiDsInitOneObject, &Info, NULL);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
+ }
+
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
"\nTable [%4.4s](id %4.4X) - %hd Objects with %hd Devices %hd Methods %hd Regions\n",
- TableDesc->Pointer->Signature, TableDesc->TableId, Info.ObjectCount,
+ Table->Signature, OwnerId, Info.ObjectCount,
Info.DeviceCount, Info.MethodCount, Info.OpRegionCount));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
Index: nsobject.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsobject.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsobject.c -L sys/contrib/dev/acpica/nsobject.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsobject.c
+++ sys/contrib/dev/acpica/nsobject.c
@@ -2,7 +2,7 @@
*
* Module Name: nsobject - Utilities for objects attached to namespace
* table entries
- * $Revision: 90 $
+ * $Revision: 1.98 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -135,6 +135,8 @@
* Type - Type of object, or ACPI_TYPE_ANY if not
* known
*
+ * RETURN: Status
+ *
* DESCRIPTION: Record the given object as the value associated with the
* name whose ACPI_HANDLE is passed. If Object is NULL
* and Type is ACPI_TYPE_ANY, set the name as having no value.
@@ -156,7 +158,7 @@
ACPI_OBJECT_TYPE ObjectType = ACPI_TYPE_ANY;
- ACPI_FUNCTION_TRACE ("NsAttachObject");
+ ACPI_FUNCTION_TRACE (NsAttachObject);
/*
@@ -166,7 +168,7 @@
{
/* Invalid handle */
- ACPI_REPORT_ERROR (("NsAttachObject: Null NamedObj handle\n"));
+ ACPI_ERROR ((AE_INFO, "Null NamedObj handle"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -174,7 +176,8 @@
{
/* Null object */
- ACPI_REPORT_ERROR (("NsAttachObject: Null object, but type not ACPI_TYPE_ANY\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Null object, but type not ACPI_TYPE_ANY"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -182,8 +185,8 @@
{
/* Not a name handle */
- ACPI_REPORT_ERROR (("NsAttachObject: Invalid handle %p [%s]\n",
- Node, AcpiUtGetDescriptorName (Node)));
+ ACPI_ERROR ((AE_INFO, "Invalid handle %p [%s]",
+ Node, AcpiUtGetDescriptorName (Node)));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -191,7 +194,8 @@
if (Node->Object == Object)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj %p already installed in NameObj %p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Obj %p already installed in NameObj %p\n",
Object, Node));
return_ACPI_STATUS (AE_OK);
@@ -277,7 +281,7 @@
*
* FUNCTION: AcpiNsDetachObject
*
- * PARAMETERS: Node - An node whose object will be detached
+ * PARAMETERS: Node - A Namespace node whose object will be detached
*
* RETURN: None.
*
@@ -294,7 +298,7 @@
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("NsDetachObject");
+ ACPI_FUNCTION_TRACE (NsDetachObject);
ObjDesc = Node->Object;
@@ -336,7 +340,7 @@
*
* FUNCTION: AcpiNsGetAttachedObject
*
- * PARAMETERS: Node - Parent Node to be examined
+ * PARAMETERS: Node - Namespace node
*
* RETURN: Current value of the object field from the Node whose
* handle is passed
@@ -349,12 +353,12 @@
AcpiNsGetAttachedObject (
ACPI_NAMESPACE_NODE *Node)
{
- ACPI_FUNCTION_TRACE_PTR ("NsGetAttachedObject", Node);
+ ACPI_FUNCTION_TRACE_PTR (NsGetAttachedObject, Node);
if (!Node)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Null Node ptr\n"));
+ ACPI_WARNING ((AE_INFO, "Null Node ptr"));
return_PTR (NULL);
}
@@ -374,7 +378,7 @@
*
* FUNCTION: AcpiNsGetSecondaryObject
*
- * PARAMETERS: Node - Parent Node to be examined
+ * PARAMETERS: Node - Namespace node
*
* RETURN: Current value of the object field from the Node whose
* handle is passed.
@@ -387,7 +391,7 @@
AcpiNsGetSecondaryObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
- ACPI_FUNCTION_TRACE_PTR ("NsGetSecondaryObject", ObjDesc);
+ ACPI_FUNCTION_TRACE_PTR (NsGetSecondaryObject, ObjDesc);
if ((!ObjDesc) ||
Index: aclocal.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/aclocal.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/aclocal.h -L sys/contrib/dev/acpica/aclocal.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/aclocal.h
+++ sys/contrib/dev/acpica/aclocal.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: aclocal.h - Internal data types used across the ACPI subsystem
- * $Revision: 202 $
+ * $Revision: 1.247 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,18 +117,27 @@
#ifndef __ACLOCAL_H__
#define __ACLOCAL_H__
+/* acpisrc:StructDefs -- for acpisrc conversion */
#define ACPI_WAIT_FOREVER 0xFFFF /* UINT16, as per ACPI spec */
+#define ACPI_DO_NOT_WAIT 0
+#define ACPI_SERIALIZED 0xFF
-typedef void * ACPI_MUTEX;
typedef UINT32 ACPI_MUTEX_HANDLE;
-
+#define ACPI_GLOBAL_LOCK (ACPI_SEMAPHORE) (-1)
/* Total number of aml opcodes defined */
#define AML_NUM_OPCODES 0x7F
+/* Forward declarations */
+
+struct acpi_walk_state;
+struct acpi_obj_mutex;
+union acpi_parse_object;
+
+
/*****************************************************************************
*
* Mutex typedefs and structs
@@ -140,70 +149,75 @@
* Predefined handles for the mutex objects used within the subsystem
* All mutex objects are automatically created by AcpiUtMutexInitialize.
*
- * The acquire/release ordering protocol is implied via this list. Mutexes
+ * The acquire/release ordering protocol is implied via this list. Mutexes
* with a lower value must be acquired before mutexes with a higher value.
*
- * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames table also!
+ * NOTE: any changes here must be reflected in the AcpiGbl_MutexNames
+ * table below also!
*/
+#define ACPI_MTX_INTERPRETER 0 /* AML Interpreter, main lock */
+#define ACPI_MTX_NAMESPACE 1 /* ACPI Namespace */
+#define ACPI_MTX_TABLES 2 /* Data for ACPI tables */
+#define ACPI_MTX_EVENTS 3 /* Data for ACPI events */
+#define ACPI_MTX_CACHES 4 /* Internal caches, general purposes */
+#define ACPI_MTX_MEMORY 5 /* Debug memory tracking lists */
+#define ACPI_MTX_DEBUG_CMD_COMPLETE 6 /* AML debugger */
+#define ACPI_MTX_DEBUG_CMD_READY 7 /* AML debugger */
-#define ACPI_MTX_EXECUTE 0
-#define ACPI_MTX_INTERPRETER 1
-#define ACPI_MTX_PARSER 2
-#define ACPI_MTX_DISPATCHER 3
-#define ACPI_MTX_TABLES 4
-#define ACPI_MTX_OP_REGIONS 5
-#define ACPI_MTX_NAMESPACE 6
-#define ACPI_MTX_EVENTS 7
-#define ACPI_MTX_HARDWARE 8
-#define ACPI_MTX_CACHES 9
-#define ACPI_MTX_MEMORY 10
-#define ACPI_MTX_DEBUG_CMD_COMPLETE 11
-#define ACPI_MTX_DEBUG_CMD_READY 12
-
-#define MAX_MUTEX 12
-#define NUM_MUTEX MAX_MUTEX+1
-
+#define ACPI_MAX_MUTEX 7
+#define ACPI_NUM_MUTEX ACPI_MAX_MUTEX+1
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
#ifdef DEFINE_ACPI_GLOBALS
-/* Names for the mutexes used in the subsystem */
+/* Debug names for the mutexes above */
-static char *AcpiGbl_MutexNames[] =
+static char *AcpiGbl_MutexNames[ACPI_NUM_MUTEX] =
{
- "ACPI_MTX_Execute",
"ACPI_MTX_Interpreter",
- "ACPI_MTX_Parser",
- "ACPI_MTX_Dispatcher",
"ACPI_MTX_Tables",
- "ACPI_MTX_OpRegions",
"ACPI_MTX_Namespace",
"ACPI_MTX_Events",
- "ACPI_MTX_Hardware",
"ACPI_MTX_Caches",
"ACPI_MTX_Memory",
- "ACPI_MTX_DebugCmdComplete",
- "ACPI_MTX_DebugCmdReady",
+ "ACPI_MTX_CommandComplete",
+ "ACPI_MTX_CommandReady"
};
#endif
#endif
+/*
+ * Predefined handles for spinlocks used within the subsystem.
+ * These spinlocks are created by AcpiUtMutexInitialize
+ */
+#define ACPI_LOCK_GPES 0
+#define ACPI_LOCK_HARDWARE 1
+
+#define ACPI_MAX_LOCK 1
+#define ACPI_NUM_LOCK ACPI_MAX_LOCK+1
+
+
+/* Owner IDs are used to track namespace nodes for selective deletion */
+
+typedef UINT8 ACPI_OWNER_ID;
+#define ACPI_OWNER_ID_MAX 0xFF
+
+/* This Thread ID means that the mutex is not in use (unlocked) */
+
+#define ACPI_MUTEX_NOT_ACQUIRED (UINT32) -1
+
/* Table for the global mutexes */
typedef struct acpi_mutex_info
{
- ACPI_MUTEX Mutex;
- UINT32 UseCount;
- UINT32 OwnerId;
+ ACPI_MUTEX Mutex;
+ UINT32 UseCount;
+ ACPI_THREAD_ID ThreadId;
} ACPI_MUTEX_INFO;
-/* This owner ID means that the mutex is not in use (unlocked) */
-
-#define ACPI_MUTEX_NOT_ACQUIRED (UINT32) (-1)
-
/* Lock flag parameter for various interfaces */
@@ -211,13 +225,6 @@
#define ACPI_MTX_LOCK 1
-typedef UINT16 ACPI_OWNER_ID;
-#define ACPI_OWNER_TYPE_TABLE 0x0
-#define ACPI_OWNER_TYPE_METHOD 0x1
-#define ACPI_FIRST_METHOD_ID 0x0001
-#define ACPI_FIRST_TABLE_ID 0xF000
-
-
/* Field access granularities */
#define ACPI_FIELD_BYTE_GRANULARITY 1
@@ -225,108 +232,140 @@
#define ACPI_FIELD_DWORD_GRANULARITY 4
#define ACPI_FIELD_QWORD_GRANULARITY 8
+
+#define ACPI_ENTRY_NOT_FOUND NULL
+
+
/*****************************************************************************
*
* Namespace typedefs and structs
*
****************************************************************************/
-
/* Operational modes of the AML interpreter/scanner */
typedef enum
{
- ACPI_IMODE_LOAD_PASS1 = 0x01,
- ACPI_IMODE_LOAD_PASS2 = 0x02,
- ACPI_IMODE_EXECUTE = 0x0E
+ ACPI_IMODE_LOAD_PASS1 = 0x01,
+ ACPI_IMODE_LOAD_PASS2 = 0x02,
+ ACPI_IMODE_EXECUTE = 0x03
} ACPI_INTERPRETER_MODE;
-
-/*
- * The Node describes a named object that appears in the AML
- * An AcpiNode is used to store Nodes.
- *
- * DataType is used to differentiate between internal descriptors, and MUST
- * be the first byte in this structure.
- */
-
typedef union acpi_name_union
{
- UINT32 Integer;
- char Ascii[4];
+ UINT32 Integer;
+ char Ascii[4];
} ACPI_NAME_UNION;
+
+/*
+ * The Namespace Node describes a named object that appears in the AML.
+ * DescriptorType is used to differentiate between internal descriptors.
+ *
+ * The node is optimized for both 32-bit and 64-bit platforms:
+ * 20 bytes for the 32-bit case, 32 bytes for the 64-bit case.
+ *
+ * Note: The DescriptorType and Type fields must appear in the identical
+ * position in both the ACPI_NAMESPACE_NODE and ACPI_OPERAND_OBJECT
+ * structures.
+ */
typedef struct acpi_namespace_node
{
- UINT8 Descriptor; /* Used to differentiate object descriptor types */
- UINT8 Type; /* Type associated with this name */
- UINT16 OwnerId;
- ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
- union acpi_operand_object *Object; /* Pointer to attached ACPI object (optional) */
- struct acpi_namespace_node *Child; /* First child */
- struct acpi_namespace_node *Peer; /* Next peer*/
- UINT16 ReferenceCount; /* Current count of references and children */
- UINT8 Flags;
+ union acpi_operand_object *Object; /* Interpreter object */
+ UINT8 DescriptorType; /* Differentiate object descriptor types */
+ UINT8 Type; /* ACPI Type associated with this name */
+ UINT8 Flags; /* Miscellaneous flags */
+ ACPI_OWNER_ID OwnerId; /* Node creator */
+ ACPI_NAME_UNION Name; /* ACPI Name, always 4 chars per ACPI spec */
+ struct acpi_namespace_node *Child; /* First child */
+ struct acpi_namespace_node *Peer; /* Peer. Parent if ANOBJ_END_OF_PEER_LIST set */
+
+ /*
+ * The following fields are used by the ASL compiler and disassembler only
+ */
+#ifdef ACPI_LARGE_NAMESPACE_NODE
+ union acpi_parse_object *Op;
+ UINT32 Value;
+ UINT32 Length;
+#endif
} ACPI_NAMESPACE_NODE;
-#define ACPI_ENTRY_NOT_FOUND NULL
-
+/* Namespace Node flags */
-/* Node flags */
-
-#define ANOBJ_RESERVED 0x01
-#define ANOBJ_END_OF_PEER_LIST 0x02
-#define ANOBJ_DATA_WIDTH_32 0x04 /* Parent table is 64-bits */
-#define ANOBJ_METHOD_ARG 0x08
-#define ANOBJ_METHOD_LOCAL 0x10
-#define ANOBJ_METHOD_NO_RETVAL 0x20
-#define ANOBJ_METHOD_SOME_NO_RETVAL 0x40
-#define ANOBJ_IS_BIT_OFFSET 0x80
+#define ANOBJ_END_OF_PEER_LIST 0x01 /* End-of-list, Peer field points to parent */
+#define ANOBJ_TEMPORARY 0x02 /* Node is create by a method and is temporary */
+#define ANOBJ_METHOD_ARG 0x04 /* Node is a method argument */
+#define ANOBJ_METHOD_LOCAL 0x08 /* Node is a method local */
+#define ANOBJ_SUBTREE_HAS_INI 0x10 /* Used to optimize device initialization */
+
+#define ANOBJ_IS_EXTERNAL 0x08 /* iASL only: This object created via External() */
+#define ANOBJ_METHOD_NO_RETVAL 0x10 /* iASL only: Method has no return value */
+#define ANOBJ_METHOD_SOME_NO_RETVAL 0x20 /* iASL only: Method has at least one return value */
+#define ANOBJ_IS_BIT_OFFSET 0x40 /* iASL only: Reference is a bit offset */
+#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
/*
* ACPI Table Descriptor. One per ACPI table
*/
typedef struct acpi_table_desc
{
- struct acpi_table_desc *Prev;
- struct acpi_table_desc *Next;
- struct acpi_table_desc *InstalledDesc;
- ACPI_TABLE_HEADER *Pointer;
- UINT8 *AmlStart;
- UINT64 PhysicalAddress;
- UINT32 AmlLength;
- ACPI_SIZE Length;
- ACPI_OWNER_ID TableId;
- UINT8 Type;
- UINT8 Allocation;
- BOOLEAN LoadedIntoNamespace;
+ ACPI_PHYSICAL_ADDRESS Address;
+ ACPI_TABLE_HEADER *Pointer;
+ UINT32 Length; /* Length fixed at 32 bits */
+ ACPI_NAME_UNION Signature;
+ ACPI_OWNER_ID OwnerId;
+ UINT8 Flags;
} ACPI_TABLE_DESC;
-typedef struct acpi_table_list
+/* Flags for above */
+
+#define ACPI_TABLE_ORIGIN_UNKNOWN (0)
+#define ACPI_TABLE_ORIGIN_MAPPED (1)
+#define ACPI_TABLE_ORIGIN_ALLOCATED (2)
+#define ACPI_TABLE_ORIGIN_MASK (3)
+#define ACPI_TABLE_IS_LOADED (4)
+
+/* One internal RSDT for table management */
+
+typedef struct acpi_internal_rsdt
{
- struct acpi_table_desc *Next;
- UINT32 Count;
+ ACPI_TABLE_DESC *Tables;
+ UINT32 Count;
+ UINT32 Size;
+ UINT8 Flags;
+
+} ACPI_INTERNAL_RSDT;
+
+/* Flags for above */
+
+#define ACPI_ROOT_ORIGIN_UNKNOWN (0) /* ~ORIGIN_ALLOCATED */
+#define ACPI_ROOT_ORIGIN_ALLOCATED (1)
+#define ACPI_ROOT_ALLOW_RESIZE (2)
+
-} ACPI_TABLE_LIST;
+/* Predefined (fixed) table indexes */
+
+#define ACPI_TABLE_INDEX_DSDT (0)
+#define ACPI_TABLE_INDEX_FACS (1)
typedef struct acpi_find_context
{
- char *SearchFor;
- ACPI_HANDLE *List;
- UINT32 *Count;
+ char *SearchFor;
+ ACPI_HANDLE *List;
+ UINT32 *Count;
} ACPI_FIND_CONTEXT;
typedef struct acpi_ns_search_data
{
- ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *Node;
} ACPI_NS_SEARCH_DATA;
@@ -336,30 +375,30 @@
*/
typedef struct acpi_predefined_names
{
- char *Name;
- UINT8 Type;
- char *Val;
+ char *Name;
+ UINT8 Type;
+ char *Val;
} ACPI_PREDEFINED_NAMES;
/* Object types used during package copies */
-
#define ACPI_COPY_TYPE_SIMPLE 0
#define ACPI_COPY_TYPE_PACKAGE 1
+
/* Info structure used to convert external<->internal namestrings */
typedef struct acpi_namestring_info
{
- char *ExternalName;
- char *NextExternalChar;
- char *InternalName;
- UINT32 Length;
- UINT32 NumSegments;
- UINT32 NumCarats;
- BOOLEAN FullyQualified;
+ char *ExternalName;
+ char *NextExternalChar;
+ char *InternalName;
+ UINT32 Length;
+ UINT32 NumSegments;
+ UINT32 NumCarats;
+ BOOLEAN FullyQualified;
} ACPI_NAMESTRING_INFO;
@@ -368,20 +407,57 @@
typedef struct acpi_create_field_info
{
- ACPI_NAMESPACE_NODE *RegionNode;
- ACPI_NAMESPACE_NODE *FieldNode;
- ACPI_NAMESPACE_NODE *RegisterNode;
- ACPI_NAMESPACE_NODE *DataRegisterNode;
- UINT32 BankValue;
- UINT32 FieldBitPosition;
- UINT32 FieldBitLength;
- UINT8 FieldFlags;
- UINT8 Attribute;
- UINT8 FieldType;
+ ACPI_NAMESPACE_NODE *RegionNode;
+ ACPI_NAMESPACE_NODE *FieldNode;
+ ACPI_NAMESPACE_NODE *RegisterNode;
+ ACPI_NAMESPACE_NODE *DataRegisterNode;
+ UINT32 BankValue;
+ UINT32 FieldBitPosition;
+ UINT32 FieldBitLength;
+ UINT8 FieldFlags;
+ UINT8 Attribute;
+ UINT8 FieldType;
} ACPI_CREATE_FIELD_INFO;
+typedef
+ACPI_STATUS (*ACPI_INTERNAL_METHOD) (
+ struct acpi_walk_state *WalkState);
+
+
+/*
+ * Bitmapped ACPI types. Used internally only
+ */
+#define ACPI_BTYPE_ANY 0x00000000
+#define ACPI_BTYPE_INTEGER 0x00000001
+#define ACPI_BTYPE_STRING 0x00000002
+#define ACPI_BTYPE_BUFFER 0x00000004
+#define ACPI_BTYPE_PACKAGE 0x00000008
+#define ACPI_BTYPE_FIELD_UNIT 0x00000010
+#define ACPI_BTYPE_DEVICE 0x00000020
+#define ACPI_BTYPE_EVENT 0x00000040
+#define ACPI_BTYPE_METHOD 0x00000080
+#define ACPI_BTYPE_MUTEX 0x00000100
+#define ACPI_BTYPE_REGION 0x00000200
+#define ACPI_BTYPE_POWER 0x00000400
+#define ACPI_BTYPE_PROCESSOR 0x00000800
+#define ACPI_BTYPE_THERMAL 0x00001000
+#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
+#define ACPI_BTYPE_DDB_HANDLE 0x00004000
+#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
+#define ACPI_BTYPE_REFERENCE 0x00010000
+#define ACPI_BTYPE_RESOURCE 0x00020000
+
+#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
+
+#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
+#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
+#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
+#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
+#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
+
+
/*****************************************************************************
*
* Event typedefs and structs
@@ -414,7 +490,7 @@
union acpi_gpe_dispatch_info Dispatch; /* Either Method or Handler */
struct acpi_gpe_register_info *RegisterInfo; /* Backpointer to register info */
UINT8 Flags; /* Misc info about this GPE */
- UINT8 RegisterBit; /* This GPE bit within the register */
+ UINT8 GpeNumber; /* This GPE */
} ACPI_GPE_EVENT_INFO;
@@ -455,7 +531,7 @@
struct acpi_gpe_xrupt_info *Previous;
struct acpi_gpe_xrupt_info *Next;
ACPI_GPE_BLOCK_INFO *GpeBlockListHead; /* List of GPE blocks for this xrupt */
- UINT32 InterruptLevel; /* System interrupt level */
+ UINT32 InterruptNumber; /* System interrupt number */
} ACPI_GPE_XRUPT_INFO;
@@ -469,25 +545,25 @@
typedef ACPI_STATUS (*ACPI_GPE_CALLBACK) (
- ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
- ACPI_GPE_BLOCK_INFO *GpeBlock);
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
/* Information about each particular fixed event */
typedef struct acpi_fixed_event_handler
{
- ACPI_EVENT_HANDLER Handler; /* Address of handler. */
- void *Context; /* Context to be passed to handler */
+ ACPI_EVENT_HANDLER Handler; /* Address of handler. */
+ void *Context; /* Context to be passed to handler */
} ACPI_FIXED_EVENT_HANDLER;
typedef struct acpi_fixed_event_info
{
- UINT8 StatusRegisterId;
- UINT8 EnableRegisterId;
- UINT16 StatusBitMask;
- UINT16 EnableBitMask;
+ UINT8 StatusRegisterId;
+ UINT8 EnableRegisterId;
+ UINT16 StatusBitMask;
+ UINT16 EnableBitMask;
} ACPI_FIXED_EVENT_INFO;
@@ -495,9 +571,9 @@
typedef struct acpi_field_info
{
- UINT8 SkipField;
- UINT8 FieldFlag;
- UINT32 PkgLength;
+ UINT8 SkipField;
+ UINT8 FieldFlag;
+ UINT32 PkgLength;
} ACPI_FIELD_INFO;
@@ -508,7 +584,6 @@
*
****************************************************************************/
-
#define ACPI_CONTROL_NORMAL 0xC0
#define ACPI_CONTROL_CONDITIONAL_EXECUTING 0xC1
#define ACPI_CONTROL_PREDICATE_EXECUTING 0xC2
@@ -516,19 +591,14 @@
#define ACPI_CONTROL_PREDICATE_TRUE 0xC4
-/* Forward declarations */
-struct acpi_walk_state;
-struct acpi_obj_mutex;
-union acpi_parse_object;
-
+#define ACPI_STATE_COMMON \
+ void *Next; \
+ UINT8 DescriptorType; /* To differentiate various internal objs */\
+ UINT8 Flags; \
+ UINT16 Value; \
+ UINT16 State;
-#define ACPI_STATE_COMMON /* Two 32-bit fields and a pointer */\
- UINT8 DataType; /* To differentiate various internal objs */\
- UINT8 Flags; \
- UINT16 Value; \
- UINT16 State; \
- UINT16 Reserved; \
- void *Next; \
+ /* There are 2 bytes available here until the next natural alignment boundary */
typedef struct acpi_common_state
{
@@ -542,7 +612,7 @@
typedef struct acpi_update_state
{
ACPI_STATE_COMMON
- union acpi_operand_object *Object;
+ union acpi_operand_object *Object;
} ACPI_UPDATE_STATE;
@@ -553,12 +623,12 @@
typedef struct acpi_pkg_state
{
ACPI_STATE_COMMON
- union acpi_operand_object *SourceObject;
- union acpi_operand_object *DestObject;
- struct acpi_walk_state *WalkState;
- void *ThisTargetObj;
- UINT32 NumPackages;
- UINT16 Index;
+ UINT16 Index;
+ union acpi_operand_object *SourceObject;
+ union acpi_operand_object *DestObject;
+ struct acpi_walk_state *WalkState;
+ void *ThisTargetObj;
+ UINT32 NumPackages;
} ACPI_PKG_STATE;
@@ -570,10 +640,10 @@
typedef struct acpi_control_state
{
ACPI_STATE_COMMON
- union acpi_parse_object *PredicateOp;
- UINT8 *AmlPredicateStart; /* Start of if/while predicate */
- UINT8 *PackageEnd; /* End of if/while block */
- UINT16 Opcode;
+ UINT16 Opcode;
+ union acpi_parse_object *PredicateOp;
+ UINT8 *AmlPredicateStart; /* Start of if/while predicate */
+ UINT8 *PackageEnd; /* End of if/while block */
} ACPI_CONTROL_STATE;
@@ -584,7 +654,7 @@
typedef struct acpi_scope_state
{
ACPI_STATE_COMMON
- ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *Node;
} ACPI_SCOPE_STATE;
@@ -592,11 +662,11 @@
typedef struct acpi_pscope_state
{
ACPI_STATE_COMMON
- union acpi_parse_object *Op; /* Current op being parsed */
- UINT8 *ArgEnd; /* Current argument end */
- UINT8 *PkgEnd; /* Current package end */
- UINT32 ArgList; /* Next argument to parse */
- UINT32 ArgCount; /* Number of fixed arguments */
+ UINT32 ArgCount; /* Number of fixed arguments */
+ union acpi_parse_object *Op; /* Current op being parsed */
+ UINT8 *ArgEnd; /* Current argument end */
+ UINT8 *PkgEnd; /* Current package end */
+ UINT32 ArgList; /* Next argument to parse */
} ACPI_PSCOPE_STATE;
@@ -608,10 +678,10 @@
typedef struct acpi_thread_state
{
ACPI_STATE_COMMON
- struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
- union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
- UINT32 ThreadId; /* Running thread ID */
- UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
+ UINT8 CurrentSyncLevel; /* Mutex Sync (nested acquire) level */
+ struct acpi_walk_state *WalkStateList; /* Head of list of WalkStates for this thread */
+ union acpi_operand_object *AcquiredMutexList; /* List of all currently acquired mutexes */
+ ACPI_THREAD_ID ThreadId; /* Running thread ID */
} ACPI_THREAD_STATE;
@@ -623,21 +693,19 @@
typedef struct acpi_result_values
{
ACPI_STATE_COMMON
- union acpi_operand_object *ObjDesc [ACPI_OBJ_NUM_OPERANDS];
- UINT8 NumResults;
- UINT8 LastInsert;
+ union acpi_operand_object *ObjDesc [ACPI_RESULTS_FRAME_OBJ_NUM];
} ACPI_RESULT_VALUES;
typedef
ACPI_STATUS (*ACPI_PARSE_DOWNWARDS) (
- struct acpi_walk_state *WalkState,
- union acpi_parse_object **OutOp);
+ struct acpi_walk_state *WalkState,
+ union acpi_parse_object **OutOp);
typedef
ACPI_STATUS (*ACPI_PARSE_UPWARDS) (
- struct acpi_walk_state *WalkState);
+ struct acpi_walk_state *WalkState);
/*
@@ -647,8 +715,8 @@
typedef struct acpi_notify_info
{
ACPI_STATE_COMMON
- ACPI_NAMESPACE_NODE *Node;
- union acpi_operand_object *HandlerObj;
+ ACPI_NAMESPACE_NODE *Node;
+ union acpi_operand_object *HandlerObj;
} ACPI_NOTIFY_INFO;
@@ -657,15 +725,15 @@
typedef union acpi_generic_state
{
- ACPI_COMMON_STATE Common;
- ACPI_CONTROL_STATE Control;
- ACPI_UPDATE_STATE Update;
- ACPI_SCOPE_STATE Scope;
- ACPI_PSCOPE_STATE ParseScope;
- ACPI_PKG_STATE Pkg;
- ACPI_THREAD_STATE Thread;
- ACPI_RESULT_VALUES Results;
- ACPI_NOTIFY_INFO Notify;
+ ACPI_COMMON_STATE Common;
+ ACPI_CONTROL_STATE Control;
+ ACPI_UPDATE_STATE Update;
+ ACPI_SCOPE_STATE Scope;
+ ACPI_PSCOPE_STATE ParseScope;
+ ACPI_PKG_STATE Pkg;
+ ACPI_THREAD_STATE Thread;
+ ACPI_RESULT_VALUES Results;
+ ACPI_NOTIFY_INFO Notify;
} ACPI_GENERIC_STATE;
@@ -678,7 +746,7 @@
typedef
ACPI_STATUS (*ACPI_EXECUTE_OP) (
- struct acpi_walk_state *WalkState);
+ struct acpi_walk_state *WalkState);
/*****************************************************************************
@@ -693,56 +761,57 @@
typedef struct acpi_opcode_info
{
#if defined(ACPI_DISASSEMBLER) || defined(ACPI_DEBUG_OUTPUT)
- char *Name; /* Opcode name (disassembler/debug only) */
+ char *Name; /* Opcode name (disassembler/debug only) */
#endif
- UINT32 ParseArgs; /* Grammar/Parse time arguments */
- UINT32 RuntimeArgs; /* Interpret time arguments */
- UINT32 Flags; /* Misc flags */
- UINT8 ObjectType; /* Corresponding internal object type */
- UINT8 Class; /* Opcode class */
- UINT8 Type; /* Opcode type */
+ UINT32 ParseArgs; /* Grammar/Parse time arguments */
+ UINT32 RuntimeArgs; /* Interpret time arguments */
+ UINT16 Flags; /* Misc flags */
+ UINT8 ObjectType; /* Corresponding internal object type */
+ UINT8 Class; /* Opcode class */
+ UINT8 Type; /* Opcode type */
} ACPI_OPCODE_INFO;
-
typedef union acpi_parse_value
{
- ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
- UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
- UINT32 Size; /* bytelist or field size */
- char *String; /* NULL terminated string */
- UINT8 *Buffer; /* buffer or string */
- char *Name; /* NULL terminated string */
- union acpi_parse_object *Arg; /* arguments and contained ops */
+ ACPI_INTEGER Integer; /* Integer constant (Up to 64 bits) */
+ UINT64_STRUCT Integer64; /* Structure overlay for 2 32-bit Dwords */
+ UINT32 Size; /* bytelist or field size */
+ char *String; /* NULL terminated string */
+ UINT8 *Buffer; /* buffer or string */
+ char *Name; /* NULL terminated string */
+ union acpi_parse_object *Arg; /* arguments and contained ops */
} ACPI_PARSE_VALUE;
-
#define ACPI_PARSE_COMMON \
- UINT8 DataType; /* To differentiate various internal objs */\
- UINT8 Flags; /* Type of Op */\
- UINT16 AmlOpcode; /* AML opcode */\
- UINT32 AmlOffset; /* Offset of declaration in AML */\
- union acpi_parse_object *Parent; /* Parent op */\
- union acpi_parse_object *Next; /* Next op */\
+ union acpi_parse_object *Parent; /* Parent op */\
+ UINT8 DescriptorType; /* To differentiate various internal objs */\
+ UINT8 Flags; /* Type of Op */\
+ UINT16 AmlOpcode; /* AML opcode */\
+ UINT32 AmlOffset; /* Offset of declaration in AML */\
+ union acpi_parse_object *Next; /* Next op */\
+ ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
+ ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
+ UINT8 ArgListLength; /* Number of elements in the arg list */\
ACPI_DISASM_ONLY_MEMBERS (\
- UINT8 DisasmFlags; /* Used during AML disassembly */\
- UINT8 DisasmOpcode; /* Subtype used for disassembly */\
- char AmlOpName[16]) /* Op name (debug only) */\
- /* NON-DEBUG members below: */\
- ACPI_NAMESPACE_NODE *Node; /* For use by interpreter */\
- ACPI_PARSE_VALUE Value; /* Value or args associated with the opcode */\
-
-
-#define ACPI_DASM_BUFFER 0x00
-#define ACPI_DASM_RESOURCE 0x01
-#define ACPI_DASM_STRING 0x02
-#define ACPI_DASM_UNICODE 0x03
-#define ACPI_DASM_EISAID 0x04
-#define ACPI_DASM_MATCHOP 0x05
+ UINT8 DisasmFlags; /* Used during AML disassembly */\
+ UINT8 DisasmOpcode; /* Subtype used for disassembly */\
+ char AmlOpName[16]) /* Op name (debug only) */
+
+
+#define ACPI_DASM_BUFFER 0x00
+#define ACPI_DASM_RESOURCE 0x01
+#define ACPI_DASM_STRING 0x02
+#define ACPI_DASM_UNICODE 0x03
+#define ACPI_DASM_EISAID 0x04
+#define ACPI_DASM_MATCHOP 0x05
+#define ACPI_DASM_LNOT_PREFIX 0x06
+#define ACPI_DASM_LNOT_SUFFIX 0x07
+#define ACPI_DASM_IGNORE 0x08
/*
- * generic operation (for example: If, While, Store)
+ * Generic operation (for example: If, While, Store)
*/
typedef struct acpi_parse_obj_common
{
@@ -757,52 +826,53 @@
typedef struct acpi_parse_obj_named
{
ACPI_PARSE_COMMON
- UINT8 *Path;
- UINT8 *Data; /* AML body or bytelist data */
- UINT32 Length; /* AML length */
- UINT32 Name; /* 4-byte name or zero if no name */
+ UINT8 *Path;
+ UINT8 *Data; /* AML body or bytelist data */
+ UINT32 Length; /* AML length */
+ UINT32 Name; /* 4-byte name or zero if no name */
} ACPI_PARSE_OBJ_NAMED;
-/* The parse node is the fundamental element of the parse tree */
+/* This version is used by the iASL compiler only */
+
+#define ACPI_MAX_PARSEOP_NAME 20
typedef struct acpi_parse_obj_asl
{
ACPI_PARSE_COMMON
- union acpi_parse_object *Child;
- union acpi_parse_object *ParentMethod;
- char *Filename;
- char *ExternalName;
- char *Namepath;
- char NameSeg[4];
- UINT32 ExtraValue;
- UINT32 Column;
- UINT32 LineNumber;
- UINT32 LogicalLineNumber;
- UINT32 LogicalByteOffset;
- UINT32 EndLine;
- UINT32 EndLogicalLine;
- UINT32 AcpiBtype;
- UINT32 AmlLength;
- UINT32 AmlSubtreeLength;
- UINT32 FinalAmlLength;
- UINT32 FinalAmlOffset;
- UINT32 CompileFlags;
- UINT16 ParseOpcode;
- UINT8 AmlOpcodeLength;
- UINT8 AmlPkgLenBytes;
- UINT8 Extra;
- char ParseOpName[12];
+ union acpi_parse_object *Child;
+ union acpi_parse_object *ParentMethod;
+ char *Filename;
+ char *ExternalName;
+ char *Namepath;
+ char NameSeg[4];
+ UINT32 ExtraValue;
+ UINT32 Column;
+ UINT32 LineNumber;
+ UINT32 LogicalLineNumber;
+ UINT32 LogicalByteOffset;
+ UINT32 EndLine;
+ UINT32 EndLogicalLine;
+ UINT32 AcpiBtype;
+ UINT32 AmlLength;
+ UINT32 AmlSubtreeLength;
+ UINT32 FinalAmlLength;
+ UINT32 FinalAmlOffset;
+ UINT32 CompileFlags;
+ UINT16 ParseOpcode;
+ UINT8 AmlOpcodeLength;
+ UINT8 AmlPkgLenBytes;
+ UINT8 Extra;
+ char ParseOpName[ACPI_MAX_PARSEOP_NAME];
} ACPI_PARSE_OBJ_ASL;
-
typedef union acpi_parse_object
{
- ACPI_PARSE_OBJ_COMMON Common;
- ACPI_PARSE_OBJ_NAMED Named;
- ACPI_PARSE_OBJ_ASL Asl;
+ ACPI_PARSE_OBJ_COMMON Common;
+ ACPI_PARSE_OBJ_NAMED Named;
+ ACPI_PARSE_OBJ_ASL Asl;
} ACPI_PARSE_OBJECT;
@@ -813,34 +883,36 @@
*/
typedef struct acpi_parse_state
{
- UINT32 AmlSize;
- UINT8 *AmlStart; /* First AML byte */
- UINT8 *Aml; /* Next AML byte */
- UINT8 *AmlEnd; /* (last + 1) AML byte */
- UINT8 *PkgStart; /* Current package begin */
- UINT8 *PkgEnd; /* Current package end */
- union acpi_parse_object *StartOp; /* Root of parse tree */
- struct acpi_namespace_node *StartNode;
- union acpi_generic_state *Scope; /* Current scope */
- union acpi_parse_object *StartScope;
+ UINT8 *AmlStart; /* First AML byte */
+ UINT8 *Aml; /* Next AML byte */
+ UINT8 *AmlEnd; /* (last + 1) AML byte */
+ UINT8 *PkgStart; /* Current package begin */
+ UINT8 *PkgEnd; /* Current package end */
+ union acpi_parse_object *StartOp; /* Root of parse tree */
+ struct acpi_namespace_node *StartNode;
+ union acpi_generic_state *Scope; /* Current scope */
+ union acpi_parse_object *StartScope;
+ UINT32 AmlSize;
} ACPI_PARSE_STATE;
/* Parse object flags */
-#define ACPI_PARSEOP_GENERIC 0x01
-#define ACPI_PARSEOP_NAMED 0x02
-#define ACPI_PARSEOP_DEFERRED 0x04
-#define ACPI_PARSEOP_BYTELIST 0x08
-#define ACPI_PARSEOP_IN_CACHE 0x80
+#define ACPI_PARSEOP_GENERIC 0x01
+#define ACPI_PARSEOP_NAMED 0x02
+#define ACPI_PARSEOP_DEFERRED 0x04
+#define ACPI_PARSEOP_BYTELIST 0x08
+#define ACPI_PARSEOP_IN_STACK 0x10
+#define ACPI_PARSEOP_TARGET 0x20
+#define ACPI_PARSEOP_IN_CACHE 0x80
/* Parse object DisasmFlags */
-#define ACPI_PARSEOP_IGNORE 0x01
-#define ACPI_PARSEOP_PARAMLIST 0x02
-#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
-#define ACPI_PARSEOP_SPECIAL 0x10
+#define ACPI_PARSEOP_IGNORE 0x01
+#define ACPI_PARSEOP_PARAMLIST 0x02
+#define ACPI_PARSEOP_EMPTY_TERMLIST 0x04
+#define ACPI_PARSEOP_SPECIAL 0x10
/*****************************************************************************
@@ -849,18 +921,27 @@
*
****************************************************************************/
-#define PCI_ROOT_HID_STRING "PNP0A03"
+#define PCI_ROOT_HID_STRING "PNP0A03"
+#define PCI_EXPRESS_ROOT_HID_STRING "PNP0A08"
typedef struct acpi_bit_register_info
{
- UINT8 ParentRegister;
- UINT8 BitPosition;
- UINT16 AccessBitMask;
+ UINT8 ParentRegister;
+ UINT8 BitPosition;
+ UINT16 AccessBitMask;
} ACPI_BIT_REGISTER_INFO;
/*
+ * Some ACPI registers have bits that must be ignored -- meaning that they
+ * must be preserved.
+ */
+#define ACPI_PM1_STATUS_PRESERVED_BITS 0x0800 /* Bit 11 */
+#define ACPI_PM1_CONTROL_PRESERVED_BITS 0x0201 /* Bit 9, Bit 0 (SCI_EN) */
+
+
+/*
* Register IDs
* These are the full ACPI registers
*/
@@ -883,21 +964,24 @@
#define ACPI_BITMASK_POWER_BUTTON_STATUS 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_STATUS 0x0200
#define ACPI_BITMASK_RT_CLOCK_STATUS 0x0400
+#define ACPI_BITMASK_PCIEXP_WAKE_STATUS 0x4000 /* ACPI 3.0 */
#define ACPI_BITMASK_WAKE_STATUS 0x8000
-#define ACPI_BITMASK_ALL_FIXED_STATUS (ACPI_BITMASK_TIMER_STATUS | \
- ACPI_BITMASK_BUS_MASTER_STATUS | \
- ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
- ACPI_BITMASK_POWER_BUTTON_STATUS | \
- ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
- ACPI_BITMASK_RT_CLOCK_STATUS | \
- ACPI_BITMASK_WAKE_STATUS)
+#define ACPI_BITMASK_ALL_FIXED_STATUS (\
+ ACPI_BITMASK_TIMER_STATUS | \
+ ACPI_BITMASK_BUS_MASTER_STATUS | \
+ ACPI_BITMASK_GLOBAL_LOCK_STATUS | \
+ ACPI_BITMASK_POWER_BUTTON_STATUS | \
+ ACPI_BITMASK_SLEEP_BUTTON_STATUS | \
+ ACPI_BITMASK_RT_CLOCK_STATUS | \
+ ACPI_BITMASK_WAKE_STATUS)
#define ACPI_BITMASK_TIMER_ENABLE 0x0001
#define ACPI_BITMASK_GLOBAL_LOCK_ENABLE 0x0020
#define ACPI_BITMASK_POWER_BUTTON_ENABLE 0x0100
#define ACPI_BITMASK_SLEEP_BUTTON_ENABLE 0x0200
#define ACPI_BITMASK_RT_CLOCK_ENABLE 0x0400
+#define ACPI_BITMASK_PCIEXP_WAKE_DISABLE 0x4000 /* ACPI 3.0 */
#define ACPI_BITMASK_SCI_ENABLE 0x0001
#define ACPI_BITMASK_BUS_MASTER_RLD 0x0002
@@ -916,6 +1000,7 @@
#define ACPI_BITPOSITION_POWER_BUTTON_STATUS 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_STATUS 0x09
#define ACPI_BITPOSITION_RT_CLOCK_STATUS 0x0A
+#define ACPI_BITPOSITION_PCIEXP_WAKE_STATUS 0x0E /* ACPI 3.0 */
#define ACPI_BITPOSITION_WAKE_STATUS 0x0F
#define ACPI_BITPOSITION_TIMER_ENABLE 0x00
@@ -923,6 +1008,7 @@
#define ACPI_BITPOSITION_POWER_BUTTON_ENABLE 0x08
#define ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE 0x09
#define ACPI_BITPOSITION_RT_CLOCK_ENABLE 0x0A
+#define ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE 0x0E /* ACPI 3.0 */
#define ACPI_BITPOSITION_SCI_ENABLE 0x00
#define ACPI_BITPOSITION_BUS_MASTER_RLD 0x01
@@ -939,48 +1025,55 @@
*
****************************************************************************/
-
/* ResourceType values */
-#define ACPI_RESOURCE_TYPE_MEMORY_RANGE 0
-#define ACPI_RESOURCE_TYPE_IO_RANGE 1
-#define ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE 2
+#define ACPI_ADDRESS_TYPE_MEMORY_RANGE 0
+#define ACPI_ADDRESS_TYPE_IO_RANGE 1
+#define ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE 2
/* Resource descriptor types and masks */
-#define ACPI_RDESC_TYPE_LARGE 0x80
-#define ACPI_RDESC_TYPE_SMALL 0x00
+#define ACPI_RESOURCE_NAME_LARGE 0x80
+#define ACPI_RESOURCE_NAME_SMALL 0x00
-#define ACPI_RDESC_TYPE_MASK 0x80
-#define ACPI_RDESC_SMALL_MASK 0x78 /* Only bits 6:3 contain the type */
+#define ACPI_RESOURCE_NAME_SMALL_MASK 0x78 /* Bits 6:3 contain the type */
+#define ACPI_RESOURCE_NAME_SMALL_LENGTH_MASK 0x07 /* Bits 2:0 contain the length */
+#define ACPI_RESOURCE_NAME_LARGE_MASK 0x7F /* Bits 6:0 contain the type */
/*
- * Small resource descriptor types
- * Note: The 3 length bits (2:0) must be zero
+ * Small resource descriptor "names" as defined by the ACPI specification.
+ * Note: Bits 2:0 are used for the descriptor length
*/
-#define ACPI_RDESC_TYPE_IRQ_FORMAT 0x20
-#define ACPI_RDESC_TYPE_DMA_FORMAT 0x28
-#define ACPI_RDESC_TYPE_START_DEPENDENT 0x30
-#define ACPI_RDESC_TYPE_END_DEPENDENT 0x38
-#define ACPI_RDESC_TYPE_IO_PORT 0x40
-#define ACPI_RDESC_TYPE_FIXED_IO_PORT 0x48
-#define ACPI_RDESC_TYPE_SMALL_VENDOR 0x70
-#define ACPI_RDESC_TYPE_END_TAG 0x78
+#define ACPI_RESOURCE_NAME_IRQ 0x20
+#define ACPI_RESOURCE_NAME_DMA 0x28
+#define ACPI_RESOURCE_NAME_START_DEPENDENT 0x30
+#define ACPI_RESOURCE_NAME_END_DEPENDENT 0x38
+#define ACPI_RESOURCE_NAME_IO 0x40
+#define ACPI_RESOURCE_NAME_FIXED_IO 0x48
+#define ACPI_RESOURCE_NAME_RESERVED_S1 0x50
+#define ACPI_RESOURCE_NAME_RESERVED_S2 0x58
+#define ACPI_RESOURCE_NAME_RESERVED_S3 0x60
+#define ACPI_RESOURCE_NAME_RESERVED_S4 0x68
+#define ACPI_RESOURCE_NAME_VENDOR_SMALL 0x70
+#define ACPI_RESOURCE_NAME_END_TAG 0x78
/*
- * Large resource descriptor types
+ * Large resource descriptor "names" as defined by the ACPI specification.
+ * Note: includes the Large Descriptor bit in bit[7]
*/
-
-#define ACPI_RDESC_TYPE_MEMORY_24 0x81
-#define ACPI_RDESC_TYPE_GENERAL_REGISTER 0x82
-#define ACPI_RDESC_TYPE_LARGE_VENDOR 0x84
-#define ACPI_RDESC_TYPE_MEMORY_32 0x85
-#define ACPI_RDESC_TYPE_FIXED_MEMORY_32 0x86
-#define ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE 0x87
-#define ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE 0x88
-#define ACPI_RDESC_TYPE_EXTENDED_XRUPT 0x89
-#define ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE 0x8A
+#define ACPI_RESOURCE_NAME_MEMORY24 0x81
+#define ACPI_RESOURCE_NAME_GENERIC_REGISTER 0x82
+#define ACPI_RESOURCE_NAME_RESERVED_L1 0x83
+#define ACPI_RESOURCE_NAME_VENDOR_LARGE 0x84
+#define ACPI_RESOURCE_NAME_MEMORY32 0x85
+#define ACPI_RESOURCE_NAME_FIXED_MEMORY32 0x86
+#define ACPI_RESOURCE_NAME_ADDRESS32 0x87
+#define ACPI_RESOURCE_NAME_ADDRESS16 0x88
+#define ACPI_RESOURCE_NAME_EXTENDED_IRQ 0x89
+#define ACPI_RESOURCE_NAME_ADDRESS64 0x8A
+#define ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64 0x8B
+#define ACPI_RESOURCE_NAME_LARGE_MAX 0x8B
/*****************************************************************************
@@ -989,7 +1082,7 @@
*
****************************************************************************/
-#define ACPI_ASCII_ZERO 0x30
+#define ACPI_ASCII_ZERO 0x30
/*****************************************************************************
@@ -1000,26 +1093,44 @@
typedef struct acpi_db_method_info
{
- ACPI_HANDLE ThreadGate;
- char *Name;
- char **Args;
- UINT32 Flags;
- UINT32 NumLoops;
- char Pathname[128];
+ ACPI_HANDLE MainThreadGate;
+ ACPI_HANDLE ThreadCompleteGate;
+ UINT32 *Threads;
+ UINT32 NumThreads;
+ UINT32 NumCreated;
+ UINT32 NumCompleted;
+
+ char *Name;
+ UINT32 Flags;
+ UINT32 NumLoops;
+ char Pathname[128];
+ char **Args;
+
+ /*
+ * Arguments to be passed to method for the command
+ * Threads -
+ * the Number of threads, ID of current thread and
+ * Index of current thread inside all them created.
+ */
+ char InitArgs;
+ char *Arguments[4];
+ char NumThreadsStr[11];
+ char IdOfThreadStr[11];
+ char IndexOfThreadStr[11];
} ACPI_DB_METHOD_INFO;
typedef struct acpi_integrity_info
{
- UINT32 Nodes;
- UINT32 Objects;
+ UINT32 Nodes;
+ UINT32 Objects;
} ACPI_INTEGRITY_INFO;
-#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
-#define ACPI_DB_CONSOLE_OUTPUT 0x02
-#define ACPI_DB_DUPLICATE_OUTPUT 0x03
+#define ACPI_DB_REDIRECTABLE_OUTPUT 0x01
+#define ACPI_DB_CONSOLE_OUTPUT 0x02
+#define ACPI_DB_DUPLICATE_OUTPUT 0x03
/*****************************************************************************
@@ -1028,29 +1139,20 @@
*
****************************************************************************/
-typedef struct acpi_debug_print_info
-{
- UINT32 ComponentId;
- char *ProcName;
- char *ModuleName;
-
-} ACPI_DEBUG_PRINT_INFO;
-
-
/* Entry for a memory allocation (debug only) */
-#define ACPI_MEM_MALLOC 0
-#define ACPI_MEM_CALLOC 1
-#define ACPI_MAX_MODULE_NAME 16
+#define ACPI_MEM_MALLOC 0
+#define ACPI_MEM_CALLOC 1
+#define ACPI_MAX_MODULE_NAME 16
#define ACPI_COMMON_DEBUG_MEM_HEADER \
- struct acpi_debug_mem_block *Previous; \
- struct acpi_debug_mem_block *Next; \
- UINT32 Size; \
- UINT32 Component; \
- UINT32 Line; \
- char Module[ACPI_MAX_MODULE_NAME]; \
- UINT8 AllocType;
+ struct acpi_debug_mem_block *Previous; \
+ struct acpi_debug_mem_block *Next; \
+ UINT32 Size; \
+ UINT32 Component; \
+ UINT32 Line; \
+ char Module[ACPI_MAX_MODULE_NAME]; \
+ UINT8 AllocType;
typedef struct acpi_debug_mem_header
{
@@ -1061,42 +1163,37 @@
typedef struct acpi_debug_mem_block
{
ACPI_COMMON_DEBUG_MEM_HEADER
- UINT64 UserSpace;
+ UINT64 UserSpace;
} ACPI_DEBUG_MEM_BLOCK;
#define ACPI_MEM_LIST_GLOBAL 0
#define ACPI_MEM_LIST_NSNODE 1
-
-#define ACPI_MEM_LIST_FIRST_CACHE_LIST 2
-#define ACPI_MEM_LIST_STATE 2
-#define ACPI_MEM_LIST_PSNODE 3
-#define ACPI_MEM_LIST_PSNODE_EXT 4
-#define ACPI_MEM_LIST_OPERAND 5
-#define ACPI_MEM_LIST_WALK 6
-#define ACPI_MEM_LIST_MAX 6
-#define ACPI_NUM_MEM_LISTS 7
+#define ACPI_MEM_LIST_MAX 1
+#define ACPI_NUM_MEM_LISTS 2
typedef struct acpi_memory_list
{
- void *ListHead;
- UINT16 LinkOffset;
- UINT16 MaxCacheDepth;
- UINT16 CacheDepth;
- UINT16 ObjectSize;
+ char *ListName;
+ void *ListHead;
+ UINT16 ObjectSize;
+ UINT16 MaxDepth;
+ UINT16 CurrentDepth;
+ UINT16 LinkOffset;
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
/* Statistics for debug memory tracking only */
- UINT32 TotalAllocated;
- UINT32 TotalFreed;
- UINT32 CurrentTotalSize;
- UINT32 CacheRequests;
- UINT32 CacheHits;
- char *ListName;
+ UINT32 TotalAllocated;
+ UINT32 TotalFreed;
+ UINT32 MaxOccupied;
+ UINT32 TotalSize;
+ UINT32 CurrentTotalSize;
+ UINT32 Requests;
+ UINT32 Hits;
#endif
} ACPI_MEMORY_LIST;
Index: acpiosxf.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acpiosxf.h,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acpiosxf.h -L sys/contrib/dev/acpica/acpiosxf.h -u -r1.1.1.1 -r1.2
--- sys/contrib/dev/acpica/acpiosxf.h
+++ sys/contrib/dev/acpica/acpiosxf.h
@@ -12,7 +12,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,12 +125,18 @@
#include <contrib/dev/acpica/actypes.h>
-/* Priorities for AcpiOsQueueForExecution */
+/* Types for AcpiOsExecute */
-#define OSD_PRIORITY_GPE 1
-#define OSD_PRIORITY_HIGH 2
-#define OSD_PRIORITY_MED 3
-#define OSD_PRIORITY_LO 4
+typedef enum
+{
+ OSL_GLOBAL_LOCK_HANDLER,
+ OSL_NOTIFY_HANDLER,
+ OSL_GPE_HANDLER,
+ OSL_DEBUGGER_THREAD,
+ OSL_EC_POLL_HANDLER,
+ OSL_EC_BURST_HANDLER
+
+} ACPI_EXECUTE_TYPE;
#define ACPI_NO_UNIT_LIMIT ((UINT32) -1)
#define ACPI_MUTEX_SEM 1
@@ -153,7 +159,6 @@
/*
* OSL Initialization and shutdown primitives
*/
-
ACPI_STATUS
AcpiOsInitialize (
void);
@@ -166,11 +171,9 @@
/*
* ACPI Table interfaces
*/
-
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AcpiOsGetRootPointer (
- UINT32 Flags,
- ACPI_POINTER *Address);
+ void);
ACPI_STATUS
AcpiOsPredefinedOverride (
@@ -184,53 +187,82 @@
/*
- * Synchronization primitives
+ * Spinlock primitives
*/
+ACPI_STATUS
+AcpiOsCreateLock (
+ ACPI_SPINLOCK *OutHandle);
+
+void
+AcpiOsDeleteLock (
+ ACPI_SPINLOCK Handle);
+ACPI_CPU_FLAGS
+AcpiOsAcquireLock (
+ ACPI_SPINLOCK Handle);
+
+void
+AcpiOsReleaseLock (
+ ACPI_SPINLOCK Handle,
+ ACPI_CPU_FLAGS Flags);
+
+
+/*
+ * Semaphore primitives
+ */
ACPI_STATUS
AcpiOsCreateSemaphore (
UINT32 MaxUnits,
UINT32 InitialUnits,
- ACPI_HANDLE *OutHandle);
+ ACPI_SEMAPHORE *OutHandle);
ACPI_STATUS
AcpiOsDeleteSemaphore (
- ACPI_HANDLE Handle);
+ ACPI_SEMAPHORE Handle);
ACPI_STATUS
AcpiOsWaitSemaphore (
- ACPI_HANDLE Handle,
+ ACPI_SEMAPHORE Handle,
UINT32 Units,
UINT16 Timeout);
ACPI_STATUS
AcpiOsSignalSemaphore (
- ACPI_HANDLE Handle,
+ ACPI_SEMAPHORE Handle,
UINT32 Units);
+
+/*
+ * Mutex primitives
+ */
ACPI_STATUS
-AcpiOsCreateLock (
- ACPI_HANDLE *OutHandle);
+AcpiOsCreateMutex (
+ ACPI_MUTEX *OutHandle);
void
-AcpiOsDeleteLock (
- ACPI_HANDLE Handle);
+AcpiOsDeleteMutex (
+ ACPI_MUTEX Handle);
-void
-AcpiOsAcquireLock (
- ACPI_HANDLE Handle,
- UINT32 Flags);
+ACPI_STATUS
+AcpiOsAcquireMutex (
+ ACPI_MUTEX Handle,
+ UINT16 Timeout);
void
-AcpiOsReleaseLock (
- ACPI_HANDLE Handle,
- UINT32 Flags);
+AcpiOsReleaseMutex (
+ ACPI_MUTEX Handle);
+
+/* Temporary macros for Mutex* interfaces, map to existing semaphore xfaces */
+
+#define AcpiOsCreateMutex(OutHandle) AcpiOsCreateSemaphore (1, 1, OutHandle)
+#define AcpiOsDeleteMutex(Handle) (void) AcpiOsDeleteSemaphore (Handle)
+#define AcpiOsAcquireMutex(Handle,Time) AcpiOsWaitSemaphore (Handle, 1, Time)
+#define AcpiOsReleaseMutex(Handle) (void) AcpiOsSignalSemaphore (Handle, 1)
/*
* Memory allocation and mapping
*/
-
void *
AcpiOsAllocate (
ACPI_SIZE Size);
@@ -239,11 +271,10 @@
AcpiOsFree (
void * Memory);
-ACPI_STATUS
+void *
AcpiOsMapMemory (
- ACPI_PHYSICAL_ADDRESS PhysicalAddress,
- ACPI_SIZE Size,
- void **LogicalAddress);
+ ACPI_PHYSICAL_ADDRESS Where,
+ ACPI_NATIVE_UINT Length);
void
AcpiOsUnmapMemory (
@@ -257,9 +288,36 @@
/*
- * Interrupt handlers
+ * Memory/Object Cache
*/
+ACPI_STATUS
+AcpiOsCreateCache (
+ char *CacheName,
+ UINT16 ObjectSize,
+ UINT16 MaxDepth,
+ ACPI_CACHE_T **ReturnCache);
+
+ACPI_STATUS
+AcpiOsDeleteCache (
+ ACPI_CACHE_T *Cache);
+
+ACPI_STATUS
+AcpiOsPurgeCache (
+ ACPI_CACHE_T *Cache);
+
+void *
+AcpiOsAcquireObject (
+ ACPI_CACHE_T *Cache);
+
+ACPI_STATUS
+AcpiOsReleaseObject (
+ ACPI_CACHE_T *Cache,
+ void *Object);
+
+/*
+ * Interrupt handlers
+ */
ACPI_STATUS
AcpiOsInstallInterruptHandler (
UINT32 InterruptNumber,
@@ -275,14 +333,13 @@
/*
* Threads and Scheduling
*/
-
-UINT32
+ACPI_THREAD_ID
AcpiOsGetThreadId (
void);
ACPI_STATUS
-AcpiOsQueueForExecution (
- UINT32 Priority,
+AcpiOsExecute (
+ ACPI_EXECUTE_TYPE Type,
ACPI_OSD_EXEC_CALLBACK Function,
void *Context);
@@ -302,7 +359,6 @@
/*
* Platform and hardware-independent I/O interfaces
*/
-
ACPI_STATUS
AcpiOsReadPort (
ACPI_IO_ADDRESS Address,
@@ -319,7 +375,6 @@
/*
* Platform and hardware-independent physical memory interfaces
*/
-
ACPI_STATUS
AcpiOsReadMemory (
ACPI_PHYSICAL_ADDRESS Address,
@@ -338,7 +393,6 @@
* Note: Can't use "Register" as a parameter, changed to "Reg" --
* certain compilers complain.
*/
-
ACPI_STATUS
AcpiOsReadPciConfiguration (
ACPI_PCI_ID *PciId,
@@ -353,19 +407,29 @@
ACPI_INTEGER Value,
UINT32 Width);
+
/*
* Interim function needed for PCI IRQ routing
*/
-
void
AcpiOsDerivePciId(
ACPI_HANDLE Rhandle,
ACPI_HANDLE Chandle,
ACPI_PCI_ID **PciId);
+
/*
* Miscellaneous
*/
+ACPI_STATUS
+AcpiOsValidateInterface (
+ char *Interface);
+
+ACPI_STATUS
+AcpiOsValidateAddress (
+ UINT8 SpaceId,
+ ACPI_PHYSICAL_ADDRESS Address,
+ ACPI_SIZE Length);
BOOLEAN
AcpiOsReadable (
@@ -386,10 +450,10 @@
UINT32 Function,
void *Info);
+
/*
* Debug print routines
*/
-
void ACPI_INTERNAL_VAR_XFACE
AcpiOsPrintf (
const char *Format,
@@ -408,7 +472,6 @@
/*
* Debug input
*/
-
UINT32
AcpiOsGetLine (
char *Buffer);
@@ -417,7 +480,6 @@
/*
* Directory manipulation
*/
-
void *
AcpiOsOpenDirectory (
char *Pathname,
@@ -438,16 +500,5 @@
AcpiOsCloseDirectory (
void *DirHandle);
-/*
- * Debug
- */
-
-void
-AcpiOsDbgAssert(
- void *FailedAssertion,
- void *FileName,
- UINT32 LineNumber,
- char *Message);
-
#endif /* __ACPIOSXF_H__ */
Index: evgpe.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evgpe.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evgpe.c -L sys/contrib/dev/acpica/evgpe.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evgpe.c
+++ sys/contrib/dev/acpica/evgpe.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evgpe - General Purpose Event handling and dispatch
- * $Revision: 44 $
+ * $Revision: 1.68 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,16 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evgpe")
+/* Local prototypes */
+
+static void
+AcpiEvAsynchEnableGpe (
+ void *Context);
+
+static void ACPI_SYSTEM_XFACE
+AcpiEvAsynchExecuteGpeMethod (
+ void *Context);
+
/*******************************************************************************
*
@@ -143,7 +153,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvSetGpeType");
+ ACPI_FUNCTION_TRACE (EvSetGpeType);
/* Validate type and update register enable masks */
@@ -194,7 +204,7 @@
UINT8 RegisterBit;
- ACPI_FUNCTION_TRACE ("EvUpdateGpeEnableMasks");
+ ACPI_FUNCTION_TRACE (EvUpdateGpeEnableMasks);
GpeRegisterInfo = GpeEventInfo->RegisterInfo;
@@ -202,7 +212,8 @@
{
return_ACPI_STATUS (AE_NOT_EXIST);
}
- RegisterBit = GpeEventInfo->RegisterBit;
+ RegisterBit = (UINT8)
+ (1 << (GpeEventInfo->GpeNumber - GpeRegisterInfo->BaseGpeNumber));
/* 1) Disable case. Simply clear all enable bits */
@@ -262,7 +273,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvEnableGpe");
+ ACPI_FUNCTION_TRACE (EvEnableGpe);
/* Make sure HW enable masks are updated */
@@ -335,7 +346,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvDisableGpe");
+ ACPI_FUNCTION_TRACE (EvDisableGpe);
if (!(GpeEventInfo->Flags & ACPI_GPE_ENABLE_MASK))
@@ -422,9 +433,11 @@
if (GpeBlock)
{
if ((GpeNumber >= GpeBlock->BlockBaseNumber) &&
- (GpeNumber < GpeBlock->BlockBaseNumber + (GpeBlock->RegisterCount * 8)))
+ (GpeNumber < GpeBlock->BlockBaseNumber +
+ (GpeBlock->RegisterCount * 8)))
{
- return (&GpeBlock->EventInfo[GpeNumber - GpeBlock->BlockBaseNumber]);
+ return (&GpeBlock->EventInfo[GpeNumber -
+ GpeBlock->BlockBaseNumber]);
}
}
}
@@ -473,18 +486,19 @@
AcpiEvGpeDetect (
ACPI_GPE_XRUPT_INFO *GpeXruptList)
{
+ ACPI_STATUS Status;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 IntStatus = ACPI_INTERRUPT_NOT_HANDLED;
UINT8 EnabledStatusByte;
- ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
UINT32 StatusReg;
UINT32 EnableReg;
- ACPI_STATUS Status;
- ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_CPU_FLAGS Flags;
ACPI_NATIVE_UINT i;
ACPI_NATIVE_UINT j;
- ACPI_FUNCTION_NAME ("EvGpeDetect");
+ ACPI_FUNCTION_NAME (EvGpeDetect);
/* Check for the case where there are no GPEs */
@@ -493,9 +507,15 @@
return (IntStatus);
}
+ /*
+ * We need to obtain the GPE lock for both the data structs and registers
+ * Note: Not necessary to obtain the hardware lock, since the GPE registers
+ * are owned by the GpeLock.
+ */
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
/* Examine all GPE blocks attached to this interrupt level */
- AcpiOsAcquireLock (AcpiGbl_GpeLock, ACPI_ISR);
GpeBlock = GpeXruptList->GpeBlockListHead;
while (GpeBlock)
{
@@ -532,7 +552,7 @@
"Read GPE Register at GPE%X: Status=%02X, Enable=%02X\n",
GpeRegisterInfo->BaseGpeNumber, StatusReg, EnableReg));
- /* First check if there is anything active at all in this register */
+ /* Check if there is anything active at all in this register */
EnabledStatusByte = (UINT8) (StatusReg & EnableReg);
if (!EnabledStatusByte)
@@ -548,15 +568,15 @@
{
/* Examine one GPE bit */
- if (EnabledStatusByte & AcpiGbl_DecodeTo8bit[j])
+ if (EnabledStatusByte & (1 << j))
{
/*
* Found an active GPE. Dispatch the event to a handler
* or method.
*/
IntStatus |= AcpiEvGpeDispatch (
- &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j],
- (UINT32) j + GpeRegisterInfo->BaseGpeNumber);
+ &GpeBlock->EventInfo[(i * ACPI_GPE_REGISTER_WIDTH) + j],
+ (UINT32) j + GpeRegisterInfo->BaseGpeNumber);
}
}
}
@@ -566,7 +586,7 @@
UnlockAndExit:
- AcpiOsReleaseLock (AcpiGbl_GpeLock, ACPI_ISR);
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
return (IntStatus);
}
@@ -579,9 +599,9 @@
*
* RETURN: None
*
- * DESCRIPTION: Perform the actual execution of a GPE control method. This
- * function is called from an invocation of AcpiOsQueueForExecution
- * (and therefore does NOT execute at interrupt level) so that
+ * DESCRIPTION: Perform the actual execution of a GPE control method. This
+ * function is called from an invocation of AcpiOsExecute and
+ * therefore does NOT execute at interrupt level - so that
* the control method itself is not executed in the context of
* an interrupt handler.
*
@@ -592,13 +612,12 @@
void *Context)
{
ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context;
- UINT32 GpeNumber = 0;
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO LocalGpeEventInfo;
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
- ACPI_FUNCTION_TRACE ("EvAsynchExecuteGpeMethod");
+ ACPI_FUNCTION_TRACE (EvAsynchExecuteGpeMethod);
Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
@@ -623,7 +642,8 @@
* Take a snapshot of the GPE info for this level - we copy the
* info to prevent a race condition with RemoveHandler/RemoveBlock.
*/
- ACPI_MEMCPY (&LocalGpeEventInfo, GpeEventInfo, sizeof (ACPI_GPE_EVENT_INFO));
+ ACPI_MEMCPY (&LocalGpeEventInfo, GpeEventInfo,
+ sizeof (ACPI_GPE_EVENT_INFO));
Status = AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
if (ACPI_FAILURE (Status))
@@ -635,34 +655,59 @@
* Must check for control method type dispatch one more
* time to avoid race with EvGpeInstallHandler
*/
- if ((LocalGpeEventInfo.Flags & ACPI_GPE_DISPATCH_MASK) == ACPI_GPE_DISPATCH_METHOD)
+ if ((LocalGpeEventInfo.Flags & ACPI_GPE_DISPATCH_MASK) ==
+ ACPI_GPE_DISPATCH_METHOD)
{
- /*
- * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
- * control method that corresponds to this GPE
- */
- Info.Node = LocalGpeEventInfo.Dispatch.MethodNode;
- Info.Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, GpeEventInfo);
- Info.ParameterType = ACPI_PARAM_GPE;
+ /* Allocate the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ Status = AE_NO_MEMORY;
+ }
+ else
+ {
+ /*
+ * Invoke the GPE Method (_Lxx, _Exx) i.e., evaluate the _Lxx/_Exx
+ * control method that corresponds to this GPE
+ */
+ Info->PrefixNode = LocalGpeEventInfo.Dispatch.MethodNode;
+ Info->Parameters = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT *, GpeEventInfo);
+ Info->ParameterType = ACPI_PARAM_GPE;
+ Info->Flags = ACPI_IGNORE_RETURN_VALUE;
+
+ Status = AcpiNsEvaluate (Info);
+ ACPI_FREE (Info);
+ }
- Status = AcpiNsEvaluateByHandle (&Info);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "%s while evaluating method [%4.4s] for GPE[%2X]\n",
- AcpiFormatException (Status),
- AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode),
- GpeNumber));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "while evaluating GPE method [%4.4s]",
+ AcpiUtGetNodeName (LocalGpeEventInfo.Dispatch.MethodNode)));
}
}
- if ((LocalGpeEventInfo.Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED)
+ /* Defer enabling of GPE until all notify handlers are done */
+ AcpiOsExecute(OSL_NOTIFY_HANDLER, AcpiEvAsynchEnableGpe, GpeEventInfo);
+ return_VOID;
+}
+
+static void
+AcpiEvAsynchEnableGpe (
+ void *Context)
+{
+ ACPI_GPE_EVENT_INFO *GpeEventInfo = (void *) Context;
+ ACPI_STATUS Status;
+
+ if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
+ ACPI_GPE_LEVEL_TRIGGERED)
{
/*
* GPE is level-triggered, we clear the GPE status bit after
* handling the event.
*/
- Status = AcpiHwClearGpe (&LocalGpeEventInfo);
+ Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
return_VOID;
@@ -671,7 +716,7 @@
/* Enable this GPE */
- (void) AcpiHwWriteGpeEnableReg (&LocalGpeEventInfo);
+ (void) AcpiHwWriteGpeEnableReg (GpeEventInfo);
return_VOID;
}
@@ -680,7 +725,7 @@
*
* FUNCTION: AcpiEvGpeDispatch
*
- * PARAMETERS: GpeEventInfo - info for this GPE
+ * PARAMETERS: GpeEventInfo - Info for this GPE
* GpeNumber - Number relative to the parent GPE block
*
* RETURN: INTERRUPT_HANDLED or INTERRUPT_NOT_HANDLED
@@ -700,41 +745,45 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvGpeDispatch");
+ ACPI_FUNCTION_TRACE (EvGpeDispatch);
+ AcpiGpeCount++;
+
/*
* If edge-triggered, clear the GPE status bit now. Note that
* level-triggered events are cleared after the GPE is serviced.
*/
- if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_EDGE_TRIGGERED)
+ if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
+ ACPI_GPE_EDGE_TRIGGERED)
{
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n",
- GpeNumber));
- return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to clear GPE[%2X]", GpeNumber));
+ return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
}
- /* Save current system state */
-
- if (AcpiGbl_SystemAwakeAndRunning)
- {
- ACPI_SET_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING);
- }
- else
+ if (!AcpiGbl_SystemAwakeAndRunning)
{
- ACPI_CLEAR_BIT (GpeEventInfo->Flags, ACPI_GPE_SYSTEM_RUNNING);
+ /*
+ * We just woke up because of a wake GPE. Disable any further GPEs
+ * until we are fully up and running (Only wake GPEs should be enabled
+ * at this time, but we just brute-force disable them all.)
+ * 1) We must disable this particular wake GPE so it won't fire again
+ * 2) We want to disable all wake GPEs, since we are now awake
+ */
+ (void) AcpiHwDisableAllGpes ();
}
/*
- * Dispatch the GPE to either an installed handler, or the control
- * method associated with this GPE (_Lxx or _Exx).
- * If a handler exists, we invoke it and do not attempt to run the method.
- * If there is neither a handler nor a method, we disable the level to
- * prevent further events from coming in here.
+ * Dispatch the GPE to either an installed handler, or the control method
+ * associated with this GPE (_Lxx or _Exx). If a handler exists, we invoke
+ * it and do not attempt to run the method. If there is neither a handler
+ * nor a method, we disable this GPE to prevent further such pointless
+ * events from firing.
*/
switch (GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK)
{
@@ -749,15 +798,15 @@
/* It is now safe to clear level-triggered events. */
- if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) == ACPI_GPE_LEVEL_TRIGGERED)
+ if ((GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK) ==
+ ACPI_GPE_LEVEL_TRIGGERED)
{
Status = AcpiHwClearGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: Unable to clear GPE[%2X]\n",
- GpeNumber));
- return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to clear GPE[%2X]", GpeNumber));
+ return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
}
break;
@@ -765,28 +814,27 @@
case ACPI_GPE_DISPATCH_METHOD:
/*
- * Disable GPE, so it doesn't keep firing before the method has a
- * chance to run.
+ * Disable the GPE, so it doesn't keep firing before the method has a
+ * chance to run (it runs asynchronously with interrupts enabled).
*/
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n",
- GpeNumber));
- return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to disable GPE[%2X]", GpeNumber));
+ return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
/*
* Execute the method associated with the GPE
* NOTE: Level-triggered GPEs are cleared after the method completes.
*/
- if (ACPI_FAILURE (AcpiOsQueueForExecution (OSD_PRIORITY_GPE,
- AcpiEvAsynchExecuteGpeMethod,
- GpeEventInfo)))
+ Status = AcpiOsExecute (OSL_GPE_HANDLER,
+ AcpiEvAsynchExecuteGpeMethod, GpeEventInfo);
+ if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: Unable to queue handler for GPE[%2X], event is disabled\n",
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to queue handler for GPE[%2X] - event disabled",
GpeNumber));
}
break;
@@ -795,78 +843,24 @@
/* No handler or method to run! */
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: No handler or method for GPE[%2X], disabling event\n",
+ ACPI_ERROR ((AE_INFO,
+ "No handler or method for GPE[%2X], disabling event",
GpeNumber));
/*
- * Disable the GPE. The GPE will remain disabled until the ACPI
+ * Disable the GPE. The GPE will remain disabled until the ACPI
* Core Subsystem is restarted, or a handler is installed.
*/
Status = AcpiEvDisableGpe (GpeEventInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR ((
- "AcpiEvGpeDispatch: Unable to disable GPE[%2X]\n",
- GpeNumber));
- return_VALUE (ACPI_INTERRUPT_NOT_HANDLED);
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Unable to disable GPE[%2X]", GpeNumber));
+ return_UINT32 (ACPI_INTERRUPT_NOT_HANDLED);
}
break;
}
- return_VALUE (ACPI_INTERRUPT_HANDLED);
-}
-
-
-#ifdef ACPI_GPE_NOTIFY_CHECK
-
-/*******************************************************************************
- * TBD: NOT USED, PROTOTYPE ONLY AND WILL PROBABLY BE REMOVED
- *
- * FUNCTION: AcpiEvCheckForWakeOnlyGpe
- *
- * PARAMETERS: GpeEventInfo - info for this GPE
- *
- * RETURN: Status
- *
- * DESCRIPTION: Determine if a a GPE is "wake-only".
- *
- * Called from Notify() code in interpreter when a "DeviceWake"
- * Notify comes in.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEvCheckForWakeOnlyGpe (
- ACPI_GPE_EVENT_INFO *GpeEventInfo)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("EvCheckForWakeOnlyGpe");
-
-
- if ((GpeEventInfo) && /* Only >0 for _Lxx/_Exx */
- ((GpeEventInfo->Flags & ACPI_GPE_SYSTEM_MASK) == ACPI_GPE_SYSTEM_RUNNING)) /* System state at GPE time */
- {
- /* This must be a wake-only GPE, disable it */
-
- Status = AcpiEvDisableGpe (GpeEventInfo);
-
- /* Set GPE to wake-only. Do not change wake disabled/enabled status */
-
- AcpiEvSetGpeType (GpeEventInfo, ACPI_GPE_TYPE_WAKE);
-
- ACPI_REPORT_INFO (("GPE %p was updated from wake/run to wake-only\n",
- GpeEventInfo));
-
- /* This was a wake-only GPE */
-
- return_ACPI_STATUS (AE_WAKE_ONLY_GPE);
- }
-
- return_ACPI_STATUS (AE_OK);
+ return_UINT32 (ACPI_INTERRUPT_HANDLED);
}
-#endif
-
Index: rsio.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsio.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsio.c -L sys/contrib/dev/acpica/rsio.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsio.c
+++ sys/contrib/dev/acpica/rsio.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsio - IO and DMA resource descriptors
- * $Revision: 25 $
+ * $Revision: 1.35 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,500 +125,217 @@
/*******************************************************************************
*
- * FUNCTION: AcpiRsIoResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertIo
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsIoResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertIo[5] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_IO);
-
-
- ACPI_FUNCTION_TRACE ("RsIoResource");
-
-
- /*
- * The number of bytes consumed are Constant
- */
- *BytesConsumed = 8;
-
- OutputStruct->Id = ACPI_RSTYPE_IO;
-
- /*
- * Check Decode
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- OutputStruct->Data.Io.IoDecode = Temp8 & 0x01;
-
- /*
- * Check MinBase Address
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- OutputStruct->Data.Io.MinBaseAddress = Temp16;
-
- /*
- * Check MaxBase Address
- */
- Buffer += 2;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- OutputStruct->Data.Io.MaxBaseAddress = Temp16;
-
- /*
- * Check Base alignment
- */
- Buffer += 2;
- Temp8 = *Buffer;
-
- OutputStruct->Data.Io.Alignment = Temp8;
-
- /*
- * Check RangeLength
- */
- Buffer += 1;
- Temp8 = *Buffer;
-
- OutputStruct->Data.Io.RangeLength = Temp8;
-
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_IO,
+ ACPI_RS_SIZE (ACPI_RESOURCE_IO),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertIo)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_IO,
+ sizeof (AML_RESOURCE_IO),
+ 0},
+
+ /* Decode flag */
+
+ {ACPI_RSC_1BITFLAG, ACPI_RS_OFFSET (Data.Io.IoDecode),
+ AML_OFFSET (Io.Flags),
+ 0},
+ /*
+ * These fields are contiguous in both the source and destination:
+ * Address Alignment
+ * Length
+ * Minimum Base Address
+ * Maximum Base Address
+ */
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.Io.Alignment),
+ AML_OFFSET (Io.Alignment),
+ 2},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.Io.Minimum),
+ AML_OFFSET (Io.Minimum),
+ 2}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsFixedIoResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertFixedIo
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsFixedIoResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[4] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_FIXED_IO);
-
-
- ACPI_FUNCTION_TRACE ("RsFixedIoResource");
-
-
- /*
- * The number of bytes consumed are Constant
- */
- *BytesConsumed = 4;
-
- OutputStruct->Id = ACPI_RSTYPE_FIXED_IO;
-
- /*
- * Check Range Base Address
- */
- Buffer += 1;
- ACPI_MOVE_16_TO_16 (&Temp16, Buffer);
-
- OutputStruct->Data.FixedIo.BaseAddress = Temp16;
-
- /*
- * Check RangeLength
- */
- Buffer += 2;
- Temp8 = *Buffer;
-
- OutputStruct->Data.FixedIo.RangeLength = Temp8;
-
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
-
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_FIXED_IO,
+ ACPI_RS_SIZE (ACPI_RESOURCE_FIXED_IO),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertFixedIo)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_FIXED_IO,
+ sizeof (AML_RESOURCE_FIXED_IO),
+ 0},
+ /*
+ * These fields are contiguous in both the source and destination:
+ * Base Address
+ * Length
+ */
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.FixedIo.AddressLength),
+ AML_OFFSET (FixedIo.AddressLength),
+ 1},
+
+ {ACPI_RSC_MOVE16, ACPI_RS_OFFSET (Data.FixedIo.Address),
+ AML_OFFSET (FixedIo.Address),
+ 1}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsIoStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsConvertGenericReg
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsIoStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[4] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
-
-
- ACPI_FUNCTION_TRACE ("RsIoStream");
-
-
- /*
- * The descriptor field is static
- */
- *Buffer = 0x47;
- Buffer += 1;
-
- /*
- * Io Information Byte
- */
- Temp8 = (UINT8) (LinkedList->Data.Io.IoDecode & 0x01);
-
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the Range minimum base address
- */
- Temp16 = (UINT16) LinkedList->Data.Io.MinBaseAddress;
-
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
-
- /*
- * Set the Range maximum base address
- */
- Temp16 = (UINT16) LinkedList->Data.Io.MaxBaseAddress;
-
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
-
- /*
- * Set the base alignment
- */
- Temp8 = (UINT8) LinkedList->Data.Io.Alignment;
-
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Set the range length
- */
- Temp8 = (UINT8) LinkedList->Data.Io.RangeLength;
-
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_GENERIC_REGISTER,
+ ACPI_RS_SIZE (ACPI_RESOURCE_GENERIC_REGISTER),
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertGenericReg)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_GENERIC_REGISTER,
+ sizeof (AML_RESOURCE_GENERIC_REGISTER),
+ 0},
+ /*
+ * These fields are contiguous in both the source and destination:
+ * Address Space ID
+ * Register Bit Width
+ * Register Bit Offset
+ * Access Size
+ */
+ {ACPI_RSC_MOVE8, ACPI_RS_OFFSET (Data.GenericReg.SpaceId),
+ AML_OFFSET (GenericReg.AddressSpaceId),
+ 4},
+
+ /* Get the Register Address */
+
+ {ACPI_RSC_MOVE64, ACPI_RS_OFFSET (Data.GenericReg.Address),
+ AML_OFFSET (GenericReg.Address),
+ 1}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsFixedIoStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsConvertEndDpf
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsFixedIoStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[2] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
-
-
- ACPI_FUNCTION_TRACE ("RsFixedIoStream");
-
-
- /*
- * The descriptor field is static
- */
- *Buffer = 0x4B;
-
- Buffer += 1;
-
- /*
- * Set the Range base address
- */
- Temp16 = (UINT16) LinkedList->Data.FixedIo.BaseAddress;
-
- ACPI_MOVE_16_TO_16 (Buffer, &Temp16);
- Buffer += 2;
-
- /*
- * Set the range length
- */
- Temp8 = (UINT8) LinkedList->Data.FixedIo.RangeLength;
-
- *Buffer = Temp8;
- Buffer += 1;
-
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_DEPENDENT,
+ ACPI_RS_SIZE_MIN,
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndDpf)},
+
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_DEPENDENT,
+ sizeof (AML_RESOURCE_END_DEPENDENT),
+ 0}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsDmaResource
- *
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource input byte
- * stream
- * BytesConsumed - Pointer to where the number of bytes
- * consumed the ByteStreamBuffer is
- * returned
- * OutputBuffer - Pointer to the return data buffer
- * StructureSize - Pointer to where the number of bytes
- * in the return data struct is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the resource byte stream and fill out the appropriate
- * structure pointed to by the OutputBuffer. Return the
- * number of bytes consumed from the byte stream.
+ * AcpiRsConvertEndTag
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsDmaResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize)
+ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[2] =
{
- UINT8 *Buffer = ByteStreamBuffer;
- ACPI_RESOURCE *OutputStruct = (void *) *OutputBuffer;
- UINT8 Temp8 = 0;
- UINT8 Index;
- UINT8 i;
- ACPI_SIZE StructSize = ACPI_SIZEOF_RESOURCE (ACPI_RESOURCE_DMA);
-
-
- ACPI_FUNCTION_TRACE ("RsDmaResource");
-
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_END_TAG,
+ ACPI_RS_SIZE_MIN,
+ ACPI_RSC_TABLE_SIZE (AcpiRsConvertEndTag)},
/*
- * The number of bytes consumed are Constant
- */
- *BytesConsumed = 3;
- OutputStruct->Id = ACPI_RSTYPE_DMA;
+ * Note: The checksum field is set to zero, meaning that the resource
+ * data is treated as if the checksum operation succeeded.
+ * (ACPI Spec 1.0b Section 6.4.2.8)
+ */
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_END_TAG,
+ sizeof (AML_RESOURCE_END_TAG),
+ 0}
+};
- /*
- * Point to the 8-bits of Byte 1
- */
- Buffer += 1;
- Temp8 = *Buffer;
- /* Decode the DMA channel bits */
+/*******************************************************************************
+ *
+ * AcpiRsGetStartDpf
+ *
+ ******************************************************************************/
- for (i = 0, Index = 0; Index < 8; Index++)
- {
- if ((Temp8 >> Index) & 0x01)
- {
- OutputStruct->Data.Dma.Channels[i] = Index;
- i++;
- }
- }
-
- /* Zero DMA channels is valid */
-
- OutputStruct->Data.Dma.NumberOfChannels = i;
- if (i > 0)
- {
- /*
- * Calculate the structure size based upon the number of interrupts
- */
- StructSize += ((ACPI_SIZE) i - 1) * 4;
- }
+ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[5] =
+{
+ {ACPI_RSC_INITGET, ACPI_RESOURCE_TYPE_START_DEPENDENT,
+ ACPI_RS_SIZE (ACPI_RESOURCE_START_DEPENDENT),
+ ACPI_RSC_TABLE_SIZE (AcpiRsGetStartDpf)},
- /*
- * Point to Byte 2
- */
- Buffer += 1;
- Temp8 = *Buffer;
+ /* Defaults for Compatibility and Performance priorities */
- /*
- * Check for transfer preference (Bits[1:0])
- */
- OutputStruct->Data.Dma.Transfer = Temp8 & 0x03;
+ {ACPI_RSC_SET8, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
+ ACPI_ACCEPTABLE_CONFIGURATION,
+ 2},
- if (0x03 == OutputStruct->Data.Dma.Transfer)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid DMA.Transfer preference (3)\n"));
- return_ACPI_STATUS (AE_BAD_DATA);
- }
+ /* All done if there is no flag byte present in the descriptor */
- /*
- * Get bus master preference (Bit[2])
- */
- OutputStruct->Data.Dma.BusMaster = (Temp8 >> 2) & 0x01;
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_AML_LENGTH, 0, 1},
- /*
- * Get channel speed support (Bits[6:5])
- */
- OutputStruct->Data.Dma.Type = (Temp8 >> 5) & 0x03;
+ /* Flag byte is present, get the flags */
- /*
- * Set the Length parameter
- */
- OutputStruct->Length = (UINT32) StructSize;
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
+ AML_OFFSET (StartDpf.Flags),
+ 0},
- /*
- * Return the final size of the structure
- */
- *StructureSize = StructSize;
- return_ACPI_STATUS (AE_OK);
-}
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
+ AML_OFFSET (StartDpf.Flags),
+ 2}
+};
/*******************************************************************************
*
- * FUNCTION: AcpiRsDmaStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * OutputBuffer - Pointer to the user's return buffer
- * BytesConsumed - Pointer to where the number of bytes
- * used in the OutputBuffer is returned
- *
- * RETURN: Status
- *
- * DESCRIPTION: Take the linked list resource structure and fills in the
- * the appropriate bytes in a byte stream
+ * AcpiRsSetStartDpf
*
******************************************************************************/
-ACPI_STATUS
-AcpiRsDmaStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed)
+ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[6] =
{
- UINT8 *Buffer = *OutputBuffer;
- UINT16 Temp16 = 0;
- UINT8 Temp8 = 0;
- UINT8 Index;
-
+ {ACPI_RSC_INITSET, ACPI_RESOURCE_NAME_START_DEPENDENT,
+ sizeof (AML_RESOURCE_START_DEPENDENT),
+ ACPI_RSC_TABLE_SIZE (AcpiRsSetStartDpf)},
- ACPI_FUNCTION_TRACE ("RsDmaStream");
+ /* Set the default flag values */
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
+ AML_OFFSET (StartDpf.Flags),
+ 0},
+ {ACPI_RSC_2BITFLAG, ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
+ AML_OFFSET (StartDpf.Flags),
+ 2},
/*
- * The descriptor field is static
+ * All done if flags byte is necessary -- if either priority value
+ * is not ACPI_ACCEPTABLE_CONFIGURATION
*/
- *Buffer = 0x2A;
- Buffer += 1;
- Temp8 = 0;
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET (Data.StartDpf.CompatibilityPriority),
+ ACPI_ACCEPTABLE_CONFIGURATION},
- /*
- * Loop through all of the Channels and set the mask bits
- */
- for (Index = 0;
- Index < LinkedList->Data.Dma.NumberOfChannels;
- Index++)
- {
- Temp16 = (UINT16) LinkedList->Data.Dma.Channels[Index];
- Temp8 |= 0x1 << Temp16;
- }
+ {ACPI_RSC_EXIT_NE, ACPI_RSC_COMPARE_VALUE,
+ ACPI_RS_OFFSET (Data.StartDpf.PerformanceRobustness),
+ ACPI_ACCEPTABLE_CONFIGURATION},
- *Buffer = Temp8;
- Buffer += 1;
+ /* Flag byte is not necessary */
- /*
- * Set the DMA Info
- */
- Temp8 = (UINT8) ((LinkedList->Data.Dma.Type & 0x03) << 5);
- Temp8 |= ((LinkedList->Data.Dma.BusMaster & 0x01) << 2);
- Temp8 |= (LinkedList->Data.Dma.Transfer & 0x03);
-
- *Buffer = Temp8;
- Buffer += 1;
+ {ACPI_RSC_LENGTH, 0, 0, sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO)}
+};
- /*
- * Return the number of bytes consumed in this operation
- */
- *BytesConsumed = ACPI_PTR_DIFF (Buffer, *OutputBuffer);
- return_ACPI_STATUS (AE_OK);
-}
Index: exnames.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exnames.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exnames.c -L sys/contrib/dev/acpica/exnames.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exnames.c
+++ sys/contrib/dev/acpica/exnames.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exnames - interpreter/scanner name load/execute
- * $Revision: 95 $
+ * $Revision: 1.111 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,13 +124,17 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exnames")
+/* Local prototypes */
-/* AML Package Length encodings */
+static char *
+AcpiExAllocateNameString (
+ UINT32 PrefixCount,
+ UINT32 NumNameSegs);
-#define ACPI_AML_PACKAGE_TYPE1 0x40
-#define ACPI_AML_PACKAGE_TYPE2 0x4000
-#define ACPI_AML_PACKAGE_TYPE3 0x400000
-#define ACPI_AML_PACKAGE_TYPE4 0x40000000
+static ACPI_STATUS
+AcpiExNameSegment (
+ UINT8 **InAmlAddress,
+ char *NameString);
/*******************************************************************************
@@ -138,7 +142,7 @@
* FUNCTION: AcpiExAllocateNameString
*
* PARAMETERS: PrefixCount - Count of parent levels. Special cases:
- * (-1) = root, 0 = none
+ * (-1)==root, 0==none
* NumNameSegs - count of 4-character name segments
*
* RETURN: A pointer to the allocated string segment. This segment must
@@ -149,7 +153,7 @@
*
******************************************************************************/
-char *
+static char *
AcpiExAllocateNameString (
UINT32 PrefixCount,
UINT32 NumNameSegs)
@@ -158,11 +162,11 @@
char *NameString;
UINT32 SizeNeeded;
- ACPI_FUNCTION_TRACE ("ExAllocateNameString");
+ ACPI_FUNCTION_TRACE (ExAllocateNameString);
/*
- * Allow room for all \ and ^ prefixes, all segments, and a MultiNamePrefix.
+ * Allow room for all \ and ^ prefixes, all segments and a MultiNamePrefix.
* Also, one byte for the null terminator.
* This may actually be somewhat longer than needed.
*/
@@ -181,10 +185,11 @@
* Allocate a buffer for the name.
* This buffer must be deleted by the caller!
*/
- NameString = ACPI_MEM_ALLOCATE (SizeNeeded);
+ NameString = ACPI_ALLOCATE (SizeNeeded);
if (!NameString)
{
- ACPI_REPORT_ERROR (("ExAllocateNameString: Could not allocate size %d\n", SizeNeeded));
+ ACPI_ERROR ((AE_INFO,
+ "Could not allocate size %d", SizeNeeded));
return_PTR (NULL);
}
@@ -234,15 +239,17 @@
*
* FUNCTION: AcpiExNameSegment
*
- * PARAMETERS: InterpreterMode - Current running mode (load1/Load2/Exec)
+ * PARAMETERS: InAmlAddress - Pointer to the name in the AML code
+ * NameString - Where to return the name. The name is appended
+ * to any existing string to form a namepath
*
* RETURN: Status
*
- * DESCRIPTION: Execute a name segment (4 bytes)
+ * DESCRIPTION: Extract an ACPI name (4 bytes) from the AML byte stream
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExNameSegment (
UINT8 **InAmlAddress,
char *NameString)
@@ -253,7 +260,7 @@
char CharBuf[5];
- ACPI_FUNCTION_TRACE ("ExNameSegment");
+ ACPI_FUNCTION_TRACE (ExNameSegment);
/*
@@ -264,14 +271,14 @@
if ('0' <= CharBuf[0] && CharBuf[0] <= '9')
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "leading digit: %c\n", CharBuf[0]));
+ ACPI_ERROR ((AE_INFO, "Invalid leading digit: %c", CharBuf[0]));
return_ACPI_STATUS (AE_CTRL_PENDING);
}
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Bytes from stream:\n"));
for (Index = 0;
- (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiCharacter (*AmlAddress));
+ (Index < ACPI_NAME_SIZE) && (AcpiUtValidAcpiChar (*AmlAddress, 0));
Index++)
{
CharBuf[Index] = *AmlAddress++;
@@ -291,12 +298,12 @@
{
ACPI_STRCAT (NameString, CharBuf);
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "Appended to - %s \n", NameString));
+ "Appended to - %s\n", NameString));
}
else
{
ACPI_DEBUG_PRINT ((ACPI_DB_NAMES,
- "No Name string - %s \n", CharBuf));
+ "No Name string - %s\n", CharBuf));
}
}
else if (Index == 0)
@@ -312,14 +319,17 @@
}
else
{
- /* Segment started with one or more valid characters, but fewer than 4 */
-
+ /*
+ * Segment started with one or more valid characters, but fewer than
+ * the required 4
+ */
Status = AE_AML_BAD_NAME;
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad character %02x in name, at %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Bad character %02x in name, at %p",
*AmlAddress, AmlAddress));
}
- *InAmlAddress = (UINT8 *) AmlAddress;
+ *InAmlAddress = ACPI_CAST_PTR (UINT8, AmlAddress);
return_ACPI_STATUS (Status);
}
@@ -328,11 +338,16 @@
*
* FUNCTION: AcpiExGetNameString
*
- * PARAMETERS: DataType - Data type to be associated with this name
+ * PARAMETERS: DataType - Object type to be associated with this
+ * name
+ * InAmlAddress - Pointer to the namestring in the AML code
+ * OutNameString - Where the namestring is returned
+ * OutNameLength - Length of the returned string
*
- * RETURN: Status
+ * RETURN: Status, namestring and length
*
- * DESCRIPTION: Get a name, including any prefixes.
+ * DESCRIPTION: Extract a full namepath from the AML byte stream,
+ * including any prefixes.
*
******************************************************************************/
@@ -351,7 +366,7 @@
BOOLEAN HasPrefix = FALSE;
- ACPI_FUNCTION_TRACE_PTR ("ExGetNameString", AmlAddress);
+ ACPI_FUNCTION_TRACE_PTR (ExGetNameString, AmlAddress);
if (ACPI_TYPE_LOCAL_REGION_FIELD == DataType ||
@@ -380,7 +395,8 @@
{
case AML_ROOT_PREFIX:
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n", AmlAddress));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "RootPrefix(\\) at %p\n",
+ AmlAddress));
/*
* Remember that we have a RootPrefix --
@@ -398,7 +414,8 @@
do
{
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n", AmlAddress));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "ParentPrefix (^) at %p\n",
+ AmlAddress));
AmlAddress++;
PrefixCount++;
@@ -416,14 +433,14 @@
break;
}
-
/* Examine first character of name for name segment prefix operator */
switch (*AmlAddress)
{
case AML_DUAL_NAME_PREFIX:
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n", AmlAddress));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "DualNamePrefix at %p\n",
+ AmlAddress));
AmlAddress++;
NameString = AcpiExAllocateNameString (PrefixCount, 2);
@@ -447,7 +464,8 @@
case AML_MULTI_NAME_PREFIX_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n", AmlAddress));
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "MultiNamePrefix at %p\n",
+ AmlAddress));
/* Fetch count of segments remaining in name path */
@@ -467,7 +485,8 @@
HasPrefix = TRUE;
while (NumSegments &&
- (Status = AcpiExNameSegment (&AmlAddress, NameString)) == AE_OK)
+ (Status = AcpiExNameSegment (&AmlAddress, NameString)) ==
+ AE_OK)
{
NumSegments--;
}
@@ -481,7 +500,8 @@
if (PrefixCount == ACPI_UINT32_MAX)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "NameSeg is \"\\\" followed by NULL\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "NameSeg is \"\\\" followed by NULL\n"));
}
/* Consume the NULL byte */
@@ -517,11 +537,20 @@
{
/* Ran out of segments after processing a prefix */
- ACPI_REPORT_ERROR (
- ("ExDoName: Malformed Name at %p\n", NameString));
+ ACPI_ERROR ((AE_INFO,
+ "Malformed Name at %p", NameString));
Status = AE_AML_BAD_NAME;
}
+ if (ACPI_FAILURE (Status))
+ {
+ if (NameString)
+ {
+ ACPI_FREE (NameString);
+ }
+ return_ACPI_STATUS (Status);
+ }
+
*OutNameString = NameString;
*OutNameLength = (UINT32) (AmlAddress - InAmlAddress);
Index: exresolv.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exresolv.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exresolv.c -L sys/contrib/dev/acpica/exresolv.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exresolv.c
+++ sys/contrib/dev/acpica/exresolv.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresolv - AML Interpreter object resolution
- * $Revision: 125 $
+ * $Revision: 1.142 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,6 +128,13 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exresolv")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiExResolveObjectToValue (
+ ACPI_OPERAND_OBJECT **StackPtr,
+ ACPI_WALK_STATE *WalkState);
+
/*******************************************************************************
*
@@ -152,12 +159,12 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExResolveToValue", StackPtr);
+ ACPI_FUNCTION_TRACE_PTR (ExResolveToValue, StackPtr);
if (!StackPtr || !*StackPtr)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Internal - null pointer\n"));
+ ACPI_ERROR ((AE_INFO, "Internal - null pointer"));
return_ACPI_STATUS (AE_AML_NO_OPERAND);
}
@@ -173,6 +180,12 @@
{
return_ACPI_STATUS (Status);
}
+
+ if (!*StackPtr)
+ {
+ ACPI_ERROR ((AE_INFO, "Internal - null pointer"));
+ return_ACPI_STATUS (AE_AML_NO_OPERAND);
+ }
}
/*
@@ -199,30 +212,28 @@
*
* FUNCTION: AcpiExResolveObjectToValue
*
- * PARAMETERS: StackPtr - Pointer to a stack location that contains a
- * ptr to an internal object.
+ * PARAMETERS: StackPtr - Pointer to an internal object
* WalkState - Current method state
*
* RETURN: Status
*
- * DESCRIPTION: Retrieve the value from an internal object. The Reference type
+ * DESCRIPTION: Retrieve the value from an internal object. The Reference type
* uses the associated AML opcode to determine the value.
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExResolveObjectToValue (
ACPI_OPERAND_OBJECT **StackPtr,
ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *StackDesc;
- void *TempNode;
- ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT *ObjDesc = NULL;
UINT16 Opcode;
- ACPI_FUNCTION_TRACE ("ExResolveObjectToValue");
+ ACPI_FUNCTION_TRACE (ExResolveObjectToValue);
StackDesc = *StackPtr;
@@ -237,24 +248,6 @@
switch (Opcode)
{
- case AML_NAME_OP:
-
- /*
- * Convert indirect name ptr to a direct name ptr.
- * Then, AcpiExResolveNodeToValue can be used to get the value
- */
- TempNode = StackDesc->Reference.Object;
-
- /* Delete the Reference Object */
-
- AcpiUtRemoveReference (StackDesc);
-
- /* Put direct name pointer onto stack and exit */
-
- (*StackPtr) = TempNode;
- break;
-
-
case AML_LOCAL_OP:
case AML_ARG_OP:
@@ -311,8 +304,8 @@
* A NULL object descriptor means an unitialized element of
* the package, can't dereference it
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Attempt to deref an Index to NULL pkg element Idx=%p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Attempt to deref an Index to NULL pkg element Idx=%p",
StackDesc));
Status = AE_AML_UNINITIALIZED_ELEMENT;
}
@@ -323,8 +316,8 @@
/* Invalid reference object */
- ACPI_REPORT_ERROR ((
- "During resolve, Unknown TargetType %X in Index/Reference obj %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown TargetType %X in Index/Reference obj %p",
StackDesc->Reference.TargetType, StackDesc));
Status = AE_AML_INTERNAL;
break;
@@ -340,10 +333,32 @@
break;
+ case AML_INT_NAMEPATH_OP: /* Reference to a named object */
+
+ /* Dereference the name */
+
+ if ((StackDesc->Reference.Node->Type == ACPI_TYPE_DEVICE) ||
+ (StackDesc->Reference.Node->Type == ACPI_TYPE_THERMAL))
+ {
+ /* These node types do not have 'real' subobjects */
+
+ *StackPtr = (void *) StackDesc->Reference.Node;
+ }
+ else
+ {
+ /* Get the object pointed to by the namespace node */
+
+ *StackPtr = (StackDesc->Reference.Node)->Object;
+ AcpiUtAddReference (*StackPtr);
+ }
+
+ AcpiUtRemoveReference (StackDesc);
+ break;
default:
- ACPI_REPORT_ERROR (("During resolve, Unknown Reference opcode %X (%s) in %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Reference opcode %X (%s) in %p",
Opcode, AcpiPsGetOpcodeName (Opcode), StackDesc));
Status = AE_AML_INTERNAL;
break;
@@ -363,9 +378,6 @@
break;
- /*
- * These cases may never happen here, but just in case..
- */
case ACPI_TYPE_BUFFER_FIELD:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
@@ -375,6 +387,10 @@
StackDesc, ACPI_GET_OBJECT_TYPE (StackDesc)));
Status = AcpiExReadDataFromField (WalkState, StackDesc, &ObjDesc);
+
+ /* Remove a reference to the original operand, then override */
+
+ AcpiUtRemoveReference (*StackPtr);
*StackPtr = (void *) ObjDesc;
break;
@@ -415,13 +431,11 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiExResolveMultiple");
+ ACPI_FUNCTION_TRACE (AcpiExResolveMultiple);
+ /* Operand can be either a namespace node or an operand descriptor */
- /*
- * Operand can be either a namespace node or an operand descriptor
- */
switch (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc))
{
case ACPI_DESC_TYPE_OPERAND:
@@ -445,10 +459,8 @@
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
+ /* If type is anything other than a reference, we are done */
- /*
- * If type is anything other than a reference, we are done
- */
if (Type != ACPI_TYPE_LOCAL_REFERENCE)
{
goto Exit;
@@ -465,17 +477,26 @@
switch (ObjDesc->Reference.Opcode)
{
case AML_REF_OF_OP:
+ case AML_INT_NAMEPATH_OP:
/* Dereference the reference pointer */
- Node = ObjDesc->Reference.Object;
+ if (ObjDesc->Reference.Opcode == AML_REF_OF_OP)
+ {
+ Node = ObjDesc->Reference.Object;
+ }
+ else /* AML_INT_NAMEPATH_OP */
+ {
+ Node = ObjDesc->Reference.Node;
+ }
/* All "References" point to a NS node */
if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
- ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Not a NS node %p [%s]\n",
- Node, AcpiUtGetDescriptorName (Node)));
+ ACPI_ERROR ((AE_INFO,
+ "Not a NS node %p [%s]",
+ Node, AcpiUtGetDescriptorName (Node)));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
@@ -517,41 +538,13 @@
* This could of course in turn be another reference object.
*/
ObjDesc = *(ObjDesc->Reference.Where);
- break;
-
-
- case AML_INT_NAMEPATH_OP:
-
- /* Dereference the reference pointer */
-
- Node = ObjDesc->Reference.Node;
-
- /* All "References" point to a NS node */
-
- if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
- {
- ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Not a NS node %p [%s]\n",
- Node, AcpiUtGetDescriptorName (Node)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /* Get the attached object */
-
- ObjDesc = AcpiNsGetAttachedObject (Node);
if (!ObjDesc)
{
- /* No object, use the NS node type */
+ /* NULL package elements are allowed */
- Type = AcpiNsGetType (Node);
+ Type = 0; /* Uninitialized */
goto Exit;
}
-
- /* Check for circular references */
-
- if (ObjDesc == Operand)
- {
- return_ACPI_STATUS (AE_AML_CIRCULAR_REFERENCE);
- }
break;
@@ -561,7 +554,7 @@
if (ReturnDesc)
{
Status = AcpiDsMethodDataGetValue (ObjDesc->Reference.Opcode,
- ObjDesc->Reference.Offset, WalkState, &ObjDesc);
+ ObjDesc->Reference.Offset, WalkState, &ObjDesc);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -597,7 +590,8 @@
default:
- ACPI_REPORT_ERROR (("AcpiExResolveMultiple: Unknown Reference subtype %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Unknown Reference subtype %X",
ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
Index: nsxfeval.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsxfeval.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsxfeval.c -L sys/contrib/dev/acpica/nsxfeval.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsxfeval.c
+++ sys/contrib/dev/acpica/nsxfeval.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfeval - Public interfaces to the ACPI subsystem
* ACPI Object evaluation interfaces
- * $Revision: 14 $
+ * $Revision: 1.30 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -132,11 +132,11 @@
* FUNCTION: AcpiEvaluateObjectTyped
*
* PARAMETERS: Handle - Object handle (optional)
- * *Pathname - Object pathname (optional)
- * **ExternalParams - List of parameters to pass to method,
+ * Pathname - Object pathname (optional)
+ * ExternalParams - List of parameters to pass to method,
* terminated by NULL. May be NULL
* if no parameters are being passed.
- * *ReturnBuffer - Where to put method's return value (if
+ * ReturnBuffer - Where to put method's return value (if
* any). If NULL, no value is returned.
* ReturnType - Expected type of return object
*
@@ -160,7 +160,7 @@
BOOLEAN MustFree = FALSE;
- ACPI_FUNCTION_TRACE ("AcpiEvaluateObjectTyped");
+ ACPI_FUNCTION_TRACE (AcpiEvaluateObjectTyped);
/* Return buffer must be valid */
@@ -194,9 +194,7 @@
{
/* Error because caller specifically asked for a return value */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No return value\n"));
-
+ ACPI_ERROR ((AE_INFO, "No return value"));
return_ACPI_STATUS (AE_NULL_OBJECT);
}
@@ -209,8 +207,8 @@
/* Return object type does not match requested type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Incorrect return type [%s] requested [%s]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Incorrect return type [%s] requested [%s]",
AcpiUtGetTypeName (((ACPI_OBJECT *) ReturnBuffer->Pointer)->Type),
AcpiUtGetTypeName (ReturnType)));
@@ -226,6 +224,8 @@
return_ACPI_STATUS (AE_TYPE);
}
+ACPI_EXPORT_SYMBOL (AcpiEvaluateObjectTyped)
+
/*******************************************************************************
*
@@ -255,24 +255,37 @@
ACPI_BUFFER *ReturnBuffer)
{
ACPI_STATUS Status;
- ACPI_STATUS Status2;
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
ACPI_SIZE BufferSpaceNeeded;
UINT32 i;
- ACPI_FUNCTION_TRACE ("AcpiEvaluateObject");
+ ACPI_FUNCTION_TRACE (AcpiEvaluateObject);
+
+
+ /* Allocate and initialize the evaluation information block */
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->Pathname = Pathname;
+ Info->ParameterType = ACPI_PARAM_ARGS;
+
+ /* Convert and validate the device handle */
- Info.Node = Handle;
- Info.Parameters = NULL;
- Info.ReturnObject = NULL;
- Info.ParameterType = ACPI_PARAM_ARGS;
+ Info->PrefixNode = AcpiNsMapHandleToNode (Handle);
+ if (!Info->PrefixNode)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto Cleanup;
+ }
/*
- * If there are parameters to be passed to the object
- * (which must be a control method), the external objects
- * must be converted to internal objects
+ * If there are parameters to be passed to a control method, the external
+ * objects must all be converted to internal objects
*/
if (ExternalParams && ExternalParams->Count)
{
@@ -280,32 +293,28 @@
* Allocate a new parameter block for the internal objects
* Add 1 to count to allow for null terminated internal list
*/
- Info.Parameters = ACPI_MEM_CALLOCATE (
- ((ACPI_SIZE) ExternalParams->Count + 1) *
- sizeof (void *));
- if (!Info.Parameters)
+ Info->Parameters = ACPI_ALLOCATE_ZEROED (
+ ((ACPI_SIZE) ExternalParams->Count + 1) * sizeof (void *));
+ if (!Info->Parameters)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
}
- /*
- * Convert each external object in the list to an
- * internal object
- */
+ /* Convert each external object in the list to an internal object */
+
for (i = 0; i < ExternalParams->Count; i++)
{
- Status = AcpiUtCopyEobjectToIobject (&ExternalParams->Pointer[i],
- &Info.Parameters[i]);
+ Status = AcpiUtCopyEobjectToIobject (
+ &ExternalParams->Pointer[i], &Info->Parameters[i]);
if (ACPI_FAILURE (Status))
{
- AcpiUtDeleteInternalObjectList (Info.Parameters);
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
}
- Info.Parameters[ExternalParams->Count] = NULL;
+ Info->Parameters[ExternalParams->Count] = NULL;
}
-
/*
* Three major cases:
* 1) Fully qualified pathname
@@ -315,55 +324,37 @@
if ((Pathname) &&
(AcpiNsValidRootPrefix (Pathname[0])))
{
- /*
- * The path is fully qualified, just evaluate by name
- */
- Status = AcpiNsEvaluateByName (Pathname, &Info);
+ /* The path is fully qualified, just evaluate by name */
+
+ Info->PrefixNode = NULL;
+ Status = AcpiNsEvaluate (Info);
}
else if (!Handle)
{
/*
- * A handle is optional iff a fully qualified pathname
- * is specified. Since we've already handled fully
- * qualified names above, this is an error
+ * A handle is optional iff a fully qualified pathname is specified.
+ * Since we've already handled fully qualified names above, this is
+ * an error
*/
if (!Pathname)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Both Handle and Pathname are NULL\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Both Handle and Pathname are NULL"));
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Handle is NULL and Pathname is relative\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Null Handle with relative pathname [%s]", Pathname));
}
Status = AE_BAD_PARAMETER;
}
else
{
- /*
- * We get here if we have a handle -- and if we have a
- * pathname it is relative. The handle will be validated
- * in the lower procedures
- */
- if (!Pathname)
- {
- /*
- * The null pathname case means the handle is for
- * the actual object to be evaluated
- */
- Status = AcpiNsEvaluateByHandle (&Info);
- }
- else
- {
- /*
- * Both a Handle and a relative Pathname
- */
- Status = AcpiNsEvaluateRelative (Pathname, &Info);
- }
- }
+ /* We have a namespace a node and a possible relative path */
+ Status = AcpiNsEvaluate (Info);
+ }
/*
* If we are expecting a return value, and all went well above,
@@ -371,13 +362,14 @@
*/
if (ReturnBuffer)
{
- if (!Info.ReturnObject)
+ if (!Info->ReturnObject)
{
ReturnBuffer->Length = 0;
}
else
{
- if (ACPI_GET_DESCRIPTOR_TYPE (Info.ReturnObject) == ACPI_DESC_TYPE_NAMED)
+ if (ACPI_GET_DESCRIPTOR_TYPE (Info->ReturnObject) ==
+ ACPI_DESC_TYPE_NAMED)
{
/*
* If we received a NS Node as a return object, this means that
@@ -388,27 +380,27 @@
* support for various types at a later date if necessary.
*/
Status = AE_TYPE;
- Info.ReturnObject = NULL; /* No need to delete a NS Node */
+ Info->ReturnObject = NULL; /* No need to delete a NS Node */
ReturnBuffer->Length = 0;
}
if (ACPI_SUCCESS (Status))
{
- /*
- * Find out how large a buffer is needed
- * to contain the returned object
- */
- Status = AcpiUtGetObjectSize (Info.ReturnObject,
- &BufferSpaceNeeded);
+ /* Get the size of the returned object */
+
+ Status = AcpiUtGetObjectSize (Info->ReturnObject,
+ &BufferSpaceNeeded);
if (ACPI_SUCCESS (Status))
{
/* Validate/Allocate/Clear caller buffer */
- Status = AcpiUtInitializeBuffer (ReturnBuffer, BufferSpaceNeeded);
+ Status = AcpiUtInitializeBuffer (ReturnBuffer,
+ BufferSpaceNeeded);
if (ACPI_FAILURE (Status))
{
/*
- * Caller's buffer is too small or a new one can't be allocated
+ * Caller's buffer is too small or a new one can't
+ * be allocated
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Needed buffer size %X, %s\n",
@@ -417,48 +409,48 @@
}
else
{
- /*
- * We have enough space for the object, build it
- */
- Status = AcpiUtCopyIobjectToEobject (Info.ReturnObject,
- ReturnBuffer);
+ /* We have enough space for the object, build it */
+
+ Status = AcpiUtCopyIobjectToEobject (Info->ReturnObject,
+ ReturnBuffer);
}
}
}
}
}
- if (Info.ReturnObject)
+ if (Info->ReturnObject)
{
/*
- * Delete the internal return object. NOTE: Interpreter
- * must be locked to avoid race condition.
+ * Delete the internal return object. NOTE: Interpreter must be
+ * locked to avoid race condition.
*/
- Status2 = AcpiExEnterInterpreter ();
- if (ACPI_SUCCESS (Status2))
- {
- /*
- * Delete the internal return object. (Or at least
- * decrement the reference count by one)
- */
- AcpiUtRemoveReference (Info.ReturnObject);
- AcpiExExitInterpreter ();
- }
+ AcpiExEnterInterpreter ();
+
+ /* Remove one reference on the return object (should delete it) */
+
+ AcpiUtRemoveReference (Info->ReturnObject);
+ AcpiExExitInterpreter ();
}
- /*
- * Free the input parameter list (if we created one),
- */
- if (Info.Parameters)
+
+Cleanup:
+
+ /* Free the input parameter list (if we created one) */
+
+ if (Info->Parameters)
{
/* Free the allocated parameter block */
- AcpiUtDeleteInternalObjectList (Info.Parameters);
+ AcpiUtDeleteInternalObjectList (Info->Parameters);
}
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEvaluateObject)
+
/*******************************************************************************
*
@@ -502,13 +494,13 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiWalkNamespace");
+ ACPI_FUNCTION_TRACE (AcpiWalkNamespace);
/* Parameter validation */
- if ((Type > ACPI_TYPE_EXTERNAL_MAX) ||
- (!MaxDepth) ||
+ if ((Type > ACPI_TYPE_LOCAL_MAX) ||
+ (!MaxDepth) ||
(!UserFunction))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -526,13 +518,16 @@
return_ACPI_STATUS (Status);
}
- Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth, ACPI_NS_WALK_UNLOCK,
+ Status = AcpiNsWalkNamespace (Type, StartObject, MaxDepth,
+ ACPI_NS_WALK_UNLOCK,
UserFunction, Context, ReturnValue);
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiWalkNamespace)
+
/*******************************************************************************
*
@@ -590,9 +585,9 @@
return (AE_CTRL_DEPTH);
}
- if (!(Flags & 0x01))
+ if (!(Flags & ACPI_STA_DEVICE_PRESENT))
{
- /* Don't return at the device or children of the device if not there */
+ /* Don't examine children of the device if not present */
return (AE_CTRL_DEPTH);
}
@@ -632,15 +627,16 @@
if (ACPI_STRNCMP (Cid->Id[i].Value, Info->Hid,
sizeof (ACPI_COMPATIBLE_ID)) != 0)
{
- ACPI_MEM_FREE (Cid);
+ ACPI_FREE (Cid);
return (AE_OK);
}
}
- ACPI_MEM_FREE (Cid);
+ ACPI_FREE (Cid);
}
}
- Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context, ReturnValue);
+ Status = Info->UserFunction (ObjHandle, NestingLevel, Info->Context,
+ ReturnValue);
return (Status);
}
@@ -681,7 +677,7 @@
ACPI_GET_DEVICES_INFO Info;
- ACPI_FUNCTION_TRACE ("AcpiGetDevices");
+ ACPI_FUNCTION_TRACE (AcpiGetDevices);
/* Parameter validation */
@@ -695,9 +691,9 @@
* We're going to call their callback from OUR callback, so we need
* to know what it is, and their context parameter.
*/
+ Info.Hid = HID;
Info.Context = Context;
Info.UserFunction = UserFunction;
- Info.Hid = HID;
/*
* Lock the namespace around the walk.
@@ -711,16 +707,16 @@
return_ACPI_STATUS (Status);
}
- Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE,
- ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- ACPI_NS_WALK_UNLOCK,
- AcpiNsGetDeviceCallback, &Info,
- ReturnValue);
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
+ AcpiNsGetDeviceCallback, &Info, ReturnValue);
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetDevices)
+
/*******************************************************************************
*
@@ -777,6 +773,8 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiAttachData)
+
/*******************************************************************************
*
@@ -830,6 +828,8 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDetachData)
+
/*******************************************************************************
*
@@ -886,4 +886,6 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetData)
+
Index: exconfig.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exconfig.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exconfig.c -L sys/contrib/dev/acpica/exconfig.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exconfig.c
+++ sys/contrib/dev/acpica/exconfig.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: exconfig - Namespace reconfiguration (Load/Unload opcodes)
- * $Revision: 79 $
+ * $Revision: 1.103 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -129,6 +129,14 @@
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exconfig")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiExAddTable (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_NAMESPACE_NODE *ParentNode,
+ ACPI_OPERAND_OBJECT **DdbHandle);
+
/*******************************************************************************
*
@@ -145,18 +153,17 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExAddTable (
- ACPI_TABLE_HEADER *Table,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle)
{
ACPI_STATUS Status;
- ACPI_TABLE_DESC TableInfo;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("ExAddTable");
+ ACPI_FUNCTION_TRACE (ExAddTable);
/* Create an object to be the table handle */
@@ -167,42 +174,24 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Install the new table into the local data structures */
+ /* Init the table handle */
- ACPI_MEMSET (&TableInfo, 0, sizeof (ACPI_TABLE_DESC));
+ ObjDesc->Reference.Opcode = AML_LOAD_OP;
+ *DdbHandle = ObjDesc;
- TableInfo.Type = ACPI_TABLE_SSDT;
- TableInfo.Pointer = Table;
- TableInfo.Length = (ACPI_SIZE) Table->Length;
- TableInfo.Allocation = ACPI_MEM_ALLOCATED;
+ /* Install the new table into the local data structures */
- Status = AcpiTbInstallTable (&TableInfo);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
+ ObjDesc->Reference.Object = ACPI_CAST_PTR (void, TableIndex);
/* Add the table to the namespace */
- Status = AcpiNsLoadTable (TableInfo.InstalledDesc, ParentNode);
+ Status = AcpiNsLoadTable (TableIndex, ParentNode);
if (ACPI_FAILURE (Status))
{
- /* Uninstall table on error */
-
- (void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
- goto Cleanup;
+ AcpiUtRemoveReference (ObjDesc);
+ *DdbHandle = NULL;
}
- /* Init the table handle */
-
- ObjDesc->Reference.Opcode = AML_LOAD_OP;
- ObjDesc->Reference.Object = TableInfo.InstalledDesc;
- *DdbHandle = ObjDesc;
- return_ACPI_STATUS (AE_OK);
-
-
-Cleanup:
- AcpiUtRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
}
@@ -216,7 +205,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Load an ACPI table
+ * DESCRIPTION: Load an ACPI table from the RSDT/XSDT
*
******************************************************************************/
@@ -227,35 +216,22 @@
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
- ACPI_TABLE_HEADER *Table;
+ ACPI_NATIVE_UINT TableIndex;
ACPI_NAMESPACE_NODE *ParentNode;
ACPI_NAMESPACE_NODE *StartNode;
ACPI_NAMESPACE_NODE *ParameterNode = NULL;
ACPI_OPERAND_OBJECT *DdbHandle;
+ ACPI_TABLE_HEADER *Table;
- ACPI_FUNCTION_TRACE ("ExLoadTableOp");
-
-
-#if 0
- /*
- * Make sure that the signature does not match one of the tables that
- * is already loaded.
- */
- Status = AcpiTbMatchSignature (Operand[0]->String.Pointer, NULL);
- if (Status == AE_OK)
- {
- /* Signature matched -- don't allow override */
+ ACPI_FUNCTION_TRACE (ExLoadTableOp);
- return_ACPI_STATUS (AE_ALREADY_EXISTS);
- }
-#endif
- /* Find the ACPI table */
+ /* Find the ACPI table in the RSDT/XSDT */
Status = AcpiTbFindTable (Operand[0]->String.Pointer,
Operand[1]->String.Pointer,
- Operand[2]->String.Pointer, &Table);
+ Operand[2]->String.Pointer, &TableIndex);
if (ACPI_FAILURE (Status))
{
if (Status != AE_NOT_FOUND)
@@ -290,8 +266,8 @@
* Find the node referenced by the RootPathString. This is the
* location within the namespace where the table will be loaded.
*/
- Status = AcpiNsGetNodeByPath (Operand[3]->String.Pointer, StartNode,
- ACPI_NS_SEARCH_PARENT, &ParentNode);
+ Status = AcpiNsGetNode (StartNode, Operand[3]->String.Pointer,
+ ACPI_NS_SEARCH_PARENT, &ParentNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -312,11 +288,10 @@
StartNode = ParentNode;
}
- /*
- * Find the node referenced by the ParameterPathString
- */
- Status = AcpiNsGetNodeByPath (Operand[4]->String.Pointer, StartNode,
- ACPI_NS_SEARCH_PARENT, &ParameterNode);
+ /* Find the node referenced by the ParameterPathString */
+
+ Status = AcpiNsGetNode (StartNode, Operand[4]->String.Pointer,
+ ACPI_NS_SEARCH_PARENT, &ParameterNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -325,7 +300,7 @@
/* Load the table into the namespace */
- Status = AcpiExAddTable (Table, ParentNode, &DdbHandle);
+ Status = AcpiExAddTable (TableIndex, ParentNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -337,8 +312,9 @@
{
/* Store the parameter data into the optional parameter object */
- Status = AcpiExStore (Operand[5], ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),
- WalkState);
+ Status = AcpiExStore (Operand[5],
+ ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, ParameterNode),
+ WalkState);
if (ACPI_FAILURE (Status))
{
(void) AcpiExUnloadTable (DdbHandle);
@@ -346,6 +322,14 @@
}
}
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_SUCCESS (Status))
+ {
+ ACPI_INFO ((AE_INFO,
+ "Dynamic OEM Table Load - [%4.4s] OemId [%6.6s] OemTableId [%8.8s]",
+ Table->Signature, Table->OemId, Table->OemTableId));
+ }
+
*ReturnDesc = DdbHandle;
return_ACPI_STATUS (Status);
}
@@ -355,7 +339,7 @@
*
* FUNCTION: AcpiExLoadOp
*
- * PARAMETERS: ObjDesc - Region or Field where the table will be
+ * PARAMETERS: ObjDesc - Region or Buffer/Field where the table will be
* obtained
* Target - Where a handle to the table will be stored
* WalkState - Current state
@@ -364,6 +348,12 @@
*
* DESCRIPTION: Load an ACPI table from a field or operation region
*
+ * NOTE: Region Fields (Field, BankField, IndexFields) are resolved to buffer
+ * objects before this code is reached.
+ *
+ * If source is an operation region, it must refer to SystemMemory, as
+ * per the ACPI specification.
+ *
******************************************************************************/
ACPI_STATUS
@@ -372,23 +362,31 @@
ACPI_OPERAND_OBJECT *Target,
ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *DdbHandle;
- ACPI_OPERAND_OBJECT *BufferDesc = NULL;
- ACPI_TABLE_HEADER *TablePtr = NULL;
- ACPI_PHYSICAL_ADDRESS Address;
- ACPI_TABLE_HEADER TableHeader;
- UINT32 i;
+ ACPI_TABLE_DESC TableDesc;
+ ACPI_NATIVE_UINT TableIndex;
+ ACPI_STATUS Status;
+
- ACPI_FUNCTION_TRACE ("ExLoadOp");
+ ACPI_FUNCTION_TRACE (ExLoadOp);
- /* Object can be either an OpRegion or a Field */
+ ACPI_MEMSET (&TableDesc, 0, sizeof (ACPI_TABLE_DESC));
+ TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
+
+ /* Source Object can be either an OpRegion or a Buffer/Field */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
case ACPI_TYPE_REGION:
+ /* Region must be SystemMemory (from ACPI spec) */
+
+ if (ObjDesc->Region.SpaceId != ACPI_ADR_SPACE_SYSTEM_MEMORY)
+ {
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Region %p %s\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
@@ -405,109 +403,45 @@
}
}
- /* Get the base physical address of the region */
-
- Address = ObjDesc->Region.Address;
-
- /* Get the table length from the table header */
-
- TableHeader.Length = 0;
- for (i = 0; i < 8; i++)
- {
- Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
- (ACPI_PHYSICAL_ADDRESS) (i + Address), 8,
- ((UINT8 *) &TableHeader) + i);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
- /* Sanity check the table length */
-
- if (TableHeader.Length < sizeof (ACPI_TABLE_HEADER))
- {
- return_ACPI_STATUS (AE_BAD_HEADER);
- }
-
- /* Allocate a buffer for the entire table */
-
- TablePtr = ACPI_MEM_ALLOCATE (TableHeader.Length);
- if (!TablePtr)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Get the entire table from the op region */
-
- for (i = 0; i < TableHeader.Length; i++)
- {
- Status = AcpiEvAddressSpaceDispatch (ObjDesc, ACPI_READ,
- (ACPI_PHYSICAL_ADDRESS) (i + Address), 8,
- ((UINT8 *) TablePtr + i));
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
- }
+ TableDesc.Address = ObjDesc->Region.Address;
+ TableDesc.Length = ObjDesc->Region.Length;
+ TableDesc.Flags = ACPI_TABLE_ORIGIN_MAPPED;
break;
+ case ACPI_TYPE_BUFFER: /* Buffer or resolved RegionField */
- case ACPI_TYPE_LOCAL_REGION_FIELD:
- case ACPI_TYPE_LOCAL_BANK_FIELD:
- case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ /* Simply extract the buffer from the buffer object */
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Field %p %s\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Load from Buffer or Field %p %s\n",
ObjDesc, AcpiUtGetObjectTypeName (ObjDesc)));
- /*
- * The length of the field must be at least as large as the table.
- * Read the entire field and thus the entire table. Buffer is
- * allocated during the read.
- */
- Status = AcpiExReadDataFromField (WalkState, ObjDesc, &BufferDesc);
- if (ACPI_FAILURE (Status))
- {
- goto Cleanup;
- }
-
- TablePtr = ACPI_CAST_PTR (ACPI_TABLE_HEADER, BufferDesc->Buffer.Pointer);
+ TableDesc.Pointer = ACPI_CAST_PTR (ACPI_TABLE_HEADER,
+ ObjDesc->Buffer.Pointer);
+ TableDesc.Length = TableDesc.Pointer->Length;
+ TableDesc.Flags = ACPI_TABLE_ORIGIN_ALLOCATED;
- /* Sanity check the table length */
-
- if (TablePtr->Length < sizeof (ACPI_TABLE_HEADER))
- {
- return_ACPI_STATUS (AE_BAD_HEADER);
- }
+ ObjDesc->Buffer.Pointer = NULL;
break;
-
default:
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
- /* The table must be either an SSDT or a PSDT */
-
- if ((!ACPI_STRNCMP (TablePtr->Signature,
- AcpiGbl_TableData[ACPI_TABLE_PSDT].Signature,
- AcpiGbl_TableData[ACPI_TABLE_PSDT].SigLength)) &&
- (!ACPI_STRNCMP (TablePtr->Signature,
- AcpiGbl_TableData[ACPI_TABLE_SSDT].Signature,
- AcpiGbl_TableData[ACPI_TABLE_SSDT].SigLength)))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Table has invalid signature [%4.4s], must be SSDT or PSDT\n",
- TablePtr->Signature));
- Status = AE_BAD_SIGNATURE;
+ /*
+ * Install the new table into the local data structures
+ */
+ Status = AcpiTbAddTable (&TableDesc, &TableIndex);
+ if (ACPI_FAILURE (Status))
+ {
goto Cleanup;
}
- /* Install the new table into the local data structures */
-
- Status = AcpiExAddTable (TablePtr, AcpiGbl_RootNode, &DdbHandle);
+ Status = AcpiExAddTable (TableIndex, AcpiGbl_RootNode, &DdbHandle);
if (ACPI_FAILURE (Status))
{
- goto Cleanup;
+ /* On error, TablePtr was deallocated above */
+
+ return_ACPI_STATUS (Status);
}
/* Store the DdbHandle into the Target operand */
@@ -516,20 +450,16 @@
if (ACPI_FAILURE (Status))
{
(void) AcpiExUnloadTable (DdbHandle);
- }
- return_ACPI_STATUS (Status);
+ /* TablePtr was deallocated above */
+ return_ACPI_STATUS (Status);
+ }
Cleanup:
-
- if (BufferDesc)
- {
- AcpiUtRemoveReference (BufferDesc);
- }
- else
+ if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (TablePtr);
+ AcpiTbDeleteTable (&TableDesc);
}
return_ACPI_STATUS (Status);
}
@@ -553,10 +483,10 @@
{
ACPI_STATUS Status = AE_OK;
ACPI_OPERAND_OBJECT *TableDesc = DdbHandle;
- ACPI_TABLE_DESC *TableInfo;
+ ACPI_NATIVE_UINT TableIndex;
- ACPI_FUNCTION_TRACE ("ExUnloadTable");
+ ACPI_FUNCTION_TRACE (ExUnloadTable);
/*
@@ -572,19 +502,18 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /* Get the actual table descriptor from the DdbHandle */
+ /* Get the table index from the DdbHandle */
- TableInfo = (ACPI_TABLE_DESC *) TableDesc->Reference.Object;
+ TableIndex = (ACPI_NATIVE_UINT) TableDesc->Reference.Object;
/*
* Delete the entire namespace under this table Node
* (Offset contains the TableId)
*/
- AcpiNsDeleteNamespaceByOwner (TableInfo->TableId);
-
- /* Delete the table itself */
+ AcpiTbDeleteNamespaceByOwner (TableIndex);
+ AcpiTbReleaseOwnerId (TableIndex);
- (void) AcpiTbUninstallTable (TableInfo->InstalledDesc);
+ AcpiTbSetTableLoadedFlag (TableIndex, FALSE);
/* Delete the table descriptor (DdbHandle) */
Index: amlresrc.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/amlresrc.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/amlresrc.h -L sys/contrib/dev/acpica/amlresrc.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/amlresrc.h
+++ sys/contrib/dev/acpica/amlresrc.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: amlresrc.h - AML resource descriptors
- * $Revision: 25 $
+ * $Revision: 1.40 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,39 +115,46 @@
*
*****************************************************************************/
+/* acpisrc:StructDefs -- for acpisrc conversion */
#ifndef __AMLRESRC_H
#define __AMLRESRC_H
-#define ASL_RESNAME_ADDRESS "_ADR"
-#define ASL_RESNAME_ALIGNMENT "_ALN"
-#define ASL_RESNAME_ADDRESSSPACE "_ASI"
-#define ASL_RESNAME_BASEADDRESS "_BAS"
-#define ASL_RESNAME_BUSMASTER "_BM_" /* Master(1), Slave(0) */
-#define ASL_RESNAME_DECODE "_DEC"
-#define ASL_RESNAME_DMA "_DMA"
-#define ASL_RESNAME_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
-#define ASL_RESNAME_GRANULARITY "_GRA"
-#define ASL_RESNAME_INTERRUPT "_INT"
-#define ASL_RESNAME_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
-#define ASL_RESNAME_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
-#define ASL_RESNAME_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
-#define ASL_RESNAME_LENGTH "_LEN"
-#define ASL_RESNAME_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
-#define ASL_RESNAME_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
-#define ASL_RESNAME_MAXADDR "_MAX"
-#define ASL_RESNAME_MINADDR "_MIN"
-#define ASL_RESNAME_MAXTYPE "_MAF"
-#define ASL_RESNAME_MINTYPE "_MIF"
-#define ASL_RESNAME_REGISTERBITOFFSET "_RBO"
-#define ASL_RESNAME_REGISTERBITWIDTH "_RBW"
-#define ASL_RESNAME_RANGETYPE "_RNG"
-#define ASL_RESNAME_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
-#define ASL_RESNAME_TRANSLATION "_TRA"
-#define ASL_RESNAME_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
-#define ASL_RESNAME_TYPE "_TTP" /* Translation(1), Static (0) */
-#define ASL_RESNAME_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
+/*
+ * Resource descriptor tags, as defined in the ACPI specification.
+ * Used to symbolically reference fields within a descriptor.
+ */
+#define ACPI_RESTAG_ADDRESS "_ADR"
+#define ACPI_RESTAG_ALIGNMENT "_ALN"
+#define ACPI_RESTAG_ADDRESSSPACE "_ASI"
+#define ACPI_RESTAG_ACCESSSIZE "_ASZ"
+#define ACPI_RESTAG_TYPESPECIFICATTRIBUTES "_ATT"
+#define ACPI_RESTAG_BASEADDRESS "_BAS"
+#define ACPI_RESTAG_BUSMASTER "_BM_" /* Master(1), Slave(0) */
+#define ACPI_RESTAG_DECODE "_DEC"
+#define ACPI_RESTAG_DMA "_DMA"
+#define ACPI_RESTAG_DMATYPE "_TYP" /* Compatible(0), A(1), B(2), F(3) */
+#define ACPI_RESTAG_GRANULARITY "_GRA"
+#define ACPI_RESTAG_INTERRUPT "_INT"
+#define ACPI_RESTAG_INTERRUPTLEVEL "_LL_" /* ActiveLo(1), ActiveHi(0) */
+#define ACPI_RESTAG_INTERRUPTSHARE "_SHR" /* Shareable(1), NoShare(0) */
+#define ACPI_RESTAG_INTERRUPTTYPE "_HE_" /* Edge(1), Level(0) */
+#define ACPI_RESTAG_LENGTH "_LEN"
+#define ACPI_RESTAG_MEMATTRIBUTES "_MTP" /* Memory(0), Reserved(1), ACPI(2), NVS(3) */
+#define ACPI_RESTAG_MEMTYPE "_MEM" /* NonCache(0), Cacheable(1) Cache+combine(2), Cache+prefetch(3) */
+#define ACPI_RESTAG_MAXADDR "_MAX"
+#define ACPI_RESTAG_MINADDR "_MIN"
+#define ACPI_RESTAG_MAXTYPE "_MAF"
+#define ACPI_RESTAG_MINTYPE "_MIF"
+#define ACPI_RESTAG_REGISTERBITOFFSET "_RBO"
+#define ACPI_RESTAG_REGISTERBITWIDTH "_RBW"
+#define ACPI_RESTAG_RANGETYPE "_RNG"
+#define ACPI_RESTAG_READWRITETYPE "_RW_" /* ReadOnly(0), Writeable (1) */
+#define ACPI_RESTAG_TRANSLATION "_TRA"
+#define ACPI_RESTAG_TRANSTYPE "_TRS" /* Sparse(1), Dense(0) */
+#define ACPI_RESTAG_TYPE "_TTP" /* Translation(1), Static (0) */
+#define ACPI_RESTAG_XFERTYPE "_SIZ" /* 8(0), 8And16(1), 16(2) */
/* Default sizes for "small" resource descriptors */
@@ -163,228 +170,270 @@
typedef struct asl_resource_node
{
- UINT32 BufferLength;
- void *Buffer;
- struct asl_resource_node *Next;
+ UINT32 BufferLength;
+ void *Buffer;
+ struct asl_resource_node *Next;
} ASL_RESOURCE_NODE;
+/* Macros used to generate AML resource length fields */
+
+#define ACPI_AML_SIZE_LARGE(r) (sizeof (r) - sizeof (AML_RESOURCE_LARGE_HEADER))
+#define ACPI_AML_SIZE_SMALL(r) (sizeof (r) - sizeof (AML_RESOURCE_SMALL_HEADER))
+
/*
* Resource descriptors defined in the ACPI specification.
*
* Packing/alignment must be BYTE because these descriptors
- * are used to overlay the AML byte stream.
+ * are used to overlay the raw AML byte stream.
*/
#pragma pack(1)
-typedef struct asl_irq_format_desc
+/*
+ * SMALL descriptors
+ */
+#define AML_RESOURCE_SMALL_HEADER_COMMON \
+ UINT8 DescriptorType;
+
+typedef struct aml_resource_small_header
+{
+ AML_RESOURCE_SMALL_HEADER_COMMON
+
+} AML_RESOURCE_SMALL_HEADER;
+
+
+typedef struct aml_resource_irq
+{
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT16 IrqMask;
+ UINT8 Flags;
+
+} AML_RESOURCE_IRQ;
+
+
+typedef struct aml_resource_irq_noflags
{
- UINT8 DescriptorType;
- UINT16 IrqMask;
- UINT8 Flags;
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT16 IrqMask;
-} ASL_IRQ_FORMAT_DESC;
+} AML_RESOURCE_IRQ_NOFLAGS;
-typedef struct asl_irq_noflags_desc
+typedef struct aml_resource_dma
{
- UINT8 DescriptorType;
- UINT16 IrqMask;
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT8 DmaChannelMask;
+ UINT8 Flags;
-} ASL_IRQ_NOFLAGS_DESC;
+} AML_RESOURCE_DMA;
-typedef struct asl_dma_format_desc
+typedef struct aml_resource_start_dependent
{
- UINT8 DescriptorType;
- UINT8 DmaChannelMask;
- UINT8 Flags;
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT8 Flags;
-} ASL_DMA_FORMAT_DESC;
+} AML_RESOURCE_START_DEPENDENT;
-typedef struct asl_start_dependent_desc
+typedef struct aml_resource_start_dependent_noprio
{
- UINT8 DescriptorType;
- UINT8 Flags;
+ AML_RESOURCE_SMALL_HEADER_COMMON
-} ASL_START_DEPENDENT_DESC;
+} AML_RESOURCE_START_DEPENDENT_NOPRIO;
-typedef struct asl_start_dependent_noprio_desc
+typedef struct aml_resource_end_dependent
{
- UINT8 DescriptorType;
+ AML_RESOURCE_SMALL_HEADER_COMMON
-} ASL_START_DEPENDENT_NOPRIO_DESC;
+} AML_RESOURCE_END_DEPENDENT;
-typedef struct asl_end_dependent_desc
+typedef struct aml_resource_io
{
- UINT8 DescriptorType;
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT8 Flags;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT8 Alignment;
+ UINT8 AddressLength;
-} ASL_END_DEPENDENT_DESC;
+} AML_RESOURCE_IO;
-typedef struct asl_io_port_desc
+typedef struct aml_resource_fixed_io
{
- UINT8 DescriptorType;
- UINT8 Information;
- UINT16 AddressMin;
- UINT16 AddressMax;
- UINT8 Alignment;
- UINT8 Length;
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT16 Address;
+ UINT8 AddressLength;
-} ASL_IO_PORT_DESC;
+} AML_RESOURCE_FIXED_IO;
-typedef struct asl_fixed_io_port_desc
+typedef struct aml_resource_vendor_small
{
- UINT8 DescriptorType;
- UINT16 BaseAddress;
- UINT8 Length;
+ AML_RESOURCE_SMALL_HEADER_COMMON
+
+} AML_RESOURCE_VENDOR_SMALL;
-} ASL_FIXED_IO_PORT_DESC;
+typedef struct aml_resource_end_tag
+{
+ AML_RESOURCE_SMALL_HEADER_COMMON
+ UINT8 Checksum;
+
+} AML_RESOURCE_END_TAG;
+
+
+/*
+ * LARGE descriptors
+ */
+#define AML_RESOURCE_LARGE_HEADER_COMMON \
+ UINT8 DescriptorType;\
+ UINT16 ResourceLength;
-typedef struct asl_small_vendor_desc
+typedef struct aml_resource_large_header
{
- UINT8 DescriptorType;
- UINT8 VendorDefined[7];
+ AML_RESOURCE_LARGE_HEADER_COMMON
-} ASL_SMALL_VENDOR_DESC;
+} AML_RESOURCE_LARGE_HEADER;
-typedef struct asl_end_tag_desc
+typedef struct aml_resource_memory24
{
- UINT8 DescriptorType;
- UINT8 Checksum;
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ UINT8 Flags;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT16 Alignment;
+ UINT16 AddressLength;
+
+} AML_RESOURCE_MEMORY24;
-} ASL_END_TAG_DESC;
+typedef struct aml_resource_vendor_large
+{
+ AML_RESOURCE_LARGE_HEADER_COMMON
+
+} AML_RESOURCE_VENDOR_LARGE;
-/* LARGE descriptors */
-typedef struct asl_memory_24_desc
+typedef struct aml_resource_memory32
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 Information;
- UINT16 AddressMin;
- UINT16 AddressMax;
- UINT16 Alignment;
- UINT16 RangeLength;
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ UINT8 Flags;
+ UINT32 Minimum;
+ UINT32 Maximum;
+ UINT32 Alignment;
+ UINT32 AddressLength;
-} ASL_MEMORY_24_DESC;
+} AML_RESOURCE_MEMORY32;
-typedef struct asl_large_vendor_desc
+typedef struct aml_resource_fixed_memory32
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 VendorDefined[1];
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ UINT8 Flags;
+ UINT32 Address;
+ UINT32 AddressLength;
-} ASL_LARGE_VENDOR_DESC;
+} AML_RESOURCE_FIXED_MEMORY32;
-typedef struct asl_memory_32_desc
+#define AML_RESOURCE_ADDRESS_COMMON \
+ UINT8 ResourceType; \
+ UINT8 Flags; \
+ UINT8 SpecificFlags;
+
+
+typedef struct aml_resource_address
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 Information;
- UINT32 AddressMin;
- UINT32 AddressMax;
- UINT32 Alignment;
- UINT32 RangeLength;
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_ADDRESS_COMMON
-} ASL_MEMORY_32_DESC;
+} AML_RESOURCE_ADDRESS;
-typedef struct asl_fixed_memory_32_desc
+typedef struct aml_resource_extended_address64
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 Information;
- UINT32 BaseAddress;
- UINT32 RangeLength;
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_ADDRESS_COMMON
+ UINT8 RevisionID;
+ UINT8 Reserved;
+ UINT64 Granularity;
+ UINT64 Minimum;
+ UINT64 Maximum;
+ UINT64 TranslationOffset;
+ UINT64 AddressLength;
+ UINT64 TypeSpecific;
+
+} AML_RESOURCE_EXTENDED_ADDRESS64;
-} ASL_FIXED_MEMORY_32_DESC;
+#define AML_RESOURCE_EXTENDED_ADDRESS_REVISION 1 /* ACPI 3.0 */
-typedef struct asl_qword_address_desc
+typedef struct aml_resource_address64
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 ResourceType;
- UINT8 Flags;
- UINT8 SpecificFlags;
- UINT64 Granularity;
- UINT64 AddressMin;
- UINT64 AddressMax;
- UINT64 TranslationOffset;
- UINT64 AddressLength;
- UINT8 OptionalFields[2];
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_ADDRESS_COMMON
+ UINT64 Granularity;
+ UINT64 Minimum;
+ UINT64 Maximum;
+ UINT64 TranslationOffset;
+ UINT64 AddressLength;
-} ASL_QWORD_ADDRESS_DESC;
+} AML_RESOURCE_ADDRESS64;
-typedef struct asl_dword_address_desc
+typedef struct aml_resource_address32
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 ResourceType;
- UINT8 Flags;
- UINT8 SpecificFlags;
- UINT32 Granularity;
- UINT32 AddressMin;
- UINT32 AddressMax;
- UINT32 TranslationOffset;
- UINT32 AddressLength;
- UINT8 OptionalFields[2];
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_ADDRESS_COMMON
+ UINT32 Granularity;
+ UINT32 Minimum;
+ UINT32 Maximum;
+ UINT32 TranslationOffset;
+ UINT32 AddressLength;
-} ASL_DWORD_ADDRESS_DESC;
+} AML_RESOURCE_ADDRESS32;
-typedef struct asl_word_address_desc
+typedef struct aml_resource_address16
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 ResourceType;
- UINT8 Flags;
- UINT8 SpecificFlags;
- UINT16 Granularity;
- UINT16 AddressMin;
- UINT16 AddressMax;
- UINT16 TranslationOffset;
- UINT16 AddressLength;
- UINT8 OptionalFields[2];
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ AML_RESOURCE_ADDRESS_COMMON
+ UINT16 Granularity;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT16 TranslationOffset;
+ UINT16 AddressLength;
-} ASL_WORD_ADDRESS_DESC;
+} AML_RESOURCE_ADDRESS16;
-typedef struct asl_extended_xrupt_desc
+typedef struct aml_resource_extended_irq
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 Flags;
- UINT8 TableLength;
- UINT32 InterruptNumber[1];
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ UINT8 Flags;
+ UINT8 InterruptCount;
+ UINT32 Interrupts[1];
/* ResSourceIndex, ResSource optional fields follow */
-} ASL_EXTENDED_XRUPT_DESC;
+} AML_RESOURCE_EXTENDED_IRQ;
-typedef struct asl_general_register_desc
+typedef struct aml_resource_generic_register
{
- UINT8 DescriptorType;
- UINT16 Length;
- UINT8 AddressSpaceId;
- UINT8 BitWidth;
- UINT8 BitOffset;
- UINT8 Reserved;
- UINT64 Address;
+ AML_RESOURCE_LARGE_HEADER_COMMON
+ UINT8 AddressSpaceId;
+ UINT8 BitWidth;
+ UINT8 BitOffset;
+ UINT8 AccessSize; /* ACPI 3.0, was previously Reserved */
+ UINT64 Address;
-} ASL_GENERAL_REGISTER_DESC;
+} AML_RESOURCE_GENERIC_REGISTER;
/* restore default alignment */
@@ -392,32 +441,46 @@
/* Union of all resource descriptors, so we can allocate the worst case */
-typedef union asl_resource_desc
+typedef union aml_resource
{
- ASL_IRQ_FORMAT_DESC Irq;
- ASL_DMA_FORMAT_DESC Dma;
- ASL_START_DEPENDENT_DESC Std;
- ASL_END_DEPENDENT_DESC End;
- ASL_IO_PORT_DESC Iop;
- ASL_FIXED_IO_PORT_DESC Fio;
- ASL_SMALL_VENDOR_DESC Smv;
- ASL_END_TAG_DESC Et;
-
- ASL_MEMORY_24_DESC M24;
- ASL_LARGE_VENDOR_DESC Lgv;
- ASL_MEMORY_32_DESC M32;
- ASL_FIXED_MEMORY_32_DESC F32;
- ASL_QWORD_ADDRESS_DESC Qas;
- ASL_DWORD_ADDRESS_DESC Das;
- ASL_WORD_ADDRESS_DESC Was;
- ASL_EXTENDED_XRUPT_DESC Exx;
- ASL_GENERAL_REGISTER_DESC Grg;
- UINT32 U32Item;
- UINT16 U16Item;
- UINT8 U8Item;
+ /* Descriptor headers */
-} ASL_RESOURCE_DESC;
+ UINT8 DescriptorType;
+ AML_RESOURCE_SMALL_HEADER SmallHeader;
+ AML_RESOURCE_LARGE_HEADER LargeHeader;
+
+ /* Small resource descriptors */
+
+ AML_RESOURCE_IRQ Irq;
+ AML_RESOURCE_DMA Dma;
+ AML_RESOURCE_START_DEPENDENT StartDpf;
+ AML_RESOURCE_END_DEPENDENT EndDpf;
+ AML_RESOURCE_IO Io;
+ AML_RESOURCE_FIXED_IO FixedIo;
+ AML_RESOURCE_VENDOR_SMALL VendorSmall;
+ AML_RESOURCE_END_TAG EndTag;
+
+ /* Large resource descriptors */
+
+ AML_RESOURCE_MEMORY24 Memory24;
+ AML_RESOURCE_GENERIC_REGISTER GenericReg;
+ AML_RESOURCE_VENDOR_LARGE VendorLarge;
+ AML_RESOURCE_MEMORY32 Memory32;
+ AML_RESOURCE_FIXED_MEMORY32 FixedMemory32;
+ AML_RESOURCE_ADDRESS16 Address16;
+ AML_RESOURCE_ADDRESS32 Address32;
+ AML_RESOURCE_ADDRESS64 Address64;
+ AML_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
+ AML_RESOURCE_EXTENDED_IRQ ExtendedIrq;
+
+ /* Utility overlays */
+
+ AML_RESOURCE_ADDRESS Address;
+ UINT32 DwordItem;
+ UINT16 WordItem;
+ UINT8 ByteItem;
+} AML_RESOURCE;
#endif
Index: hwacpi.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/hwacpi.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/hwacpi.c -L sys/contrib/dev/acpica/hwacpi.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/hwacpi.c
+++ sys/contrib/dev/acpica/hwacpi.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwacpi - ACPI Hardware Initialization/Mode Interface
- * $Revision: 66 $
+ * $Revision: 1.78 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,49 +126,6 @@
/******************************************************************************
*
- * FUNCTION: AcpiHwInitialize
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize and validate various ACPI registers
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiHwInitialize (
- void)
-{
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("HwInitialize");
-
-
- /* We must have the ACPI tables by the time we get here */
-
- if (!AcpiGbl_FADT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "A FADT is not loaded\n"));
-
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
-
- /* Sanity check the FADT for valid values */
-
- Status = AcpiUtValidateFadt ();
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/******************************************************************************
- *
* FUNCTION: AcpiHwSetMode
*
* PARAMETERS: Mode - SYS_MODE_ACPI or SYS_MODE_LEGACY
@@ -188,15 +145,15 @@
UINT32 Retry;
- ACPI_FUNCTION_TRACE ("HwSetMode");
+ ACPI_FUNCTION_TRACE (HwSetMode);
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
- if (!AcpiGbl_FADT->SmiCmd)
+ if (!AcpiGbl_FADT.SmiCommand)
{
- ACPI_REPORT_ERROR (("No SMI_CMD in FADT, mode transition failed.\n"));
+ ACPI_ERROR ((AE_INFO, "No SMI_CMD in FADT, mode transition failed"));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
@@ -207,9 +164,10 @@
* we make sure both the numbers are zero to determine these
* transitions are not supported.
*/
- if (!AcpiGbl_FADT->AcpiEnable && !AcpiGbl_FADT->AcpiDisable)
+ if (!AcpiGbl_FADT.AcpiEnable && !AcpiGbl_FADT.AcpiDisable)
{
- ACPI_REPORT_ERROR (("No ACPI mode transition supported in this system (enable/disable both zero)\n"));
+ ACPI_ERROR ((AE_INFO,
+ "No ACPI mode transition supported in this system (enable/disable both zero)"));
return_ACPI_STATUS (AE_OK);
}
@@ -219,8 +177,8 @@
/* BIOS should have disabled ALL fixed and GP events */
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
- (UINT32) AcpiGbl_FADT->AcpiEnable, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+ (UINT32) AcpiGbl_FADT.AcpiEnable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Attempting to enable ACPI mode\n"));
break;
@@ -230,8 +188,8 @@
* BIOS should clear all fixed status bits and restore fixed event
* enable bits to default
*/
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd,
- (UINT32) AcpiGbl_FADT->AcpiDisable, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand,
+ (UINT32) AcpiGbl_FADT.AcpiDisable, 8);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Attempting to enable Legacy (non-ACPI) mode\n"));
break;
@@ -242,7 +200,8 @@
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not write mode change, %s\n", AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not write ACPI mode change"));
return_ACPI_STATUS (Status);
}
@@ -255,19 +214,20 @@
{
if (AcpiHwGetMode() == Mode)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n", Mode));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Mode %X successfully enabled\n",
+ Mode));
return_ACPI_STATUS (AE_OK);
}
AcpiOsStall(1000);
Retry--;
}
- ACPI_REPORT_ERROR (("Hardware never changed modes\n"));
+ ACPI_ERROR ((AE_INFO, "Hardware did not change modes"));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
-/******************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiHwGetMode
*
@@ -281,36 +241,37 @@
******************************************************************************/
UINT32
-AcpiHwGetMode (void)
+AcpiHwGetMode (
+ void)
{
ACPI_STATUS Status;
UINT32 Value;
- ACPI_FUNCTION_TRACE ("HwGetMode");
+ ACPI_FUNCTION_TRACE (HwGetMode);
/*
* ACPI 2.0 clarified that if SMI_CMD in FADT is zero,
* system does not support mode transition.
*/
- if (!AcpiGbl_FADT->SmiCmd)
+ if (!AcpiGbl_FADT.SmiCommand)
{
- return_VALUE (ACPI_SYS_MODE_ACPI);
+ return_UINT32 (ACPI_SYS_MODE_ACPI);
}
- Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value, ACPI_MTX_LOCK);
+ Status = AcpiGetRegister (ACPI_BITREG_SCI_ENABLE, &Value);
if (ACPI_FAILURE (Status))
{
- return_VALUE (ACPI_SYS_MODE_LEGACY);
+ return_UINT32 (ACPI_SYS_MODE_LEGACY);
}
if (Value)
{
- return_VALUE (ACPI_SYS_MODE_ACPI);
+ return_UINT32 (ACPI_SYS_MODE_ACPI);
}
else
{
- return_VALUE (ACPI_SYS_MODE_LEGACY);
+ return_UINT32 (ACPI_SYS_MODE_LEGACY);
}
}
Index: dmopcode.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmopcode.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmopcode.c -L sys/contrib/dev/acpica/dmopcode.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmopcode.c
+++ sys/contrib/dev/acpica/dmopcode.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmopcode - AML disassembler, specific AML opcodes
- * $Revision: 85 $
+ * $Revision: 1.101 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,12 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmopcode")
+/* Local prototypes */
+
+static void
+AcpiDmMatchKeyword (
+ ACPI_PARSE_OBJECT *Op);
+
/*******************************************************************************
*
@@ -196,16 +202,16 @@
UINT32 Flags;
- /* The next Op contains the flags */
+ /* The next peer Op (not child op) contains the flags */
- Op = AcpiPsGetDepthNext (NULL, Op);
+ Op = Op->Common.Next;
Flags = (UINT8) Op->Common.Value.Integer;
/* Mark the Op as completed */
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
- AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x0F]);
+ AcpiOsPrintf ("%s, ", AcpiGbl_AccessTypes [Flags & 0x07]);
AcpiOsPrintf ("%s, ", AcpiGbl_LockRule [(Flags & 0x10) >> 4]);
AcpiOsPrintf ("%s)", AcpiGbl_UpdateRules [(Flags & 0x60) >> 5]);
}
@@ -328,19 +334,20 @@
*
******************************************************************************/
-void
+static void
AcpiDmMatchKeyword (
ACPI_PARSE_OBJECT *Op)
{
- if (((UINT32) Op->Common.Value.Integer) >= ACPI_NUM_MATCH_OPS)
+ if (((UINT32) Op->Common.Value.Integer) > ACPI_MAX_MATCH_OPCODE)
{
AcpiOsPrintf ("/* Unknown Match Keyword encoding */");
}
else
{
- AcpiOsPrintf ("%s", (char *) (uintptr_t)AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]);
+ AcpiOsPrintf ("%s", ACPI_CAST_PTR (char,
+ AcpiGbl_MatchOps[(ACPI_SIZE) Op->Common.Value.Integer]));
}
}
@@ -368,6 +375,8 @@
const ACPI_OPCODE_INFO *OpInfo = NULL;
UINT32 Offset;
UINT32 Length;
+ ACPI_PARSE_OBJECT *Child;
+ ACPI_STATUS Status;
if (!Op)
@@ -383,38 +392,52 @@
AcpiDmMatchKeyword (Op);
return;
+ case ACPI_DASM_LNOT_SUFFIX:
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_LEQUAL_OP:
+ AcpiOsPrintf ("LNotEqual");
+ break;
+
+ case AML_LGREATER_OP:
+ AcpiOsPrintf ("LLessEqual");
+ break;
+
+ case AML_LLESS_OP:
+ AcpiOsPrintf ("LGreaterEqual");
+ break;
+ }
+ Op->Common.DisasmOpcode = 0;
+ Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
+ return;
+
default:
break;
}
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
/* The op and arguments */
switch (Op->Common.AmlOpcode)
{
- case AML_ZERO_OP:
+ case AML_LNOT_OP:
- AcpiOsPrintf ("Zero");
- break;
-
-
- case AML_ONE_OP:
-
- AcpiOsPrintf ("One");
- break;
-
-
- case AML_ONES_OP:
-
- AcpiOsPrintf ("Ones");
- break;
-
-
- case AML_REVISION_OP:
-
- AcpiOsPrintf ("Revision");
+ Child = Op->Common.Value.Arg;
+ if ((Child->Common.AmlOpcode == AML_LEQUAL_OP) ||
+ (Child->Common.AmlOpcode == AML_LGREATER_OP) ||
+ (Child->Common.AmlOpcode == AML_LLESS_OP))
+ {
+ Child->Common.DisasmOpcode = ACPI_DASM_LNOT_SUFFIX;
+ Op->Common.DisasmOpcode = ACPI_DASM_LNOT_PREFIX;
+ }
+ else
+ {
+ AcpiOsPrintf ("%s", OpInfo->Name);
+ }
break;
-
case AML_BYTE_OP:
AcpiOsPrintf ("0x%2.2X", (UINT32) Op->Common.Value.Integer);
@@ -474,12 +497,19 @@
* types of buffers, we have to closely look at the data in the
* buffer to determine the type.
*/
- if (AcpiDmIsResourceDescriptor (Op))
+ Status = AcpiDmIsResourceTemplate (Op);
+ if (ACPI_SUCCESS (Status))
{
Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
AcpiOsPrintf ("ResourceTemplate");
+ break;
}
- else if (AcpiDmIsUnicodeBuffer (Op))
+ else if (Status == AE_AML_NO_RESOURCE_END_TAG)
+ {
+ AcpiOsPrintf ("/**** Is ResourceTemplate, but EndTag not at buffer end ****/ ");
+ }
+
+ if (AcpiDmIsUnicodeBuffer (Op))
{
Op->Common.DisasmOpcode = ACPI_DASM_UNICODE;
AcpiOsPrintf ("Unicode (");
@@ -513,14 +543,14 @@
case AML_INT_NAMEPATH_OP:
AcpiDmNamestring (Op->Common.Value.Name);
- AcpiDmValidateName (Op->Common.Value.Name, Op);
break;
case AML_INT_NAMEDFIELD_OP:
Length = AcpiDmDumpName ((char *) &Op->Named.Name);
- AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ", (UINT32) Op->Common.Value.Integer);
+ AcpiOsPrintf (",%*.s %d", (int) (5 - Length), " ",
+ (UINT32) Op->Common.Value.Integer);
AcpiDmCommaIfFieldMember (Op);
Info->BitOffset += (UINT32) Op->Common.Value.Integer;
@@ -536,7 +566,7 @@
if (Info->BitOffset % 8 == 0)
{
- AcpiOsPrintf ("Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
+ AcpiOsPrintf (" Offset (0x%.2X)", ACPI_DIV_8 (Info->BitOffset));
}
else
{
@@ -549,8 +579,8 @@
case AML_INT_ACCESSFIELD_OP:
- AcpiOsPrintf ("AccessAs (%s, ",
- AcpiGbl_AccessTypes [(UINT32) Op->Common.Value.Integer >> 8]);
+ AcpiOsPrintf (" AccessAs (%s, ",
+ AcpiGbl_AccessTypes [(UINT32) (Op->Common.Value.Integer >> 8) & 0x7]);
AcpiDmDecodeAttribute ((UINT8) Op->Common.Value.Integer);
AcpiOsPrintf (")");
@@ -566,7 +596,6 @@
case AML_INT_METHODCALL_OP:
- OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
Op = AcpiPsGetDepthNext (NULL, Op);
Op->Common.DisasmFlags |= ACPI_PARSEOP_IGNORE;
@@ -578,7 +607,6 @@
/* Just get the opcode name and print it */
- OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
AcpiOsPrintf ("%s", OpInfo->Name);
@@ -587,12 +615,15 @@
if ((Op->Common.AmlOpcode == AML_INT_RETURN_VALUE_OP) &&
(WalkState) &&
(WalkState->Results) &&
- (WalkState->Results->Results.NumResults))
+ (WalkState->ResultCount))
{
AcpiDmDecodeInternalObject (
- WalkState->Results->Results.ObjDesc [WalkState->Results->Results.NumResults-1]);
+ WalkState->Results->Results.ObjDesc [
+ (WalkState->ResultCount - 1) %
+ ACPI_RESULTS_FRAME_OBJ_NUM]);
}
#endif
+
break;
}
}
Index: dsmthdat.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dsmthdat.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dsmthdat.c -L sys/contrib/dev/acpica/dsmthdat.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dsmthdat.c
+++ sys/contrib/dev/acpica/dsmthdat.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsmthdat - control method arguments and local variables
- * $Revision: 80 $
+ * $Revision: 1.92 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,6 +126,29 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsmthdat")
+/* Local prototypes */
+
+static void
+AcpiDsMethodDataDeleteValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState);
+
+static ACPI_STATUS
+AcpiDsMethodDataSetValue (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_OPERAND_OBJECT *Object,
+ ACPI_WALK_STATE *WalkState);
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+ACPI_OBJECT_TYPE
+AcpiDsMethodDataGetType (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState);
+#endif
+
/*******************************************************************************
*
@@ -136,12 +159,12 @@
* RETURN: Status
*
* DESCRIPTION: Initialize the data structures that hold the method's arguments
- * and locals. The data struct is an array of NTEs for each.
- * This allows RefOf and DeRefOf to work properly for these
+ * and locals. The data struct is an array of namespace nodes for
+ * each - this allows RefOf and DeRefOf to work properly for these
* special data types.
*
* NOTES: WalkState fields are initialized to zero by the
- * ACPI_MEM_CALLOCATE().
+ * ACPI_ALLOCATE_ZEROED().
*
* A pseudo-Namespace Node is assigned to each argument and local
* so that RefOf() can return a pointer to the Node.
@@ -155,32 +178,32 @@
UINT32 i;
- ACPI_FUNCTION_TRACE ("DsMethodDataInit");
+ ACPI_FUNCTION_TRACE (DsMethodDataInit);
/* Init the method arguments */
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
{
- ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name,
- NAMEOF_ARG_NTE);
+ ACPI_MOVE_32_TO_32 (&WalkState->Arguments[i].Name, NAMEOF_ARG_NTE);
WalkState->Arguments[i].Name.Integer |= (i << 24);
- WalkState->Arguments[i].Descriptor = ACPI_DESC_TYPE_NAMED;
- WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
- WalkState->Arguments[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
+ WalkState->Arguments[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
+ WalkState->Arguments[i].Type = ACPI_TYPE_ANY;
+ WalkState->Arguments[i].Flags =
+ ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_ARG;
}
/* Init the method locals */
for (i = 0; i < ACPI_METHOD_NUM_LOCALS; i++)
{
- ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name,
- NAMEOF_LOCAL_NTE);
+ ACPI_MOVE_32_TO_32 (&WalkState->LocalVariables[i].Name, NAMEOF_LOCAL_NTE);
WalkState->LocalVariables[i].Name.Integer |= (i << 24);
- WalkState->LocalVariables[i].Descriptor = ACPI_DESC_TYPE_NAMED;
- WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
- WalkState->LocalVariables[i].Flags = ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
+ WalkState->LocalVariables[i].DescriptorType = ACPI_DESC_TYPE_NAMED;
+ WalkState->LocalVariables[i].Type = ACPI_TYPE_ANY;
+ WalkState->LocalVariables[i].Flags =
+ ANOBJ_END_OF_PEER_LIST | ANOBJ_METHOD_LOCAL;
}
return_VOID;
@@ -207,7 +230,7 @@
UINT32 Index;
- ACPI_FUNCTION_TRACE ("DsMethodDataDeleteAll");
+ ACPI_FUNCTION_TRACE (DsMethodDataDeleteAll);
/* Detach the locals */
@@ -270,7 +293,7 @@
UINT32 Index = 0;
- ACPI_FUNCTION_TRACE_PTR ("DsMethodDataInitArgs", Params);
+ ACPI_FUNCTION_TRACE_PTR (DsMethodDataInitArgs, Params);
if (!Params)
@@ -279,16 +302,19 @@
return_ACPI_STATUS (AE_OK);
}
- /* Copy passed parameters into the new method stack frame */
+ /* Copy passed parameters into the new method stack frame */
- while ((Index < ACPI_METHOD_NUM_ARGS) && (Index < MaxParamCount) && Params[Index])
+ while ((Index < ACPI_METHOD_NUM_ARGS) &&
+ (Index < MaxParamCount) &&
+ Params[Index])
{
/*
* A valid parameter.
* Store the argument in the method/walk descriptor.
* Do not copy the arg in order to implement call by reference
*/
- Status = AcpiDsMethodDataSetValue (AML_ARG_OP, Index, Params[Index], WalkState);
+ Status = AcpiDsMethodDataSetValue (AML_ARG_OP, Index,
+ Params[Index], WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -307,11 +333,13 @@
* FUNCTION: AcpiDsMethodDataGetNode
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
- * Index - Which localVar or argument whose type
- * to get
+ * Index - Which Local or Arg whose type to get
* WalkState - Current walk state object
+ * Node - Where the node is returned.
+ *
+ * RETURN: Status and node
*
- * RETURN: Get the Node associated with a local or arg.
+ * DESCRIPTION: Get the Node associated with a local or arg.
*
******************************************************************************/
@@ -322,7 +350,7 @@
ACPI_WALK_STATE *WalkState,
ACPI_NAMESPACE_NODE **Node)
{
- ACPI_FUNCTION_TRACE ("DsMethodDataGetNode");
+ ACPI_FUNCTION_TRACE (DsMethodDataGetNode);
/*
@@ -334,7 +362,8 @@
if (Index > ACPI_METHOD_MAX_LOCAL)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Local index %d is invalid (max %d)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Local index %d is invalid (max %d)",
Index, ACPI_METHOD_MAX_LOCAL));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@@ -348,7 +377,8 @@
if (Index > ACPI_METHOD_MAX_ARG)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Arg index %d is invalid (max %d)\n",
+ ACPI_ERROR ((AE_INFO,
+ "Arg index %d is invalid (max %d)",
Index, ACPI_METHOD_MAX_ARG));
return_ACPI_STATUS (AE_AML_INVALID_INDEX);
}
@@ -359,7 +389,7 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Opcode %d is invalid\n", Opcode));
+ ACPI_ERROR ((AE_INFO, "Opcode %d is invalid", Opcode));
return_ACPI_STATUS (AE_AML_BAD_OPCODE);
}
@@ -372,7 +402,7 @@
* FUNCTION: AcpiDsMethodDataSetValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
- * Index - Which localVar or argument to get
+ * Index - Which Local or Arg to get
* Object - Object to be inserted into the stack entry
* WalkState - Current walk state object
*
@@ -383,7 +413,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsMethodDataSetValue (
UINT16 Opcode,
UINT32 Index,
@@ -394,7 +424,7 @@
ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("DsMethodDataSetValue");
+ ACPI_FUNCTION_TRACE (DsMethodDataSetValue);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@@ -427,69 +457,16 @@
/*******************************************************************************
*
- * FUNCTION: AcpiDsMethodDataGetType
- *
- * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
- * Index - Which localVar or argument whose type
- * to get
- * WalkState - Current walk state object
- *
- * RETURN: Data type of current value of the selected Arg or Local
- *
- ******************************************************************************/
-
-ACPI_OBJECT_TYPE
-AcpiDsMethodDataGetType (
- UINT16 Opcode,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_STATUS Status;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_OPERAND_OBJECT *Object;
-
-
- ACPI_FUNCTION_TRACE ("DsMethodDataGetType");
-
-
- /* Get the namespace node for the arg/local */
-
- Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
- if (ACPI_FAILURE (Status))
- {
- return_VALUE ((ACPI_TYPE_NOT_FOUND));
- }
-
- /* Get the object */
-
- Object = AcpiNsGetAttachedObject (Node);
- if (!Object)
- {
- /* Uninitialized local/arg, return TYPE_ANY */
-
- return_VALUE (ACPI_TYPE_ANY);
- }
-
- /* Get the object type */
-
- return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiDsMethodDataGetValue
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
* Index - Which localVar or argument to get
* WalkState - Current walk state object
- * *DestDesc - Ptr to Descriptor into which selected Arg
- * or Local value should be copied
+ * DestDesc - Where Arg or Local value is returned
*
* RETURN: Status
*
- * DESCRIPTION: Retrieve value of selected Arg or Local from the method frame
- * at the current top of the method stack.
+ * DESCRIPTION: Retrieve value of selected Arg or Local for this method
* Used only in AcpiExResolveToValue().
*
******************************************************************************/
@@ -506,14 +483,14 @@
ACPI_OPERAND_OBJECT *Object;
- ACPI_FUNCTION_TRACE ("DsMethodDataGetValue");
+ ACPI_FUNCTION_TRACE (DsMethodDataGetValue);
/* Validate the object descriptor */
if (!DestDesc)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null object descriptor pointer\n"));
+ ACPI_ERROR ((AE_INFO, "Null object descriptor pointer"));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
@@ -561,20 +538,22 @@
{
case AML_ARG_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Arg[%d] at node %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Uninitialized Arg[%d] at node %p",
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_ARG);
case AML_LOCAL_OP:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Uninitialized Local[%d] at node %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Uninitialized Local[%d] at node %p",
Index, Node));
return_ACPI_STATUS (AE_AML_UNINITIALIZED_LOCAL);
default:
- ACPI_REPORT_ERROR (("Not Arg/Local opcode: %X\n", Opcode));
+ ACPI_ERROR ((AE_INFO, "Not a Arg/Local opcode: %X", Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
}
@@ -600,12 +579,12 @@
*
* RETURN: None
*
- * DESCRIPTION: Delete the entry at Opcode:Index on the method stack. Inserts
+ * DESCRIPTION: Delete the entry at Opcode:Index. Inserts
* a null into the stack slot after the object is deleted.
*
******************************************************************************/
-void
+static void
AcpiDsMethodDataDeleteValue (
UINT16 Opcode,
UINT32 Index,
@@ -616,7 +595,7 @@
ACPI_OPERAND_OBJECT *Object;
- ACPI_FUNCTION_TRACE ("DsMethodDataDeleteValue");
+ ACPI_FUNCTION_TRACE (DsMethodDataDeleteValue);
/* Get the namespace node for the arg/local */
@@ -658,7 +637,7 @@
* FUNCTION: AcpiDsStoreObjectToLocal
*
* PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
- * Index - Which localVar or argument to set
+ * Index - Which Local or Arg to set
* ObjDesc - Value to be stored
* WalkState - Current walk state
*
@@ -683,7 +662,7 @@
ACPI_OPERAND_OBJECT *NewObjDesc;
- ACPI_FUNCTION_TRACE ("DsStoreObjectToLocal");
+ ACPI_FUNCTION_TRACE (DsStoreObjectToLocal);
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode=%X Index=%d Obj=%p\n",
Opcode, Index, ObjDesc));
@@ -754,22 +733,11 @@
if (Opcode == AML_ARG_OP)
{
/*
- * Make sure that the object is the correct type. This may be overkill, but
- * it is here because references were NS nodes in the past. Now they are
- * operand objects of type Reference.
+ * If we have a valid reference object that came from RefOf(),
+ * do the indirect store
*/
- if (ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) != ACPI_DESC_TYPE_OPERAND)
- {
- ACPI_REPORT_ERROR (("Invalid descriptor type while storing to method arg: [%s]\n",
- AcpiUtGetDescriptorName (CurrentObjDesc)));
- return_ACPI_STATUS (AE_AML_INTERNAL);
- }
-
- /*
- * If we have a valid reference object that came from RefOf(), do the
- * indirect store
- */
- if ((CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
+ if ((ACPI_GET_DESCRIPTOR_TYPE (CurrentObjDesc) == ACPI_DESC_TYPE_OPERAND) &&
+ (CurrentObjDesc->Common.Type == ACPI_TYPE_LOCAL_REFERENCE) &&
(CurrentObjDesc->Reference.Opcode == AML_REF_OF_OP))
{
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
@@ -820,3 +788,57 @@
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsMethodDataGetType
+ *
+ * PARAMETERS: Opcode - Either AML_LOCAL_OP or AML_ARG_OP
+ * Index - Which Local or Arg whose type to get
+ * WalkState - Current walk state object
+ *
+ * RETURN: Data type of current value of the selected Arg or Local
+ *
+ * DESCRIPTION: Get the type of the object stored in the Local or Arg
+ *
+ ******************************************************************************/
+
+ACPI_OBJECT_TYPE
+AcpiDsMethodDataGetType (
+ UINT16 Opcode,
+ UINT32 Index,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_OPERAND_OBJECT *Object;
+
+
+ ACPI_FUNCTION_TRACE (DsMethodDataGetType);
+
+
+ /* Get the namespace node for the arg/local */
+
+ Status = AcpiDsMethodDataGetNode (Opcode, Index, WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return_VALUE ((ACPI_TYPE_NOT_FOUND));
+ }
+
+ /* Get the object */
+
+ Object = AcpiNsGetAttachedObject (Node);
+ if (!Object)
+ {
+ /* Uninitialized local/arg, return TYPE_ANY */
+
+ return_VALUE (ACPI_TYPE_ANY);
+ }
+
+ /* Get the object type */
+
+ return_VALUE (ACPI_GET_OBJECT_TYPE (Object));
+}
+#endif
+
+
Index: nsinit.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsinit.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsinit.c -L sys/contrib/dev/acpica/nsinit.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsinit.c
+++ sys/contrib/dev/acpica/nsinit.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsinit - namespace initialization
- * $Revision: 62 $
+ * $Revision: 1.86 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,29 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsinit")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiNsInitOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiNsInitOneDevice (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiNsFindIniMethods (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
@@ -147,7 +170,7 @@
ACPI_INIT_WALK_INFO Info;
- ACPI_FUNCTION_TRACE ("NsInitializeObjects");
+ ACPI_FUNCTION_TRACE (NsInitializeObjects);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
@@ -166,8 +189,7 @@
&Info, NULL);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "During WalkNamespace"));
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
@@ -210,7 +232,7 @@
ACPI_DEVICE_WALK_INFO Info;
- ACPI_FUNCTION_TRACE ("NsInitializeDevices");
+ ACPI_FUNCTION_TRACE (NsInitializeDevices);
/* Init counters */
@@ -220,32 +242,47 @@
Info.Num_INI = 0;
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "Executing all Device _STA and_INI methods:"));
+ "Initializing Device/Processor/Thermal objects by executing _INI methods:"));
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ /* Tree analysis: find all subtrees that contain _INI methods */
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, AcpiNsFindIniMethods, &Info, NULL);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ goto ErrorExit;
}
- /* Walk namespace for all objects */
+ /* Allocate the evaluation information block */
- Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, TRUE, AcpiNsInitOneDevice, &Info, NULL);
+ Info.EvaluateInfo = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info.EvaluateInfo)
+ {
+ Status = AE_NO_MEMORY;
+ goto ErrorExit;
+ }
+
+ /* Walk namespace to execute all _INIs on present devices */
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, AcpiNsInitOneDevice, &Info, NULL);
+ ACPI_FREE (Info.EvaluateInfo);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "WalkNamespace failed! %s\n",
- AcpiFormatException (Status)));
+ goto ErrorExit;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT,
- "\n%hd Devices found containing: %hd _STA, %hd _INI methods\n",
- Info.DeviceCount, Info.Num_STA, Info.Num_INI));
+ "\nExecuted %hd _INI methods requiring %hd _STA executions (examined %hd objects)\n",
+ Info.Num_INI, Info.Num_STA, Info.DeviceCount));
return_ACPI_STATUS (Status);
+
+
+ErrorExit:
+ ACPI_EXCEPTION ((AE_INFO, Status, "During device initialization"));
+ return_ACPI_STATUS (Status);
}
@@ -269,7 +306,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiNsInitOneObject (
ACPI_HANDLE ObjHandle,
UINT32 Level,
@@ -277,13 +314,13 @@
void **ReturnValue)
{
ACPI_OBJECT_TYPE Type;
- ACPI_STATUS Status;
+ ACPI_STATUS Status = AE_OK;
ACPI_INIT_WALK_INFO *Info = (ACPI_INIT_WALK_INFO *) Context;
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_NAME ("NsInitOneObject");
+ ACPI_FUNCTION_NAME (NsInitOneObject);
Info->ObjectCount++;
@@ -334,11 +371,7 @@
/*
* Must lock the interpreter before executing AML code
*/
- Status = AcpiExEnterInterpreter ();
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
+ AcpiExEnterInterpreter ();
/*
* Each of these types can contain executable AML code within the
@@ -377,11 +410,9 @@
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_ERROR, "\n"));
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not execute arguments for [%4.4s] (%s), %s\n",
- AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type),
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not execute arguments for [%4.4s] (%s)",
+ AcpiUtGetNodeName (Node), AcpiUtGetTypeName (Type)));
}
/*
@@ -404,6 +435,80 @@
/*******************************************************************************
*
+ * FUNCTION: AcpiNsFindIniMethods
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: ACPI_STATUS
+ *
+ * DESCRIPTION: Called during namespace walk. Finds objects named _INI under
+ * device/processor/thermal objects, and marks the entire subtree
+ * with a SUBTREE_HAS_INI flag. This flag is used during the
+ * subsequent device initialization walk to avoid entire subtrees
+ * that do not contain an _INI.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiNsFindIniMethods (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_DEVICE_WALK_INFO *Info = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context);
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_NAMESPACE_NODE *ParentNode;
+
+
+ /* Keep count of device/processor/thermal objects */
+
+ Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+ if ((Node->Type == ACPI_TYPE_DEVICE) ||
+ (Node->Type == ACPI_TYPE_PROCESSOR) ||
+ (Node->Type == ACPI_TYPE_THERMAL))
+ {
+ Info->DeviceCount++;
+ return (AE_OK);
+ }
+
+ /* We are only looking for methods named _INI */
+
+ if (!ACPI_COMPARE_NAME (Node->Name.Ascii, METHOD_NAME__INI))
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * The only _INI methods that we care about are those that are
+ * present under Device, Processor, and Thermal objects.
+ */
+ ParentNode = AcpiNsGetParentNode (Node);
+ switch (ParentNode->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_THERMAL:
+
+ /* Mark parent and bubble up the INI present flag to the root */
+
+ while (ParentNode)
+ {
+ ParentNode->Flags |= ANOBJ_SUBTREE_HAS_INI;
+ ParentNode = AcpiNsGetParentNode (ParentNode);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiNsInitOneDevice
*
* PARAMETERS: ACPI_WALK_CALLBACK
@@ -416,122 +521,180 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiNsInitOneDevice (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
- ACPI_DEVICE_WALK_INFO *Info = (ACPI_DEVICE_WALK_INFO *) Context;
- ACPI_PARAMETER_INFO Pinfo;
+ ACPI_DEVICE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_DEVICE_WALK_INFO, Context);
+ ACPI_EVALUATE_INFO *Info = WalkInfo->EvaluateInfo;
UINT32 Flags;
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *DeviceNode;
- ACPI_FUNCTION_TRACE ("NsInitOneDevice");
+ ACPI_FUNCTION_TRACE (NsInitOneDevice);
- Pinfo.Parameters = NULL;
- Pinfo.ParameterType = ACPI_PARAM_ARGS;
+ /* We are interested in Devices, Processors and ThermalZones only */
- Pinfo.Node = AcpiNsMapHandleToNode (ObjHandle);
- if (!Pinfo.Node)
+ DeviceNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+ if ((DeviceNode->Type != ACPI_TYPE_DEVICE) &&
+ (DeviceNode->Type != ACPI_TYPE_PROCESSOR) &&
+ (DeviceNode->Type != ACPI_TYPE_THERMAL))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_OK);
}
/*
- * We will run _STA/_INI on Devices, Processors and ThermalZones only
+ * Because of an earlier namespace analysis, all subtrees that contain an
+ * _INI method are tagged.
+ *
+ * If this device subtree does not contain any _INI methods, we
+ * can exit now and stop traversing this entire subtree.
*/
- if ((Pinfo.Node->Type != ACPI_TYPE_DEVICE) &&
- (Pinfo.Node->Type != ACPI_TYPE_PROCESSOR) &&
- (Pinfo.Node->Type != ACPI_TYPE_THERMAL))
- {
- return_ACPI_STATUS (AE_OK);
- }
-
- if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) &&
- (!(AcpiDbgLevel & ACPI_LV_INFO)))
+ if (!(DeviceNode->Flags & ANOBJ_SUBTREE_HAS_INI))
{
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ return_ACPI_STATUS (AE_CTRL_DEPTH);
}
- Info->DeviceCount++;
-
/*
- * Run _STA to determine if we can run _INI on the device.
+ * Run _STA to determine if this device is present and functioning. We
+ * must know this information for two important reasons (from ACPI spec):
+ *
+ * 1) We can only run _INI if the device is present.
+ * 2) We must abort the device tree walk on this subtree if the device is
+ * not present and is not functional (we will not examine the children)
+ *
+ * The _STA method is not required to be present under the device, we
+ * assume the device is present if _STA does not exist.
*/
- ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Pinfo.Node, "_STA"));
- Status = AcpiUtExecute_STA (Pinfo.Node, &Flags);
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
+ ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__STA));
+ Status = AcpiUtExecute_STA (DeviceNode, &Flags);
if (ACPI_FAILURE (Status))
{
- if (Pinfo.Node->Type == ACPI_TYPE_DEVICE)
- {
- /* Ignore error and move on to next device */
+ /* Ignore error and move on to next device */
- return_ACPI_STATUS (AE_OK);
- }
+ return_ACPI_STATUS (AE_OK);
+ }
- /* _STA is not required for Processor or ThermalZone objects */
+ /*
+ * Flags == -1 means that _STA was not found. In this case, we assume that
+ * the device is both present and functional.
+ *
+ * From the ACPI spec, description of _STA:
+ *
+ * "If a device object (including the processor object) does not have an
+ * _STA object, then OSPM assumes that all of the above bits are set (in
+ * other words, the device is present, ..., and functioning)"
+ */
+ if (Flags != ACPI_UINT32_MAX)
+ {
+ WalkInfo->Num_STA++;
}
- else
+
+ /*
+ * Examine the PRESENT and FUNCTIONING status bits
+ *
+ * Note: ACPI spec does not seem to specify behavior for the present but
+ * not functioning case, so we assume functioning if present.
+ */
+ if (!(Flags & ACPI_STA_DEVICE_PRESENT))
{
- Info->Num_STA++;
+ /* Device is not present, we must examine the Functioning bit */
- if (!(Flags & 0x01))
+ if (Flags & ACPI_STA_DEVICE_FUNCTIONING)
{
- /* Don't look at children of a not present device */
-
- return_ACPI_STATUS(AE_CTRL_DEPTH);
+ /*
+ * Device is not present but is "functioning". In this case,
+ * we will not run _INI, but we continue to examine the children
+ * of this device.
+ *
+ * From the ACPI spec, description of _STA: (Note - no mention
+ * of whether to run _INI or not on the device in question)
+ *
+ * "_STA may return bit 0 clear (not present) with bit 3 set
+ * (device is functional). This case is used to indicate a valid
+ * device for which no device driver should be loaded (for example,
+ * a bridge device.) Children of this device may be present and
+ * valid. OSPM should continue enumeration below a device whose
+ * _STA returns this bit combination"
+ */
+ return_ACPI_STATUS (AE_OK);
+ }
+ else
+ {
+ /*
+ * Device is not present and is not functioning. We must abort the
+ * walk of this subtree immediately -- don't look at the children
+ * of such a device.
+ *
+ * From the ACPI spec, description of _INI:
+ *
+ * "If the _STA method indicates that the device is not present,
+ * OSPM will not run the _INI and will not examine the children
+ * of the device for _INI methods"
+ */
+ return_ACPI_STATUS (AE_CTRL_DEPTH);
}
}
/*
- * The device is present. Run _INI.
+ * The device is present or is assumed present if no _STA exists.
+ * Run the _INI if it exists (not required to exist)
+ *
+ * Note: We know there is an _INI within this subtree, but it may not be
+ * under this particular device, it may be lower in the branch.
*/
- ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (ACPI_TYPE_METHOD, Pinfo.Node, "_INI"));
- Status = AcpiNsEvaluateRelative ("_INI", &Pinfo);
- if (ACPI_FAILURE (Status))
+ ACPI_DEBUG_EXEC (AcpiUtDisplayInitPathname (
+ ACPI_TYPE_METHOD, DeviceNode, METHOD_NAME__INI));
+
+ Info->PrefixNode = DeviceNode;
+ Info->Pathname = METHOD_NAME__INI;
+ Info->Parameters = NULL;
+ Info->ParameterType = ACPI_PARAM_ARGS;
+ Info->Flags = ACPI_IGNORE_RETURN_VALUE;
+
+ Status = AcpiNsEvaluate (Info);
+ if (ACPI_SUCCESS (Status))
{
- /* No _INI (AE_NOT_FOUND) means device requires no initialization */
+ WalkInfo->Num_INI++;
- if (Status != AE_NOT_FOUND)
+ if ((AcpiDbgLevel <= ACPI_LV_ALL_EXCEPTIONS) &&
+ (!(AcpiDbgLevel & ACPI_LV_INFO)))
{
- /* Ignore error and move on to next device */
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_INIT, "."));
+ }
+ }
#ifdef ACPI_DEBUG_OUTPUT
- char *ScopeName = AcpiNsGetExternalPathname (Pinfo.Node);
+ else if (Status != AE_NOT_FOUND)
+ {
+ /* Ignore error and move on to next device */
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%s._INI failed: %s\n",
- ScopeName, AcpiFormatException (Status)));
+ char *ScopeName = AcpiNsGetExternalPathname (Info->ResolvedNode);
- ACPI_MEM_FREE (ScopeName);
-#endif
- }
-
- Status = AE_OK;
+ ACPI_EXCEPTION ((AE_INFO, Status, "during %s._INI execution",
+ ScopeName));
+ ACPI_FREE (ScopeName);
}
- else
- {
- /* Delete any return object (Especially if ImplicitReturn is enabled) */
-
- if (Pinfo.ReturnObject)
- {
- AcpiUtRemoveReference (Pinfo.ReturnObject);
- }
+#endif
- /* Count of successful INIs */
+ /* Ignore errors from above */
- Info->Num_INI++;
- }
+ Status = AE_OK;
+ /*
+ * The _INI method has been run if present; call the Global Initialization
+ * Handler for this device.
+ */
if (AcpiGbl_InitHandler)
{
- /* External initialization handler is present, call it */
-
- Status = AcpiGbl_InitHandler (Pinfo.Node, ACPI_INIT_DEVICE_INI);
+ Status = AcpiGbl_InitHandler (DeviceNode, ACPI_INIT_DEVICE_INI);
}
return_ACPI_STATUS (Status);
Index: exoparg3.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exoparg3.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exoparg3.c -L sys/contrib/dev/acpica/exoparg3.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exoparg3.c
+++ sys/contrib/dev/acpica/exoparg3.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exoparg3 - AML execution - opcodes with 3 arguments
- * $Revision: 19 $
+ * $Revision: 1.35 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -172,12 +172,13 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_0T_0R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_0T_0R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
{
- case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */
+ case AML_FATAL_OP: /* Fatal (FatalType FatalCode FatalArg) */
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"FatalOp: Type %X Code %X Arg %X <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\n",
@@ -185,7 +186,7 @@
(UINT32) Operand[1]->Integer.Value,
(UINT32) Operand[2]->Integer.Value));
- Fatal = ACPI_MEM_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
+ Fatal = ACPI_ALLOCATE (sizeof (ACPI_SIGNAL_FATAL_INFO));
if (Fatal)
{
Fatal->Type = (UINT32) Operand[0]->Integer.Value;
@@ -193,21 +194,20 @@
Fatal->Argument = (UINT32) Operand[2]->Integer.Value;
}
- /*
- * Always signal the OS!
- */
+ /* Always signal the OS! */
+
Status = AcpiOsSignal (ACPI_SIGNAL_FATAL, Fatal);
/* Might return while OS is shutting down, just continue */
- ACPI_MEM_FREE (Fatal);
+ ACPI_FREE (Fatal);
break;
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
@@ -237,24 +237,26 @@
{
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ReturnDesc = NULL;
- char *Buffer;
+ char *Buffer = NULL;
ACPI_STATUS Status = AE_OK;
- ACPI_NATIVE_UINT Index;
+ ACPI_INTEGER Index;
ACPI_SIZE Length;
- ACPI_FUNCTION_TRACE_STR ("ExOpcode_3A_1T_1R", AcpiPsGetOpcodeName (WalkState->Opcode));
+ ACPI_FUNCTION_TRACE_STR (ExOpcode_3A_1T_1R,
+ AcpiPsGetOpcodeName (WalkState->Opcode));
switch (WalkState->Opcode)
{
- case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
+ case AML_MID_OP: /* Mid (Source[0], Index[1], Length[2], Result[3]) */
/*
* Create the return object. The Source operand is guaranteed to be
* either a String or a Buffer, so just use its type.
*/
- ReturnDesc = AcpiUtCreateInternalObject (ACPI_GET_OBJECT_TYPE (Operand[0]));
+ ReturnDesc = AcpiUtCreateInternalObject (
+ ACPI_GET_OBJECT_TYPE (Operand[0]));
if (!ReturnDesc)
{
Status = AE_NO_MEMORY;
@@ -263,50 +265,88 @@
/* Get the Integer values from the objects */
- Index = (ACPI_NATIVE_UINT) Operand[1]->Integer.Value;
+ Index = Operand[1]->Integer.Value;
Length = (ACPI_SIZE) Operand[2]->Integer.Value;
/*
* If the index is beyond the length of the String/Buffer, or if the
* requested length is zero, return a zero-length String/Buffer
*/
- if ((Index < Operand[0]->String.Length) &&
- (Length > 0))
+ if (Index >= Operand[0]->String.Length)
{
- /* Truncate request if larger than the actual String/Buffer */
+ Length = 0;
+ }
- if ((Index + Length) >
- Operand[0]->String.Length)
- {
- Length = (ACPI_SIZE) Operand[0]->String.Length - Index;
- }
+ /* Truncate request if larger than the actual String/Buffer */
+
+ else if ((Index + Length) > Operand[0]->String.Length)
+ {
+ Length = (ACPI_SIZE) Operand[0]->String.Length -
+ (ACPI_SIZE) Index;
+ }
- /* Allocate a new buffer for the String/Buffer */
+ /* Strings always have a sub-pointer, not so for buffers */
+
+ switch (ACPI_GET_OBJECT_TYPE (Operand[0]))
+ {
+ case ACPI_TYPE_STRING:
- Buffer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
+ /* Always allocate a new buffer for the String */
+
+ Buffer = ACPI_ALLOCATE_ZEROED ((ACPI_SIZE) Length + 1);
if (!Buffer)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
+ break;
+
+ case ACPI_TYPE_BUFFER:
- /* Copy the portion requested */
+ /* If the requested length is zero, don't allocate a buffer */
+
+ if (Length > 0)
+ {
+ /* Allocate a new buffer for the Buffer */
+
+ Buffer = ACPI_ALLOCATE_ZEROED (Length);
+ if (!Buffer)
+ {
+ Status = AE_NO_MEMORY;
+ goto Cleanup;
+ }
+ }
+ break;
+
+ default: /* Should not happen */
+
+ Status = AE_AML_OPERAND_TYPE;
+ goto Cleanup;
+ }
+
+ if (Buffer)
+ {
+ /* We have a buffer, copy the portion requested */
ACPI_MEMCPY (Buffer, Operand[0]->String.Pointer + Index,
Length);
+ }
- /* Set the length of the new String/Buffer */
+ /* Set the length of the new String/Buffer */
- ReturnDesc->String.Pointer = Buffer;
- ReturnDesc->String.Length = (UINT32) Length;
- }
+ ReturnDesc->String.Pointer = Buffer;
+ ReturnDesc->String.Length = (UINT32) Length;
+
+ /* Mark buffer initialized */
+
+ ReturnDesc->Buffer.Flags |= AOPOBJ_DATA_VALID;
break;
default:
- ACPI_REPORT_ERROR (("AcpiExOpcode_3A_0T_0R: Unknown opcode %X\n",
- WalkState->Opcode));
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
+ WalkState->Opcode));
Status = AE_AML_BAD_OPCODE;
goto Cleanup;
}
@@ -319,14 +359,15 @@
/* Delete return object on error */
- if (ACPI_FAILURE (Status))
+ if (ACPI_FAILURE (Status) || WalkState->ResultObj)
{
AcpiUtRemoveReference (ReturnDesc);
+ WalkState->ResultObj = NULL;
}
/* Set the return object and exit */
- if (!WalkState->ResultObj)
+ else
{
WalkState->ResultObj = ReturnDesc;
}
Index: dbhistry.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbhistry.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbhistry.c -L sys/contrib/dev/acpica/dbhistry.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbhistry.c
+++ sys/contrib/dev/acpica/dbhistry.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dbhistry - debugger HISTORY command
- * $Revision: 29 $
+ * $Revision: 1.34 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -163,7 +163,8 @@
/* Put command into the next available slot */
- ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command, CommandLine);
+ ACPI_STRCPY (AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].Command,
+ CommandLine);
AcpiGbl_HistoryBuffer[AcpiGbl_NextHistoryIndex].CmdNum = AcpiGbl_NextCmdNum;
@@ -206,7 +207,8 @@
******************************************************************************/
void
-AcpiDbDisplayHistory (void)
+AcpiDbDisplayHistory (
+ void)
{
ACPI_NATIVE_UINT i;
UINT16 HistoryIndex;
@@ -237,7 +239,7 @@
* PARAMETERS: CommandNumArg - String containing the number of the
* command to be retrieved
*
- * RETURN: None
+ * RETURN: Pointer to the retrieved command. Null on error.
*
* DESCRIPTION: Get a command from the history buffer
*
@@ -286,6 +288,5 @@
return (NULL);
}
-
#endif /* ACPI_DEBUGGER */
Index: dsutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dsutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dsutils.c -L sys/contrib/dev/acpica/dsutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dsutils.c
+++ sys/contrib/dev/acpica/dsutils.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dsutils - Dispatcher utilities
- * $Revision: 107 $
+ * $Revision: 1.124 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,7 +128,122 @@
ACPI_MODULE_NAME ("dsutils")
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsClearImplicitReturn
+ *
+ * PARAMETERS: WalkState - Current State
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Clear and remove a reference on an implicit return value. Used
+ * to delete "stale" return values (if enabled, the return value
+ * from every operator is saved at least momentarily, in case the
+ * parent method exits.)
+ *
+ ******************************************************************************/
+
+void
+AcpiDsClearImplicitReturn (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_FUNCTION_NAME (DsClearImplicitReturn);
+
+
+ /*
+ * Slack must be enabled for this feature
+ */
+ if (!AcpiGbl_EnableInterpreterSlack)
+ {
+ return;
+ }
+
+ if (WalkState->ImplicitReturnObj)
+ {
+ /*
+ * Delete any "stale" implicit return. However, in
+ * complex statements, the implicit return value can be
+ * bubbled up several levels.
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Removing reference on stale implicit return obj %p\n",
+ WalkState->ImplicitReturnObj));
+
+ AcpiUtRemoveReference (WalkState->ImplicitReturnObj);
+ WalkState->ImplicitReturnObj = NULL;
+ }
+}
+
+
#ifndef ACPI_NO_METHOD_EXECUTION
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsDoImplicitReturn
+ *
+ * PARAMETERS: ReturnDesc - The return value
+ * WalkState - Current State
+ * AddReference - True if a reference should be added to the
+ * return object
+ *
+ * RETURN: TRUE if implicit return enabled, FALSE otherwise
+ *
+ * DESCRIPTION: Implements the optional "implicit return". We save the result
+ * of every ASL operator and control method invocation in case the
+ * parent method exit. Before storing a new return value, we
+ * delete the previous return value.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiDsDoImplicitReturn (
+ ACPI_OPERAND_OBJECT *ReturnDesc,
+ ACPI_WALK_STATE *WalkState,
+ BOOLEAN AddReference)
+{
+ ACPI_FUNCTION_NAME (DsDoImplicitReturn);
+
+
+ /*
+ * Slack must be enabled for this feature, and we must
+ * have a valid return object
+ */
+ if ((!AcpiGbl_EnableInterpreterSlack) ||
+ (!ReturnDesc))
+ {
+ return (FALSE);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Result %p will be implicitly returned; Prev=%p\n",
+ ReturnDesc,
+ WalkState->ImplicitReturnObj));
+
+ /*
+ * Delete any "stale" implicit return value first. However, in
+ * complex statements, the implicit return value can be
+ * bubbled up several levels, so we don't clear the value if it
+ * is the same as the ReturnDesc.
+ */
+ if (WalkState->ImplicitReturnObj)
+ {
+ if (WalkState->ImplicitReturnObj == ReturnDesc)
+ {
+ return (TRUE);
+ }
+ AcpiDsClearImplicitReturn (WalkState);
+ }
+
+ /* Save the implicit return value, add a reference if requested */
+
+ WalkState->ImplicitReturnObj = ReturnDesc;
+ if (AddReference)
+ {
+ AcpiUtAddReference (ReturnDesc);
+ }
+
+ return (TRUE);
+}
+
/*******************************************************************************
*
@@ -150,51 +265,45 @@
{
const ACPI_OPCODE_INFO *ParentInfo;
-
- ACPI_FUNCTION_TRACE_PTR ("DsIsResultUsed", Op);
+ ACPI_FUNCTION_TRACE_PTR (DsIsResultUsed, Op);
/* Must have both an Op and a Result Object */
if (!Op)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
- return_VALUE (TRUE);
+ ACPI_ERROR ((AE_INFO, "Null Op"));
+ return_UINT8 (TRUE);
}
/*
- * If there is no parent, we are executing at the method level.
- * An executing method typically has no parent, since each method
- * is parsed separately.
+ * We know that this operator is not a
+ * Return() operator (would not come here.) The following code is the
+ * optional support for a so-called "implicit return". Some AML code
+ * assumes that the last value of the method is "implicitly" returned
+ * to the caller. Just save the last result as the return value.
+ * NOTE: this is optional because the ASL language does not actually
+ * support this behavior.
*/
- if (!Op->Common.Parent ||
- Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP)
- {
- /*
- * If this is the last statement in the method, we know it is not a
- * Return() operator (would not come here.) The following code is the
- * optional support for a so-called "implicit return". Some AML code
- * assumes that the last value of the method is "implicitly" returned
- * to the caller. Just save the last result as the return value.
- * NOTE: this is optional because the ASL language does not actually
- * support this behavior.
- */
- if ((AcpiGbl_EnableInterpreterSlack) &&
- (WalkState->ParserState.Aml >= WalkState->ParserState.AmlEnd))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Result of [%s] will be implicitly returned\n",
- AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
-
- /* Use the top of the result stack as the implicit return value */
-
- WalkState->ReturnDesc = WalkState->Results->Results.ObjDesc[0];
- return_VALUE (TRUE);
- }
+ (void) AcpiDsDoImplicitReturn (WalkState->ResultObj, WalkState, TRUE);
+ /*
+ * Now determine if the parent will use the result
+ *
+ * If there is no parent, or the parent is a ScopeOp, we are executing
+ * at the method level. An executing method typically has no parent,
+ * since each method is parsed separately. A method invoked externally
+ * via ExecuteControlMethod has a ScopeOp as the parent.
+ */
+ if ((!Op->Common.Parent) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_SCOPE_OP))
+ {
/* No parent, the return value cannot possibly be used */
- return_VALUE (FALSE);
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "At Method level, result of [%s] not used\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode)));
+ return_UINT8 (FALSE);
}
/* Get info on the parent. The RootOp is AML_SCOPE */
@@ -202,8 +311,9 @@
ParentInfo = AcpiPsGetOpcodeInfo (Op->Common.Parent->Common.AmlOpcode);
if (ParentInfo->Class == AML_CLASS_UNKNOWN)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown parent opcode. Op=%p\n", Op));
- return_VALUE (FALSE);
+ ACPI_ERROR ((AE_INFO,
+ "Unknown parent opcode Op=%p", Op));
+ return_UINT8 (FALSE);
}
/*
@@ -287,19 +397,21 @@
ResultUsed:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] used by Parent [%s] Op=%p\n",
- AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
- AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Result of [%s] used by Parent [%s] Op=%p\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
+ AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
- return_VALUE (TRUE);
+ return_UINT8 (TRUE);
ResultNotUsed:
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Result of [%s] not used by Parent [%s] Op=%p\n",
- AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
- AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Result of [%s] not used by Parent [%s] Op=%p\n",
+ AcpiPsGetOpcodeName (Op->Common.AmlOpcode),
+ AcpiPsGetOpcodeName (Op->Common.Parent->Common.AmlOpcode), Op));
- return_VALUE (FALSE);
+ return_UINT8 (FALSE);
}
@@ -330,12 +442,12 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsDeleteResultIfNotUsed", ResultObj);
+ ACPI_FUNCTION_TRACE_PTR (DsDeleteResultIfNotUsed, ResultObj);
if (!Op)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Op\n"));
+ ACPI_ERROR ((AE_INFO, "Null Op"));
return_VOID;
}
@@ -346,9 +458,8 @@
if (!AcpiDsIsResultUsed (Op, WalkState))
{
- /*
- * Must pop the result stack (ObjDesc should be equal to ResultObj)
- */
+ /* Must pop the result stack (ObjDesc should be equal to ResultObj) */
+
Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_SUCCESS (Status))
{
@@ -382,7 +493,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("DsResolveOperands", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsResolveOperands, WalkState);
/*
@@ -422,12 +533,11 @@
UINT32 i;
- ACPI_FUNCTION_TRACE_PTR ("DsClearOperands", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsClearOperands, WalkState);
- /*
- * Remove a reference on each operand on the stack
- */
+ /* Remove a reference on each operand on the stack */
+
for (i = 0; i < WalkState->NumOperands; i++)
{
/*
@@ -477,13 +587,14 @@
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateOperand", Arg);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateOperand, Arg);
/* A valid name must be looked up in the namespace */
if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
- (Arg->Common.Value.String))
+ (Arg->Common.Value.String) &&
+ !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Getting a name: Arg=%p\n", Arg));
@@ -497,11 +608,7 @@
return_ACPI_STATUS (Status);
}
- /*
- * All prefixes have been handled, and the name is
- * in NameString
- */
-
+ /* All prefixes have been handled, and the name is in NameString */
/*
* Special handling for BufferField declarations. This is a deferred
@@ -514,9 +621,10 @@
*/
if ((WalkState->DeferredNode) &&
(WalkState->DeferredNode->Type == ACPI_TYPE_BUFFER_FIELD) &&
- (ArgIndex != 0))
+ (ArgIndex == (UINT32) ((WalkState->Opcode == AML_CREATE_FIELD_OP) ? 3 : 2)))
{
- ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, WalkState->DeferredNode);
+ ObjDesc = ACPI_CAST_PTR (
+ ACPI_OPERAND_OBJECT, WalkState->DeferredNode);
Status = AE_OK;
}
else /* All other opcodes */
@@ -546,10 +654,10 @@
}
Status = AcpiNsLookup (WalkState->ScopeInfo, NameString,
- ACPI_TYPE_ANY, InterpreterMode,
- ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
- WalkState,
- ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc));
+ ACPI_TYPE_ANY, InterpreterMode,
+ ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState,
+ ACPI_CAST_INDIRECT_PTR (ACPI_NAMESPACE_NODE, &ObjDesc));
/*
* The only case where we pass through (ignore) a NOT_FOUND
* error is for the CondRefOf opcode.
@@ -564,7 +672,8 @@
* indicate this to the interpreter, set the
* object to the root
*/
- ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);
+ ObjDesc = ACPI_CAST_PTR (
+ ACPI_OPERAND_OBJECT, AcpiGbl_RootNode);
Status = AE_OK;
}
else
@@ -579,13 +688,13 @@
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_NSERROR (NameString, Status);
+ ACPI_ERROR_NAMESPACE (NameString, Status);
}
}
/* Free the namestring created above */
- ACPI_MEM_FREE (NameString);
+ ACPI_FREE (NameString);
/* Check status from the lookup */
@@ -607,7 +716,8 @@
{
/* Check for null name case */
- if (Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ if ((Arg->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !(Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
{
/*
* If the name is null, this means that this is an
@@ -617,7 +727,8 @@
*/
Opcode = AML_ZERO_OP; /* Has no arguments! */
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Null namepath: Arg=%p\n", Arg));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Null namepath: Arg=%p\n", Arg));
}
else
{
@@ -632,10 +743,10 @@
return_ACPI_STATUS (AE_NOT_IMPLEMENTED);
}
- if (OpInfo->Flags & AML_HAS_RETVAL)
+ if ((OpInfo->Flags & AML_HAS_RETVAL) || (Arg->Common.Flags & ACPI_PARSEOP_IN_STACK))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Argument previously created, already stacked \n"));
+ "Argument previously created, already stacked\n"));
ACPI_DEBUGGER_EXEC (AcpiDbDisplayArgumentObject (
WalkState->Operands [WalkState->NumOperands - 1], WalkState));
@@ -644,15 +755,15 @@
* Use value that was already previously returned
* by the evaluation of this argument
*/
- Status = AcpiDsResultPopFromBottom (&ObjDesc, WalkState);
+ Status = AcpiDsResultPop (&ObjDesc, WalkState);
if (ACPI_FAILURE (Status))
{
/*
* Only error is underflow, and this indicates
* a missing or null operand!
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Missing or null operand, %s\n",
- AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Missing or null operand"));
return_ACPI_STATUS (Status);
}
}
@@ -668,8 +779,8 @@
/* Initialize the new object */
- Status = AcpiDsInitObjectFromOp (WalkState, Arg,
- Opcode, &ObjDesc);
+ Status = AcpiDsInitObjectFromOp (
+ WalkState, Arg, Opcode, &ObjDesc);
if (ACPI_FAILURE (Status))
{
AcpiUtDeleteObjectDesc (ObjDesc);
@@ -696,7 +807,8 @@
*
* FUNCTION: AcpiDsCreateOperands
*
- * PARAMETERS: FirstArg - First argument of a parser argument tree
+ * PARAMETERS: WalkState - Current state
+ * FirstArg - First argument of a parser argument tree
*
* RETURN: Status
*
@@ -713,30 +825,59 @@
{
ACPI_STATUS Status = AE_OK;
ACPI_PARSE_OBJECT *Arg;
- UINT32 ArgCount = 0;
+ ACPI_PARSE_OBJECT *Arguments[ACPI_OBJ_NUM_OPERANDS];
+ UINT8 ArgCount = 0;
+ UINT8 Count = 0;
+ UINT8 Index = WalkState->NumOperands;
+ UINT8 i;
- ACPI_FUNCTION_TRACE_PTR ("DsCreateOperands", FirstArg);
+ ACPI_FUNCTION_TRACE_PTR (DsCreateOperands, FirstArg);
- /* For all arguments in the list... */
+ /* Get all arguments in the list */
Arg = FirstArg;
while (Arg)
{
- Status = AcpiDsCreateOperand (WalkState, Arg, ArgCount);
- if (ACPI_FAILURE (Status))
+ if (Index >= ACPI_OBJ_NUM_OPERANDS)
{
- goto Cleanup;
+ return_ACPI_STATUS (AE_BAD_DATA);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
- ArgCount, Arg, FirstArg));
+ Arguments[Index] = Arg;
+ WalkState->Operands [Index] = NULL;
/* Move on to next argument, if any */
Arg = Arg->Common.Next;
ArgCount++;
+ Index++;
+ }
+
+ Index--;
+
+ /* It is the appropriate order to get objects from the Result stack */
+
+ for (i = 0; i < ArgCount; i++)
+ {
+ Arg = Arguments[Index];
+
+ /* Force the filling of the operand stack in inverse order */
+
+ WalkState->OperandIndex = Index;
+
+ Status = AcpiDsCreateOperand (WalkState, Arg, Index);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
+
+ Count++;
+ Index--;
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Arg #%d (%p) done, Arg1=%p\n",
+ Index, Arg, FirstArg));
}
return_ACPI_STATUS (Status);
@@ -748,11 +889,122 @@
* pop everything off of the operand stack and delete those
* objects
*/
- (void) AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
+ AcpiDsObjStackPopAndDelete (ArgCount, WalkState);
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "While creating Arg %d - %s\n",
- (ArgCount + 1), AcpiFormatException (Status)));
+ ACPI_EXCEPTION ((AE_INFO, Status, "While creating Arg %d", Index));
return_ACPI_STATUS (Status);
}
+/*****************************************************************************
+ *
+ * FUNCTION: AcpiDsEvaluateNamePath
+ *
+ * PARAMETERS: WalkState - Current state of the parse tree walk,
+ * the opcode of current operation should be
+ * AML_INT_NAMEPATH_OP
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Translate the -NamePath- parse tree object to the equivalent
+ * interpreter object, convert it to value, if needed, duplicate
+ * it, if needed, and push it onto the current result stack.
+ *
+ ****************************************************************************/
+
+ACPI_STATUS
+AcpiDsEvaluateNamePath (
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status = AE_OK;
+ ACPI_PARSE_OBJECT *Op = WalkState->Op;
+ ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
+ ACPI_OPERAND_OBJECT *NewObjDesc;
+ UINT8 Type;
+
+
+ ACPI_FUNCTION_TRACE_PTR (DsEvaluateNamePath, WalkState);
+
+
+ if (!Op->Common.Parent)
+ {
+ /* This happens after certain exception processing */
+
+ goto Exit;
+ }
+
+ if ((Op->Common.Parent->Common.AmlOpcode == AML_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_VAR_PACKAGE_OP) ||
+ (Op->Common.Parent->Common.AmlOpcode == AML_REF_OF_OP))
+ {
+ /* TBD: Should we specify this feature as a bit of OpInfo->Flags of these opcodes? */
+
+ goto Exit;
+ }
+
+ Status = AcpiDsCreateOperand (WalkState, Op, 0);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+
+ if (Op->Common.Flags & ACPI_PARSEOP_TARGET)
+ {
+ NewObjDesc = *Operand;
+ goto PushResult;
+ }
+
+ Type = ACPI_GET_OBJECT_TYPE (*Operand);
+
+ Status = AcpiExResolveToValue (Operand, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+
+ if (Type == ACPI_TYPE_INTEGER)
+ {
+ /* It was incremented by AcpiExResolveToValue */
+
+ AcpiUtRemoveReference (*Operand);
+
+ Status = AcpiUtCopyIobjectToIobject (*Operand, &NewObjDesc, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Exit;
+ }
+ }
+ else
+ {
+ /*
+ * The object either was anew created or is
+ * a Namespace node - don't decrement it.
+ */
+ NewObjDesc = *Operand;
+ }
+
+ /* Cleanup for name-path operand */
+
+ Status = AcpiDsObjStackPop (1, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ WalkState->ResultObj = NewObjDesc;
+ goto Exit;
+ }
+
+PushResult:
+
+ WalkState->ResultObj = NewObjDesc;
+
+ Status = AcpiDsResultPush (WalkState->ResultObj, WalkState);
+ if (ACPI_SUCCESS (Status))
+ {
+ /* Force to take it from stack */
+
+ Op->Common.Flags |= ACPI_PARSEOP_IN_STACK;
+ }
+
+Exit:
+
+ return_ACPI_STATUS (Status);
+}
Index: rslist.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rslist.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rslist.c -L sys/contrib/dev/acpica/rslist.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rslist.c
+++ sys/contrib/dev/acpica/rslist.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rslist - Linked list utilities
- * $Revision: 34 $
+ * $Revision: 1.62 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,475 +125,162 @@
/*******************************************************************************
*
- * FUNCTION: AcpiRsGetResourceType
+ * FUNCTION: AcpiRsConvertAmlToResources
*
- * PARAMETERS: ResourceStartByte - Byte 0 of a resource descriptor
+ * PARAMETERS: ACPI_WALK_AML_CALLBACK
+ * ResourcePtr - Pointer to the buffer that will
+ * contain the output structures
*
- * RETURN: The Resource Type (Name) with no extraneous bits
+ * RETURN: Status
*
- * DESCRIPTION: Extract the Resource Type/Name from the first byte of
- * a resource descriptor.
+ * DESCRIPTION: Convert an AML resource to an internal representation of the
+ * resource that is aligned and easier to access.
*
******************************************************************************/
-UINT8
-AcpiRsGetResourceType (
- UINT8 ResourceStartByte)
+ACPI_STATUS
+AcpiRsConvertAmlToResources (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context)
{
+ ACPI_RESOURCE **ResourcePtr = ACPI_CAST_INDIRECT_PTR (
+ ACPI_RESOURCE, Context);
+ ACPI_RESOURCE *Resource;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_ENTRY ();
+
+ ACPI_FUNCTION_TRACE (RsConvertAmlToResources);
/*
- * Determine if this is a small or large resource
+ * Check that the input buffer and all subsequent pointers into it
+ * are aligned on a native word boundary. Most important on IA64
*/
- switch (ResourceStartByte & ACPI_RDESC_TYPE_MASK)
+ Resource = *ResourcePtr;
+ if (ACPI_IS_MISALIGNED (Resource))
{
- case ACPI_RDESC_TYPE_SMALL:
-
- /*
- * Small Resource Type -- Only bits 6:3 are valid
- */
- return ((UINT8) (ResourceStartByte & ACPI_RDESC_SMALL_MASK));
-
+ ACPI_WARNING ((AE_INFO,
+ "Misaligned resource pointer %p", Resource));
+ }
- case ACPI_RDESC_TYPE_LARGE:
+ /* Convert the AML byte stream resource to a local resource struct */
- /*
- * Large Resource Type -- All bits are valid
- */
- return (ResourceStartByte);
+ Status = AcpiRsConvertAmlToResource (
+ Resource, ACPI_CAST_PTR (AML_RESOURCE, Aml),
+ AcpiGbl_GetResourceDispatch[ResourceIndex]);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not convert AML resource (Type %X)", *Aml));
+ return_ACPI_STATUS (Status);
+ }
+ ACPI_DEBUG_PRINT ((ACPI_DB_RESOURCES,
+ "Type %.2X, AmlLength %.2X InternalLength %.2X\n",
+ AcpiUtGetResourceType (Aml), Length,
+ Resource->Length));
- default:
- /* No other types of resource descriptor */
- break;
- }
+ /* Point to the next structure in the output buffer */
- return (0xFF);
+ *ResourcePtr = ACPI_ADD_PTR (void, Resource, Resource->Length);
+ return_ACPI_STATUS (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiRsByteStreamToList
+ * FUNCTION: AcpiRsConvertResourcesToAml
*
- * PARAMETERS: ByteStreamBuffer - Pointer to the resource byte stream
- * ByteStreamBufferLength - Length of ByteStreamBuffer
- * OutputBuffer - Pointer to the buffer that will
- * contain the output structures
+ * PARAMETERS: Resource - Pointer to the resource linked list
+ * AmlSizeNeeded - Calculated size of the byte stream
+ * needed from calling AcpiRsGetAmlLength()
+ * The size of the OutputBuffer is
+ * guaranteed to be >= AmlSizeNeeded
+ * OutputBuffer - Pointer to the buffer that will
+ * contain the byte stream
*
* RETURN: Status
*
- * DESCRIPTION: Takes the resource byte stream and parses it, creating a
- * linked list of resources in the caller's output buffer
+ * DESCRIPTION: Takes the resource linked list and parses it, creating a
+ * byte stream of resources in the caller's output buffer
*
******************************************************************************/
ACPI_STATUS
-AcpiRsByteStreamToList (
- UINT8 *ByteStreamBuffer,
- UINT32 ByteStreamBufferLength,
+AcpiRsConvertResourcesToAml (
+ ACPI_RESOURCE *Resource,
+ ACPI_SIZE AmlSizeNeeded,
UINT8 *OutputBuffer)
{
+ UINT8 *Aml = OutputBuffer;
+ UINT8 *EndAml = OutputBuffer + AmlSizeNeeded;
ACPI_STATUS Status;
- ACPI_SIZE BytesParsed = 0;
- UINT8 ResourceType = 0;
- ACPI_SIZE BytesConsumed = 0;
- UINT8 *Buffer = OutputBuffer;
- ACPI_SIZE StructureSize = 0;
- BOOLEAN EndTagProcessed = FALSE;
- ACPI_RESOURCE *Resource;
- ACPI_FUNCTION_TRACE ("RsByteStreamToList");
+
+ ACPI_FUNCTION_TRACE (RsConvertResourcesToAml);
- while (BytesParsed < ByteStreamBufferLength &&
- !EndTagProcessed)
+ /* Walk the resource descriptor list, convert each descriptor */
+
+ while (Aml < EndAml)
{
- /*
- * The next byte in the stream is the resource type
- */
- ResourceType = AcpiRsGetResourceType (*ByteStreamBuffer);
+ /* Validate the (internal) Resource Type */
- switch (ResourceType)
+ if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
{
- case ACPI_RDESC_TYPE_MEMORY_24:
- /*
- * 24-Bit Memory Resource
- */
- Status = AcpiRsMemory24Resource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_LARGE_VENDOR:
- /*
- * Vendor Defined Resource
- */
- Status = AcpiRsVendorResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_MEMORY_32:
- /*
- * 32-Bit Memory Range Resource
- */
- Status = AcpiRsMemory32RangeResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_FIXED_MEMORY_32:
- /*
- * 32-Bit Fixed Memory Resource
- */
- Status = AcpiRsFixedMemory32Resource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE:
- /*
- * 64-Bit Address Resource
- */
- Status = AcpiRsAddress64Resource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE:
- /*
- * 32-Bit Address Resource
- */
- Status = AcpiRsAddress32Resource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE:
- /*
- * 16-Bit Address Resource
- */
- Status = AcpiRsAddress16Resource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_EXTENDED_XRUPT:
- /*
- * Extended IRQ
- */
- Status = AcpiRsExtendedIrqResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_IRQ_FORMAT:
- /*
- * IRQ Resource
- */
- Status = AcpiRsIrqResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_DMA_FORMAT:
- /*
- * DMA Resource
- */
- Status = AcpiRsDmaResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_START_DEPENDENT:
- /*
- * Start Dependent Functions Resource
- */
- Status = AcpiRsStartDependFnsResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_END_DEPENDENT:
- /*
- * End Dependent Functions Resource
- */
- Status = AcpiRsEndDependFnsResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_IO_PORT:
- /*
- * IO Port Resource
- */
- Status = AcpiRsIoResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_FIXED_IO_PORT:
- /*
- * Fixed IO Port Resource
- */
- Status = AcpiRsFixedIoResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_SMALL_VENDOR:
- /*
- * Vendor Specific Resource
- */
- Status = AcpiRsVendorResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- case ACPI_RDESC_TYPE_END_TAG:
- /*
- * End Tag
- */
- EndTagProcessed = TRUE;
- Status = AcpiRsEndTagResource (ByteStreamBuffer,
- &BytesConsumed, &Buffer, &StructureSize);
- break;
-
-
- default:
- /*
- * Invalid/Unknown resource type
- */
- Status = AE_AML_INVALID_RESOURCE_TYPE;
- break;
+ ACPI_ERROR ((AE_INFO,
+ "Invalid descriptor type (%X) in resource list",
+ Resource->Type));
+ return_ACPI_STATUS (AE_BAD_DATA);
}
+ /* Perform the conversion */
+
+ Status = AcpiRsConvertResourceToAml (Resource,
+ ACPI_CAST_PTR (AML_RESOURCE, Aml),
+ AcpiGbl_SetResourceDispatch[Resource->Type]);
if (ACPI_FAILURE (Status))
{
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not convert resource (type %X) to AML",
+ Resource->Type));
return_ACPI_STATUS (Status);
}
- /*
- * Update the return value and counter
- */
- BytesParsed += BytesConsumed;
+ /* Perform final sanity check on the new AML resource descriptor */
- /*
- * Set the byte stream to point to the next resource
- */
- ByteStreamBuffer += BytesConsumed;
-
- /*
- * Set the Buffer to the next structure
- */
- Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer);
- Resource->Length = (UINT32) ACPI_ALIGN_RESOURCE_SIZE (Resource->Length);
- Buffer += ACPI_ALIGN_RESOURCE_SIZE (StructureSize);
-
- } /* end while */
-
- /*
- * Check the reason for exiting the while loop
- */
- if (!EndTagProcessed)
- {
- return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiRsListToByteStream
- *
- * PARAMETERS: LinkedList - Pointer to the resource linked list
- * ByteSteamSizeNeeded - Calculated size of the byte stream
- * needed from calling
- * AcpiRsGetByteStreamLength()
- * The size of the OutputBuffer is
- * guaranteed to be >=
- * ByteStreamSizeNeeded
- * OutputBuffer - Pointer to the buffer that will
- * contain the byte stream
- *
- * RETURN: Status
- *
- * DESCRIPTION: Takes the resource linked list and parses it, creating a
- * byte stream of resources in the caller's output buffer
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiRsListToByteStream (
- ACPI_RESOURCE *LinkedList,
- ACPI_SIZE ByteStreamSizeNeeded,
- UINT8 *OutputBuffer)
-{
- ACPI_STATUS Status;
- UINT8 *Buffer = OutputBuffer;
- ACPI_SIZE BytesConsumed = 0;
- BOOLEAN Done = FALSE;
-
-
- ACPI_FUNCTION_TRACE ("RsListToByteStream");
-
-
- while (!Done)
- {
- switch (LinkedList->Id)
+ Status = AcpiUtValidateResource (
+ ACPI_CAST_PTR (AML_RESOURCE, Aml), NULL);
+ if (ACPI_FAILURE (Status))
{
- case ACPI_RSTYPE_IRQ:
- /*
- * IRQ Resource
- */
- Status = AcpiRsIrqStream (LinkedList, &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_DMA:
- /*
- * DMA Resource
- */
- Status = AcpiRsDmaStream (LinkedList, &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_START_DPF:
- /*
- * Start Dependent Functions Resource
- */
- Status = AcpiRsStartDependFnsStream (LinkedList,
- &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_END_DPF:
- /*
- * End Dependent Functions Resource
- */
- Status = AcpiRsEndDependFnsStream (LinkedList,
- &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_IO:
- /*
- * IO Port Resource
- */
- Status = AcpiRsIoStream (LinkedList, &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_FIXED_IO:
- /*
- * Fixed IO Port Resource
- */
- Status = AcpiRsFixedIoStream (LinkedList, &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_VENDOR:
- /*
- * Vendor Defined Resource
- */
- Status = AcpiRsVendorStream (LinkedList, &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_END_TAG:
- /*
- * End Tag
- */
- Status = AcpiRsEndTagStream (LinkedList, &Buffer, &BytesConsumed);
-
- /*
- * An End Tag indicates the end of the Resource Template
- */
- Done = TRUE;
- break;
-
- case ACPI_RSTYPE_MEM24:
- /*
- * 24-Bit Memory Resource
- */
- Status = AcpiRsMemory24Stream (LinkedList, &Buffer, &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_MEM32:
- /*
- * 32-Bit Memory Range Resource
- */
- Status = AcpiRsMemory32RangeStream (LinkedList, &Buffer,
- &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_FIXED_MEM32:
- /*
- * 32-Bit Fixed Memory Resource
- */
- Status = AcpiRsFixedMemory32Stream (LinkedList, &Buffer,
- &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_ADDRESS16:
- /*
- * 16-Bit Address Descriptor Resource
- */
- Status = AcpiRsAddress16Stream (LinkedList, &Buffer,
- &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_ADDRESS32:
- /*
- * 32-Bit Address Descriptor Resource
- */
- Status = AcpiRsAddress32Stream (LinkedList, &Buffer,
- &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_ADDRESS64:
- /*
- * 64-Bit Address Descriptor Resource
- */
- Status = AcpiRsAddress64Stream (LinkedList, &Buffer,
- &BytesConsumed);
- break;
-
- case ACPI_RSTYPE_EXT_IRQ:
- /*
- * Extended IRQ Resource
- */
- Status = AcpiRsExtendedIrqStream (LinkedList, &Buffer,
- &BytesConsumed);
- break;
-
- default:
- /*
- * If we get here, everything is out of sync,
- * so exit with an error
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid descriptor type (%X) in resource list\n",
- LinkedList->Id));
- Status = AE_BAD_DATA;
- break;
+ return_ACPI_STATUS (Status);
+ }
- } /* switch (LinkedList->Id) */
+ /* Check for end-of-list, normal exit */
- if (ACPI_FAILURE (Status))
+ if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)
{
- return_ACPI_STATUS (Status);
+ /* An End Tag indicates the end of the input Resource Template */
+
+ return_ACPI_STATUS (AE_OK);
}
/*
- * Set the Buffer to point to the open byte
+ * Extract the total length of the new descriptor and set the
+ * Aml to point to the next (output) resource descriptor
*/
- Buffer += BytesConsumed;
+ Aml += AcpiUtGetDescriptorLength (Aml);
- /*
- * Point to the next object
- */
- LinkedList = ACPI_PTR_ADD (ACPI_RESOURCE,
- LinkedList, LinkedList->Length);
+ /* Point to the next input resource descriptor */
+
+ Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
}
- return_ACPI_STATUS (AE_OK);
+ /* Completed buffer, but did not find an EndTag resource descriptor */
+
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
Index: exresop.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exresop.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exresop.c -L sys/contrib/dev/acpica/exresop.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exresop.c
+++ sys/contrib/dev/acpica/exresop.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exresop - AML Interpreter operand/object resolution
- * $Revision: 70 $
+ * $Revision: 1.95 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,11 +121,20 @@
#include <contrib/dev/acpica/amlcode.h>
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/acinterp.h>
+#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_EXECUTER
ACPI_MODULE_NAME ("exresop")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiExCheckObjectType (
+ ACPI_OBJECT_TYPE TypeNeeded,
+ ACPI_OBJECT_TYPE ThisType,
+ void *Object);
+
/*******************************************************************************
*
@@ -141,13 +150,13 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiExCheckObjectType (
ACPI_OBJECT_TYPE TypeNeeded,
ACPI_OBJECT_TYPE ThisType,
void *Object)
{
- ACPI_FUNCTION_NAME ("ExCheckObjectType");
+ ACPI_FUNCTION_ENTRY ();
if (TypeNeeded == ACPI_TYPE_ANY)
@@ -173,8 +182,8 @@
if (TypeNeeded != ThisType)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [%s], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed type [%s], found [%s] %p",
AcpiUtGetTypeName (TypeNeeded),
AcpiUtGetTypeName (ThisType), Object));
@@ -215,14 +224,14 @@
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status = AE_OK;
UINT8 ObjectType;
- void *TempNode;
UINT32 ArgTypes;
const ACPI_OPCODE_INFO *OpInfo;
UINT32 ThisArgType;
ACPI_OBJECT_TYPE TypeNeeded;
+ UINT16 TargetOp = 0;
- ACPI_FUNCTION_TRACE_U32 ("ExResolveOperands", Opcode);
+ ACPI_FUNCTION_TRACE_U32 (ExResolveOperands, Opcode);
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
@@ -234,13 +243,14 @@
ArgTypes = OpInfo->RuntimeArgs;
if (ArgTypes == ARGI_INVALID_OPCODE)
{
- ACPI_REPORT_ERROR (("ResolveOperands: %X is not a valid AML opcode\n",
+ ACPI_ERROR ((AE_INFO, "Unknown AML opcode %X",
Opcode));
return_ACPI_STATUS (AE_AML_INTERNAL);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Opcode %X [%s] RequiredOperandTypes=%8.8X \n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Opcode %X [%s] RequiredOperandTypes=%8.8X\n",
Opcode, OpInfo->Name, ArgTypes));
/*
@@ -254,7 +264,7 @@
{
if (!StackPtr || !*StackPtr)
{
- ACPI_REPORT_ERROR (("ResolveOperands: Null stack entry at %p\n",
+ ACPI_ERROR ((AE_INFO, "Null stack entry at %p",
StackPtr));
return_ACPI_STATUS (AE_AML_INTERNAL);
@@ -270,9 +280,21 @@
{
case ACPI_DESC_TYPE_NAMED:
- /* Node */
+ /* Namespace Node */
ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
+
+ /*
+ * Resolve an alias object. The construction of these objects
+ * guarantees that there is only one level of alias indirection;
+ * thus, the attached object is always the aliased namespace node
+ */
+ if (ObjectType == ACPI_TYPE_LOCAL_ALIAS)
+ {
+ ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjDesc);
+ *StackPtr = ObjDesc;
+ ObjectType = ((ACPI_NAMESPACE_NODE *) ObjDesc)->Type;
+ }
break;
@@ -286,7 +308,8 @@
if (!AcpiUtValidObjectType (ObjectType))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Bad operand object type [%X]\n",
+ ACPI_ERROR ((AE_INFO,
+ "Bad operand object type [%X]",
ObjectType));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -294,9 +317,8 @@
if (ObjectType == (UINT8) ACPI_TYPE_LOCAL_REFERENCE)
{
- /*
- * Decode the Reference
- */
+ /* Decode the Reference */
+
OpInfo = AcpiPsGetOpcodeInfo (Opcode);
if (OpInfo->Class == AML_CLASS_UNKNOWN)
{
@@ -306,12 +328,16 @@
switch (ObjDesc->Reference.Opcode)
{
case AML_DEBUG_OP:
- case AML_NAME_OP:
+ TargetOp = AML_DEBUG_OP;
+
+ /*lint -fallthrough */
+
case AML_INDEX_OP:
case AML_REF_OF_OP:
case AML_ARG_OP:
case AML_LOCAL_OP:
- case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
+ case AML_LOAD_OP: /* DdbHandle from LOAD_OP or LOAD_TABLE_OP */
+ case AML_INT_NAMEPATH_OP: /* Reference to a named object */
ACPI_DEBUG_ONLY_MEMBERS (ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
"Operand is a Reference, RefOpcode [%s]\n",
@@ -319,10 +345,9 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Operand is a Reference, Unknown Reference Opcode %X [%s]\n",
- ObjDesc->Reference.Opcode,
- (AcpiPsGetOpcodeInfo (ObjDesc->Reference.Opcode))->Name));
+ ACPI_ERROR ((AE_INFO,
+ "Operand is a Reference, Unknown Reference Opcode: %X",
+ ObjDesc->Reference.Opcode));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
@@ -334,17 +359,15 @@
/* Invalid descriptor */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Invalid descriptor %p [%s]\n",
- ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
+ ACPI_ERROR ((AE_INFO,
+ "Invalid descriptor %p [%s]",
+ ObjDesc, AcpiUtGetDescriptorName (ObjDesc)));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
}
+ /* Get one argument type, point to the next */
- /*
- * Get one argument type, point to the next
- */
ThisArgType = GET_CURRENT_ARG_TYPE (ArgTypes);
INCREMENT_ARG_LIST (ArgTypes);
@@ -360,26 +383,31 @@
(ACPI_GET_OBJECT_TYPE (ObjDesc) == ACPI_TYPE_STRING))
{
/*
- * String found - the string references a named object and must be
- * resolved to a node
+ * String found - the string references a named object and
+ * must be resolved to a node
*/
goto NextOperand;
}
- /* Else not a string - fall through to the normal Reference case below */
+ /*
+ * Else not a string - fall through to the normal Reference
+ * case below
+ */
/*lint -fallthrough */
case ARGI_REFERENCE: /* References: */
case ARGI_INTEGER_REF:
case ARGI_OBJECT_REF:
case ARGI_DEVICE_REF:
- case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
- case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
- case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
+ case ARGI_TARGETREF: /* Allows implicit conversion rules before store */
+ case ARGI_FIXED_TARGET: /* No implicit conversion before store to target */
+ case ARGI_SIMPLE_TARGET: /* Name, Local, or Arg - no implicit conversion */
- /* Need an operand of type ACPI_TYPE_LOCAL_REFERENCE */
-
- if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED) /* Node (name) ptr OK as-is */
+ /*
+ * Need an operand of type ACPI_TYPE_LOCAL_REFERENCE
+ * A Namespace Node is OK as-is
+ */
+ if (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_NAMED)
{
goto NextOperand;
}
@@ -390,21 +418,10 @@
{
return_ACPI_STATUS (Status);
}
-
- if (AML_NAME_OP == ObjDesc->Reference.Opcode)
- {
- /*
- * Convert an indirect name ptr to direct name ptr and put
- * it on the stack
- */
- TempNode = ObjDesc->Reference.Object;
- AcpiUtRemoveReference (ObjDesc);
- (*StackPtr) = TempNode;
- }
goto NextOperand;
- case ARGI_ANYTYPE:
+ case ARGI_DATAREFOBJ: /* Store operator only */
/*
* We don't want to resolve IndexOp reference objects during
@@ -425,7 +442,6 @@
break;
}
-
/*
* Resolve this object to a value
*/
@@ -487,7 +503,7 @@
/*
* The more complex cases allow multiple resolved object types
*/
- case ARGI_INTEGER: /* Number */
+ case ARGI_INTEGER:
/*
* Need an operand of type ACPI_TYPE_INTEGER,
@@ -499,8 +515,8 @@
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -508,6 +524,11 @@
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -523,8 +544,8 @@
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -532,6 +553,11 @@
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -548,8 +574,8 @@
{
if (Status == AE_TYPE)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -557,6 +583,11 @@
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
goto NextOperand;
@@ -574,8 +605,8 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -604,11 +635,16 @@
{
return_ACPI_STATUS (Status);
}
+
+ if (ObjDesc != *StackPtr)
+ {
+ AcpiUtRemoveReference (ObjDesc);
+ }
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Integer/String/Buffer], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Integer/String/Buffer], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -635,8 +671,8 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Buffer/String/Package/Reference], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Buffer/String/Package/Reference], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -658,8 +694,8 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Buffer/String/Package], found [%s] %p\n",
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Buffer/String/Package], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -667,23 +703,69 @@
goto NextOperand;
- case ARGI_REGION_OR_FIELD:
+ case ARGI_REGION_OR_BUFFER: /* Used by Load() only */
- /* Need an operand of type ACPI_TYPE_REGION or a FIELD in a region */
+ /* Need an operand of type REGION or a BUFFER (which could be a resolved region field) */
switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
{
+ case ACPI_TYPE_BUFFER:
case ACPI_TYPE_REGION:
+
+ /* Valid operand */
+ break;
+
+ default:
+ ACPI_ERROR ((AE_INFO,
+ "Needed [Region/Buffer], found [%s] %p",
+ AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
+
+ return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
+ }
+ goto NextOperand;
+
+
+ case ARGI_DATAREFOBJ:
+
+ /* Used by the Store() operator only */
+
+ switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
+ {
+ case ACPI_TYPE_INTEGER:
+ case ACPI_TYPE_PACKAGE:
+ case ACPI_TYPE_STRING:
+ case ACPI_TYPE_BUFFER:
+ case ACPI_TYPE_BUFFER_FIELD:
+ case ACPI_TYPE_LOCAL_REFERENCE:
case ACPI_TYPE_LOCAL_REGION_FIELD:
case ACPI_TYPE_LOCAL_BANK_FIELD:
case ACPI_TYPE_LOCAL_INDEX_FIELD:
+ case ACPI_TYPE_DDB_HANDLE:
/* Valid operand */
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Needed [Region/RegionField], found [%s] %p\n",
+
+ if (AcpiGbl_EnableInterpreterSlack)
+ {
+ /*
+ * Enable original behavior of Store(), allowing any and all
+ * objects as the source operand. The ACPI spec does not
+ * allow this, however.
+ */
+ break;
+ }
+
+ if (TargetOp == AML_DEBUG_OP)
+ {
+ /* Allow store of any object to the Debug object */
+
+ break;
+ }
+
+ ACPI_ERROR ((AE_INFO,
+ "Needed Integer/Buffer/String/Package/Ref/Ddb], found [%s] %p",
AcpiUtGetObjectTypeName (ObjDesc), ObjDesc));
return_ACPI_STATUS (AE_AML_OPERAND_TYPE);
@@ -695,8 +777,8 @@
/* Unknown type */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Internal - Unknown ARGI (required operand) type %X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Internal - Unknown ARGI (required operand) type %X",
ThisArgType));
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -722,8 +804,7 @@
{
StackPtr--;
}
-
- } /* while (*Types) */
+ }
return_ACPI_STATUS (Status);
}
Index: nsxfname.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsxfname.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsxfname.c -L sys/contrib/dev/acpica/nsxfname.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsxfname.c
+++ sys/contrib/dev/acpica/nsxfname.c
@@ -2,7 +2,7 @@
*
* Module Name: nsxfname - Public interfaces to the ACPI subsystem
* ACPI Namespace oriented interfaces
- * $Revision: 101 $
+ * $Revision: 1.112 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,9 +130,9 @@
* FUNCTION: AcpiGetHandle
*
* PARAMETERS: Parent - Object to search under (search scope).
- * PathName - Pointer to an asciiz string containing the
- * name
- * RetHandle - Where the return handle is placed
+ * Pathname - Pointer to an asciiz string containing the
+ * name
+ * RetHandle - Where the return handle is returned
*
* RETURN: Status
*
@@ -168,41 +168,42 @@
if (Parent)
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
-
PrefixNode = AcpiNsMapHandleToNode (Parent);
if (!PrefixNode)
{
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return (AE_BAD_PARAMETER);
}
+ }
+
+ /*
+ * Valid cases are:
+ * 1) Fully qualified pathname
+ * 2) Parent + Relative pathname
+ *
+ * Error for <null Parent + relative path>
+ */
+ if (AcpiNsValidRootPrefix (Pathname[0]))
+ {
+ /* Pathname is fully qualified (starts with '\') */
+
+ /* Special case for root-only, since we can't search for it */
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
+ if (!ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH))
{
- return (Status);
+ *RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootNode);
+ return (AE_OK);
}
}
-
- /* Special case for root, since we can't search for it */
-
- if (ACPI_STRCMP (Pathname, ACPI_NS_ROOT_PATH) == 0)
+ else if (!PrefixNode)
{
- *RetHandle = AcpiNsConvertEntryToHandle (AcpiGbl_RootNode);
- return (AE_OK);
+ /* Relative path with null prefix is disallowed */
+
+ return (AE_BAD_PARAMETER);
}
- /*
- * Find the Node and convert to a handle
- */
- Status = AcpiNsGetNodeByPath (Pathname, PrefixNode, ACPI_NS_NO_UPSEARCH,
- &Node);
+ /* Find the Node and convert to a handle */
- *RetHandle = NULL;
+ Status = AcpiNsGetNode (PrefixNode, Pathname, ACPI_NS_NO_UPSEARCH, &Node);
if (ACPI_SUCCESS (Status))
{
*RetHandle = AcpiNsConvertEntryToHandle (Node);
@@ -211,6 +212,8 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetHandle)
+
/******************************************************************************
*
@@ -298,13 +301,15 @@
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetName)
+
/******************************************************************************
*
* FUNCTION: AcpiGetObjectInfo
*
* PARAMETERS: Handle - Object Handle
- * Info - Where the info is returned
+ * Buffer - Where the info is returned
*
* RETURN: Status
*
@@ -321,7 +326,7 @@
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *Node;
- ACPI_DEVICE_INFO Info;
+ ACPI_DEVICE_INFO *Info;
ACPI_DEVICE_INFO *ReturnInfo;
ACPI_COMPATIBLE_ID_LIST *CidList = NULL;
ACPI_SIZE Size;
@@ -340,61 +345,66 @@
return (Status);
}
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_DEVICE_INFO));
+ if (!Info)
+ {
+ return (AE_NO_MEMORY);
+ }
+
Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ goto Cleanup;
}
Node = AcpiNsMapHandleToNode (Handle);
if (!Node)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- return (AE_BAD_PARAMETER);
+ goto Cleanup;
}
/* Init return structure */
Size = sizeof (ACPI_DEVICE_INFO);
- ACPI_MEMSET (&Info, 0, Size);
- Info.Type = Node->Type;
- Info.Name = Node->Name.Integer;
- Info.Valid = 0;
+ Info->Type = Node->Type;
+ Info->Name = Node->Name.Integer;
+ Info->Valid = 0;
Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
- return (Status);
+ goto Cleanup;
}
/* If not a device, we are all done */
- if (Info.Type == ACPI_TYPE_DEVICE)
+ if (Info->Type == ACPI_TYPE_DEVICE)
{
/*
* Get extra info for ACPI Devices objects only:
* Run the Device _HID, _UID, _CID, _STA, _ADR and _SxD methods.
*
* Note: none of these methods are required, so they may or may
- * not be present for this device. The Info.Valid bitfield is used
+ * not be present for this device. The Info->Valid bitfield is used
* to indicate which methods were found and ran successfully.
*/
/* Execute the Device._HID method */
- Status = AcpiUtExecute_HID (Node, &Info.HardwareId);
+ Status = AcpiUtExecute_HID (Node, &Info->HardwareId);
if (ACPI_SUCCESS (Status))
{
- Info.Valid |= ACPI_VALID_HID;
+ Info->Valid |= ACPI_VALID_HID;
}
/* Execute the Device._UID method */
- Status = AcpiUtExecute_UID (Node, &Info.UniqueId);
+ Status = AcpiUtExecute_UID (Node, &Info->UniqueId);
if (ACPI_SUCCESS (Status))
{
- Info.Valid |= ACPI_VALID_UID;
+ Info->Valid |= ACPI_VALID_UID;
}
/* Execute the Device._CID method */
@@ -402,37 +412,34 @@
Status = AcpiUtExecute_CID (Node, &CidList);
if (ACPI_SUCCESS (Status))
{
- Size += ((ACPI_SIZE) CidList->Count - 1) *
- sizeof (ACPI_COMPATIBLE_ID);
- Info.Valid |= ACPI_VALID_CID;
+ Size += CidList->Size;
+ Info->Valid |= ACPI_VALID_CID;
}
/* Execute the Device._STA method */
- Status = AcpiUtExecute_STA (Node, &Info.CurrentStatus);
+ Status = AcpiUtExecute_STA (Node, &Info->CurrentStatus);
if (ACPI_SUCCESS (Status))
{
- Info.Valid |= ACPI_VALID_STA;
+ Info->Valid |= ACPI_VALID_STA;
}
/* Execute the Device._ADR method */
Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node,
- &Info.Address);
+ &Info->Address);
if (ACPI_SUCCESS (Status))
{
- Info.Valid |= ACPI_VALID_ADR;
+ Info->Valid |= ACPI_VALID_ADR;
}
/* Execute the Device._SxD methods */
- Status = AcpiUtExecute_Sxds (Node, Info.HighestDstates);
+ Status = AcpiUtExecute_Sxds (Node, Info->HighestDstates);
if (ACPI_SUCCESS (Status))
{
- Info.Valid |= ACPI_VALID_SXDS;
+ Info->Valid |= ACPI_VALID_SXDS;
}
-
- Status = AE_OK;
}
/* Validate/Allocate/Clear caller buffer */
@@ -446,7 +453,7 @@
/* Populate the return buffer */
ReturnInfo = Buffer->Pointer;
- ACPI_MEMCPY (ReturnInfo, &Info, sizeof (ACPI_DEVICE_INFO));
+ ACPI_MEMCPY (ReturnInfo, Info, sizeof (ACPI_DEVICE_INFO));
if (CidList)
{
@@ -455,10 +462,13 @@
Cleanup:
+ ACPI_FREE (Info);
if (CidList)
{
- ACPI_MEM_FREE (CidList);
+ ACPI_FREE (CidList);
}
return (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetObjectInfo)
+
Index: rsxface.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/rsxface.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/rsxface.c -L sys/contrib/dev/acpica/rsxface.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/rsxface.c
+++ sys/contrib/dev/acpica/rsxface.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: rsxface - Public interfaces to the resource manager
- * $Revision: 31 $
+ * $Revision: 1.48 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,24 +119,120 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acresrc.h>
+#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_RESOURCES
ACPI_MODULE_NAME ("rsxface")
+/* Local macros for 16,32-bit to 64-bit conversion */
+
+#define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field)
+#define ACPI_COPY_ADDRESS(Out, In) \
+ ACPI_COPY_FIELD(Out, In, ResourceType); \
+ ACPI_COPY_FIELD(Out, In, ProducerConsumer); \
+ ACPI_COPY_FIELD(Out, In, Decode); \
+ ACPI_COPY_FIELD(Out, In, MinAddressFixed); \
+ ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \
+ ACPI_COPY_FIELD(Out, In, Info); \
+ ACPI_COPY_FIELD(Out, In, Granularity); \
+ ACPI_COPY_FIELD(Out, In, Minimum); \
+ ACPI_COPY_FIELD(Out, In, Maximum); \
+ ACPI_COPY_FIELD(Out, In, TranslationOffset); \
+ ACPI_COPY_FIELD(Out, In, AddressLength); \
+ ACPI_COPY_FIELD(Out, In, ResourceSource);
+
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiRsMatchVendorResource (
+ ACPI_RESOURCE *Resource,
+ void *Context);
+
+static ACPI_STATUS
+AcpiRsValidateParameters (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *Buffer,
+ ACPI_NAMESPACE_NODE **ReturnNode);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiRsValidateParameters
+ *
+ * PARAMETERS: DeviceHandle - Handle to a device
+ * Buffer - Pointer to a data buffer
+ * ReturnNode - Pointer to where the device node is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Common parameter validation for resource interfaces
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiRsValidateParameters (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *Buffer,
+ ACPI_NAMESPACE_NODE **ReturnNode)
+{
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ ACPI_FUNCTION_TRACE (RsValidateParameters);
+
+
+ /*
+ * Must have a valid handle to an ACPI device
+ */
+ if (!DeviceHandle)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ Node = AcpiNsMapHandleToNode (DeviceHandle);
+ if (!Node)
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ if (Node->Type != ACPI_TYPE_DEVICE)
+ {
+ return_ACPI_STATUS (AE_TYPE);
+ }
+
+ /*
+ * Validate the user buffer object
+ *
+ * if there is a non-zero buffer length we also need a valid pointer in
+ * the buffer. If it's a zero buffer length, we'll be returning the
+ * needed buffer size (later), so keep going.
+ */
+ Status = AcpiUtValidateBuffer (Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ *ReturnNode = Node;
+ return_ACPI_STATUS (AE_OK);
+}
+
/*******************************************************************************
*
* FUNCTION: AcpiGetIrqRoutingTable
*
- * PARAMETERS: DeviceHandle - a handle to the Bus device we are querying
- * RetBuffer - a pointer to a buffer to receive the
+ * PARAMETERS: DeviceHandle - Handle to the Bus device we are querying
+ * RetBuffer - Pointer to a buffer to receive the
* current resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get the IRQ routing table for a
- * specific bus. The caller must first acquire a handle for the
- * desired bus. The routine table is placed in the buffer pointed
+ * specific bus. The caller must first acquire a handle for the
+ * desired bus. The routine table is placed in the buffer pointed
* to by the RetBuffer variable parameter.
*
* If the function fails an appropriate status will be returned
@@ -153,47 +249,41 @@
ACPI_BUFFER *RetBuffer)
{
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiGetIrqRoutingTable ");
+ ACPI_FUNCTION_TRACE (AcpiGetIrqRoutingTable);
- /*
- * Must have a valid handle and buffer, So we have to have a handle
- * and a return buffer structure, and if there is a non-zero buffer length
- * we also need a valid pointer in the buffer. If it's a zero buffer length,
- * we'll be returning the needed buffer size, so keep going.
- */
- if (!DeviceHandle)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* Validate parameters then dispatch to internal routine */
- Status = AcpiUtValidateBuffer (RetBuffer);
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiRsGetPrtMethodData (DeviceHandle, RetBuffer);
+ Status = AcpiRsGetPrtMethodData (Node, RetBuffer);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetIrqRoutingTable)
+
/*******************************************************************************
*
* FUNCTION: AcpiGetCurrentResources
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are querying
- * RetBuffer - a pointer to a buffer to receive the
+ * RetBuffer - Pointer to a buffer to receive the
* current resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get the current resources for a
- * specific device. The caller must first acquire a handle for
- * the desired device. The resource data is placed in the buffer
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is placed in the buffer
* pointed to by the RetBuffer variable parameter.
*
* If the function fails an appropriate status will be returned
@@ -210,47 +300,41 @@
ACPI_BUFFER *RetBuffer)
{
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiGetCurrentResources");
+ ACPI_FUNCTION_TRACE (AcpiGetCurrentResources);
- /*
- * Must have a valid handle and buffer, So we have to have a handle
- * and a return buffer structure, and if there is a non-zero buffer length
- * we also need a valid pointer in the buffer. If it's a zero buffer length,
- * we'll be returning the needed buffer size, so keep going.
- */
- if (!DeviceHandle)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* Validate parameters then dispatch to internal routine */
- Status = AcpiUtValidateBuffer (RetBuffer);
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiRsGetCrsMethodData (DeviceHandle, RetBuffer);
+ Status = AcpiRsGetCrsMethodData (Node, RetBuffer);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetCurrentResources)
+
/*******************************************************************************
*
* FUNCTION: AcpiGetPossibleResources
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
* device we are querying
- * RetBuffer - a pointer to a buffer to receive the
+ * RetBuffer - Pointer to a buffer to receive the
* resources for the device
*
* RETURN: Status
*
* DESCRIPTION: This function is called to get a list of the possible resources
- * for a specific device. The caller must first acquire a handle
- * for the desired device. The resource data is placed in the
+ * for a specific device. The caller must first acquire a handle
+ * for the desired device. The resource data is placed in the
* buffer pointed to by the RetBuffer variable.
*
* If the function fails an appropriate status will be returned
@@ -264,254 +348,366 @@
ACPI_BUFFER *RetBuffer)
{
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiGetPossibleResources");
+ ACPI_FUNCTION_TRACE (AcpiGetPossibleResources);
- /*
- * Must have a valid handle and buffer, So we have to have a handle
- * and a return buffer structure, and if there is a non-zero buffer length
- * we also need a valid pointer in the buffer. If it's a zero buffer length,
- * we'll be returning the needed buffer size, so keep going.
- */
- if (!DeviceHandle)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* Validate parameters then dispatch to internal routine */
- Status = AcpiUtValidateBuffer (RetBuffer);
+ Status = AcpiRsValidateParameters (DeviceHandle, RetBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- Status = AcpiRsGetPrsMethodData (DeviceHandle, RetBuffer);
+ Status = AcpiRsGetPrsMethodData (Node, RetBuffer);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetPossibleResources)
+
/*******************************************************************************
*
- * FUNCTION: AcpiWalkResources
+ * FUNCTION: AcpiSetCurrentResources
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
- * device we are querying
- * Path - method name of the resources we want
- * (METHOD_NAME__CRS or METHOD_NAME__PRS)
- * UserFunction - called for each resource
- * Context - passed to UserFunction
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
+ * device we are setting resources
+ * InBuffer - Pointer to a buffer containing the
+ * resources to be set for the device
*
* RETURN: Status
*
- * DESCRIPTION: Retrieves the current or possible resource list for the
- * specified device. The UserFunction is called once for
- * each resource in the list.
+ * DESCRIPTION: This function is called to set the current resources for a
+ * specific device. The caller must first acquire a handle for
+ * the desired device. The resource data is passed to the routine
+ * the buffer pointed to by the InBuffer variable.
*
******************************************************************************/
ACPI_STATUS
-AcpiWalkResources (
- ACPI_HANDLE DeviceHandle,
- char *Path,
- ACPI_WALK_RESOURCE_CALLBACK UserFunction,
- void *Context)
+AcpiSetCurrentResources (
+ ACPI_HANDLE DeviceHandle,
+ ACPI_BUFFER *InBuffer)
{
- ACPI_STATUS Status;
- ACPI_BUFFER Buffer = {ACPI_ALLOCATE_BUFFER, NULL};
- ACPI_RESOURCE *Resource;
- ACPI_RESOURCE *BufferEnd;
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+
+ ACPI_FUNCTION_TRACE (AcpiSetCurrentResources);
- ACPI_FUNCTION_TRACE ("AcpiWalkResources");
+ /* Validate the buffer, don't allow zero length */
- if (!DeviceHandle ||
- (ACPI_STRNCMP (Path, METHOD_NAME__CRS, sizeof (METHOD_NAME__CRS)) &&
- ACPI_STRNCMP (Path, METHOD_NAME__PRS, sizeof (METHOD_NAME__PRS))))
+ if ((!InBuffer) ||
+ (!InBuffer->Pointer) ||
+ (!InBuffer->Length))
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- Status = AcpiRsGetMethodData (DeviceHandle, Path, &Buffer);
+ /* Validate parameters then dispatch to internal routine */
+
+ Status = AcpiRsValidateParameters (DeviceHandle, InBuffer, &Node);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- /* Setup pointers */
+ Status = AcpiRsSetSrsMethodData (Node, InBuffer);
+ return_ACPI_STATUS (Status);
+}
+
+ACPI_EXPORT_SYMBOL (AcpiSetCurrentResources)
- Resource = (ACPI_RESOURCE *) Buffer.Pointer;
- BufferEnd = ACPI_CAST_PTR (ACPI_RESOURCE,
- ((UINT8 *) Buffer.Pointer + Buffer.Length));
- /* Walk the resource list */
+/******************************************************************************
+ *
+ * FUNCTION: AcpiResourceToAddress64
+ *
+ * PARAMETERS: Resource - Pointer to a resource
+ * Out - Pointer to the users's return buffer
+ * (a struct acpi_resource_address64)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: If the resource is an address16, address32, or address64,
+ * copy it to the address64 return buffer. This saves the
+ * caller from having to duplicate code for different-sized
+ * addresses.
+ *
+ ******************************************************************************/
- for (;;)
+ACPI_STATUS
+AcpiResourceToAddress64 (
+ ACPI_RESOURCE *Resource,
+ ACPI_RESOURCE_ADDRESS64 *Out)
+{
+ ACPI_RESOURCE_ADDRESS16 *Address16;
+ ACPI_RESOURCE_ADDRESS32 *Address32;
+
+
+ if (!Resource || !Out)
{
- if (!Resource || Resource->Id == ACPI_RSTYPE_END_TAG)
- {
- break;
- }
+ return (AE_BAD_PARAMETER);
+ }
- Status = UserFunction (Resource, Context);
+ /* Convert 16 or 32 address descriptor to 64 */
- switch (Status)
- {
- case AE_OK:
- case AE_CTRL_DEPTH:
+ switch (Resource->Type)
+ {
+ case ACPI_RESOURCE_TYPE_ADDRESS16:
- /* Just keep going */
+ Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data;
+ ACPI_COPY_ADDRESS (Out, Address16);
+ break;
- Status = AE_OK;
- break;
+ case ACPI_RESOURCE_TYPE_ADDRESS32:
- case AE_CTRL_TERMINATE:
+ Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data;
+ ACPI_COPY_ADDRESS (Out, Address32);
+ break;
- /* Exit now, with OK stats */
+ case ACPI_RESOURCE_TYPE_ADDRESS64:
- Status = AE_OK;
- goto Cleanup;
+ /* Simple copy for 64 bit source */
- default:
+ ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
+ break;
- /* All others are valid exceptions */
+ default:
+ return (AE_BAD_PARAMETER);
+ }
- goto Cleanup;
- }
+ return (AE_OK);
+}
- /* Get the next resource descriptor */
+ACPI_EXPORT_SYMBOL (AcpiResourceToAddress64)
- Resource = ACPI_NEXT_RESOURCE (Resource);
- /* Check for end-of-buffer */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetVendorResource
+ *
+ * PARAMETERS: DeviceHandle - Handle for the parent device object
+ * Name - Method name for the parent resource
+ * (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ * Uuid - Pointer to the UUID to be matched.
+ * includes both subtype and 16-byte UUID
+ * RetBuffer - Where the vendor resource is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk a resource template for the specified evice to find a
+ * vendor-defined resource that matches the supplied UUID and
+ * UUID subtype. Returns a ACPI_RESOURCE of type Vendor.
+ *
+ ******************************************************************************/
- if (Resource >= BufferEnd)
- {
- goto Cleanup;
- }
+ACPI_STATUS
+AcpiGetVendorResource (
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_VENDOR_UUID *Uuid,
+ ACPI_BUFFER *RetBuffer)
+{
+ ACPI_VENDOR_WALK_INFO Info;
+ ACPI_STATUS Status;
+
+
+ /* Other parameters are validated by AcpiWalkResources */
+
+ if (!Uuid || !RetBuffer)
+ {
+ return (AE_BAD_PARAMETER);
}
-Cleanup:
+ Info.Uuid = Uuid;
+ Info.Buffer = RetBuffer;
+ Info.Status = AE_NOT_EXIST;
- AcpiOsFree (Buffer.Pointer);
- return_ACPI_STATUS (Status);
+ /* Walk the _CRS or _PRS resource list for this device */
+
+ Status = AcpiWalkResources (DeviceHandle, Name, AcpiRsMatchVendorResource,
+ &Info);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+
+ return (Info.Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetVendorResource)
+
/*******************************************************************************
*
- * FUNCTION: AcpiSetCurrentResources
+ * FUNCTION: AcpiRsMatchVendorResource
*
- * PARAMETERS: DeviceHandle - a handle to the device object for the
- * device we are changing the resources of
- * InBuffer - a pointer to a buffer containing the
- * resources to be set for the device
+ * PARAMETERS: ACPI_WALK_RESOURCE_CALLBACK
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to set the current resources for a
- * specific device. The caller must first acquire a handle for
- * the desired device. The resource data is passed to the routine
- * the buffer pointed to by the InBuffer variable.
+ * DESCRIPTION: Match a vendor resource via the ACPI 3.0 UUID
*
******************************************************************************/
-ACPI_STATUS
-AcpiSetCurrentResources (
- ACPI_HANDLE DeviceHandle,
- ACPI_BUFFER *InBuffer)
+static ACPI_STATUS
+AcpiRsMatchVendorResource (
+ ACPI_RESOURCE *Resource,
+ void *Context)
{
- ACPI_STATUS Status;
+ ACPI_VENDOR_WALK_INFO *Info = Context;
+ ACPI_RESOURCE_VENDOR_TYPED *Vendor;
+ ACPI_BUFFER *Buffer;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiSetCurrentResources");
+ /* Ignore all descriptors except Vendor */
+ if (Resource->Type != ACPI_RESOURCE_TYPE_VENDOR)
+ {
+ return (AE_OK);
+ }
+
+ Vendor = &Resource->Data.VendorTyped;
/*
- * Must have a valid handle and buffer
+ * For a valid match, these conditions must hold:
+ *
+ * 1) Length of descriptor data must be at least as long as a UUID struct
+ * 2) The UUID subtypes must match
+ * 3) The UUID data must match
*/
- if ((!DeviceHandle) ||
- (!InBuffer) ||
- (!InBuffer->Pointer) ||
- (!InBuffer->Length))
+ if ((Vendor->ByteLength < (ACPI_UUID_LENGTH + 1)) ||
+ (Vendor->UuidSubtype != Info->Uuid->Subtype) ||
+ (ACPI_MEMCMP (Vendor->Uuid, Info->Uuid->Data, ACPI_UUID_LENGTH)))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return (AE_OK);
}
- Status = AcpiRsSetSrsMethodData (DeviceHandle, InBuffer);
- return_ACPI_STATUS (Status);
-}
+ /* Validate/Allocate/Clear caller buffer */
+ Buffer = Info->Buffer;
+ Status = AcpiUtInitializeBuffer (Buffer, Resource->Length);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
-#define ACPI_COPY_FIELD(Out, In, Field) ((Out)->Field = (In)->Field)
-#define ACPI_COPY_ADDRESS(Out, In) \
- ACPI_COPY_FIELD(Out, In, ResourceType); \
- ACPI_COPY_FIELD(Out, In, ProducerConsumer); \
- ACPI_COPY_FIELD(Out, In, Decode); \
- ACPI_COPY_FIELD(Out, In, MinAddressFixed); \
- ACPI_COPY_FIELD(Out, In, MaxAddressFixed); \
- ACPI_COPY_FIELD(Out, In, Attribute); \
- ACPI_COPY_FIELD(Out, In, Granularity); \
- ACPI_COPY_FIELD(Out, In, MinAddressRange); \
- ACPI_COPY_FIELD(Out, In, MaxAddressRange); \
- ACPI_COPY_FIELD(Out, In, AddressTranslationOffset); \
- ACPI_COPY_FIELD(Out, In, AddressLength); \
- ACPI_COPY_FIELD(Out, In, ResourceSource);
+ /* Found the correct resource, copy and return it */
-/******************************************************************************
+ ACPI_MEMCPY (Buffer->Pointer, Resource, Resource->Length);
+ Buffer->Length = Resource->Length;
+
+ /* Found the desired descriptor, terminate resource walk */
+
+ Info->Status = AE_OK;
+ return (AE_CTRL_TERMINATE);
+}
+
+
+/*******************************************************************************
*
- * FUNCTION: AcpiResourceToAddress64
+ * FUNCTION: AcpiWalkResources
*
- * PARAMETERS: resource - Pointer to a resource
- * out - Pointer to the users's return
- * buffer (a struct
- * acpi_resource_address64)
+ * PARAMETERS: DeviceHandle - Handle to the device object for the
+ * device we are querying
+ * Name - Method name of the resources we want
+ * (METHOD_NAME__CRS or METHOD_NAME__PRS)
+ * UserFunction - Called for each resource
+ * Context - Passed to UserFunction
*
* RETURN: Status
*
- * DESCRIPTION: If the resource is an address16, address32, or address64,
- * copy it to the address64 return buffer. This saves the
- * caller from having to duplicate code for different-sized
- * addresses.
+ * DESCRIPTION: Retrieves the current or possible resource list for the
+ * specified device. The UserFunction is called once for
+ * each resource in the list.
*
******************************************************************************/
ACPI_STATUS
-AcpiResourceToAddress64 (
- ACPI_RESOURCE *Resource,
- ACPI_RESOURCE_ADDRESS64 *Out)
+AcpiWalkResources (
+ ACPI_HANDLE DeviceHandle,
+ char *Name,
+ ACPI_WALK_RESOURCE_CALLBACK UserFunction,
+ void *Context)
{
- ACPI_RESOURCE_ADDRESS16 *Address16;
- ACPI_RESOURCE_ADDRESS32 *Address32;
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+ ACPI_RESOURCE *Resource;
+ ACPI_RESOURCE *ResourceEnd;
- switch (Resource->Id) {
- case ACPI_RSTYPE_ADDRESS16:
+ ACPI_FUNCTION_TRACE (AcpiWalkResources);
- Address16 = (ACPI_RESOURCE_ADDRESS16 *) &Resource->Data;
- ACPI_COPY_ADDRESS(Out, Address16);
- break;
+ /* Parameter validation */
+
+ if (!DeviceHandle || !UserFunction || !Name ||
+ (!ACPI_COMPARE_NAME (Name, METHOD_NAME__CRS) &&
+ !ACPI_COMPARE_NAME (Name, METHOD_NAME__PRS)))
+ {
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
+ }
+
+ /* Get the _CRS or _PRS resource list */
- case ACPI_RSTYPE_ADDRESS32:
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiRsGetMethodData (DeviceHandle, Name, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
- Address32 = (ACPI_RESOURCE_ADDRESS32 *) &Resource->Data;
- ACPI_COPY_ADDRESS(Out, Address32);
- break;
+ /* Buffer now contains the resource list */
+ Resource = ACPI_CAST_PTR (ACPI_RESOURCE, Buffer.Pointer);
+ ResourceEnd = ACPI_ADD_PTR (ACPI_RESOURCE, Buffer.Pointer, Buffer.Length);
- case ACPI_RSTYPE_ADDRESS64:
+ /* Walk the resource list until the EndTag is found (or buffer end) */
- /* Simple copy for 64 bit source */
+ while (Resource < ResourceEnd)
+ {
+ /* Sanity check the resource */
- ACPI_MEMCPY (Out, &Resource->Data, sizeof (ACPI_RESOURCE_ADDRESS64));
- break;
+ if (Resource->Type > ACPI_RESOURCE_TYPE_MAX)
+ {
+ Status = AE_AML_INVALID_RESOURCE_TYPE;
+ break;
+ }
+ /* Invoke the user function, abort on any error returned */
- default:
- return (AE_BAD_PARAMETER);
+ Status = UserFunction (Resource, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_CTRL_TERMINATE)
+ {
+ /* This is an OK termination by the user function */
+
+ Status = AE_OK;
+ }
+ break;
+ }
+
+ /* EndTag indicates end-of-list */
+
+ if (Resource->Type == ACPI_RESOURCE_TYPE_END_TAG)
+ {
+ break;
+ }
+
+ /* Get the next resource descriptor */
+
+ Resource = ACPI_ADD_PTR (ACPI_RESOURCE, Resource, Resource->Length);
}
- return (AE_OK);
+ ACPI_FREE (Buffer.Pointer);
+ return_ACPI_STATUS (Status);
}
+
+ACPI_EXPORT_SYMBOL (AcpiWalkResources)
Index: utclib.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utclib.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utclib.c -L sys/contrib/dev/acpica/utclib.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utclib.c
+++ sys/contrib/dev/acpica/utclib.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: cmclib - Local implementation of C library functions
- * $Revision: 53 $
+ * $Revision: 1.60 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -131,9 +131,113 @@
#ifndef ACPI_USE_SYSTEM_CLIBRARY
+#define NEGATIVE 1
+#define POSITIVE 0
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMemcmp (memcmp)
+ *
+ * PARAMETERS: Buffer1 - First Buffer
+ * Buffer2 - Second Buffer
+ * Count - Maximum # of bytes to compare
+ *
+ * RETURN: Index where Buffers mismatched, or 0 if Buffers matched
+ *
+ * DESCRIPTION: Compare two Buffers, with a maximum length
+ *
+ ******************************************************************************/
+
+int
+AcpiUtMemcmp (
+ const char *Buffer1,
+ const char *Buffer2,
+ ACPI_SIZE Count)
+{
+
+ for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
+ {
+ }
+
+ return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 -
+ (unsigned char) *Buffer2));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMemcpy (memcpy)
+ *
+ * PARAMETERS: Dest - Target of the copy
+ * Src - Source buffer to copy
+ * Count - Number of bytes to copy
+ *
+ * RETURN: Dest
+ *
+ * DESCRIPTION: Copy arbitrary bytes of memory
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtMemcpy (
+ void *Dest,
+ const void *Src,
+ ACPI_SIZE Count)
+{
+ char *New = (char *) Dest;
+ char *Old = (char *) Src;
+
+
+ while (Count)
+ {
+ *New = *Old;
+ New++;
+ Old++;
+ Count--;
+ }
+
+ return (Dest);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtMemset (memset)
+ *
+ * PARAMETERS: Dest - Buffer to set
+ * Value - Value to set each byte of memory
+ * Count - Number of bytes to set
+ *
+ * RETURN: Dest
+ *
+ * DESCRIPTION: Initialize a buffer to a known value.
+ *
+ ******************************************************************************/
+
+void *
+AcpiUtMemset (
+ void *Dest,
+ ACPI_NATIVE_UINT Value,
+ ACPI_SIZE Count)
+{
+ char *New = (char *) Dest;
+
+
+ while (Count)
+ {
+ *New = (char) Value;
+ New++;
+ Count--;
+ }
+
+ return (Dest);
+}
+
+
/*******************************************************************************
*
- * FUNCTION: strlen
+ * FUNCTION: AcpiUtStrlen (strlen)
*
* PARAMETERS: String - Null terminated string
*
@@ -165,7 +269,7 @@
/*******************************************************************************
*
- * FUNCTION: strcpy
+ * FUNCTION: AcpiUtStrcpy (strcpy)
*
* PARAMETERS: DstString - Target of the copy
* SrcString - The source string to copy
@@ -203,7 +307,7 @@
/*******************************************************************************
*
- * FUNCTION: strncpy
+ * FUNCTION: AcpiUtStrncpy (strncpy)
*
* PARAMETERS: DstString - Target of the copy
* SrcString - The source string to copy
@@ -246,7 +350,7 @@
/*******************************************************************************
*
- * FUNCTION: strcmp
+ * FUNCTION: AcpiUtStrcmp (strcmp)
*
* PARAMETERS: String1 - First string
* String2 - Second string
@@ -276,39 +380,43 @@
}
+#ifdef ACPI_FUTURE_IMPLEMENTATION
+/* Not used at this time */
/*******************************************************************************
*
- * FUNCTION: memcmp
+ * FUNCTION: AcpiUtStrchr (strchr)
*
- * PARAMETERS: Buffer1 - First Buffer
- * Buffer2 - Second Buffer
- * Count - Maximum # of bytes to compare
+ * PARAMETERS: String - Search string
+ * ch - character to search for
*
- * RETURN: Index where Buffers mismatched, or 0 if Buffers matched
+ * RETURN: Ptr to char or NULL if not found
*
- * DESCRIPTION: Compare two Buffers, with a maximum length
+ * DESCRIPTION: Search a string for a character
*
******************************************************************************/
-int
-AcpiUtMemcmp (
- const char *Buffer1,
- const char *Buffer2,
- ACPI_SIZE Count)
+char *
+AcpiUtStrchr (
+ const char *String,
+ int ch)
{
- for ( ; Count-- && (*Buffer1 == *Buffer2); Buffer1++, Buffer2++)
+
+ for ( ; (*String); String++)
{
+ if ((*String) == (char) ch)
+ {
+ return ((char *) String);
+ }
}
- return ((Count == ACPI_SIZE_MAX) ? 0 : ((unsigned char) *Buffer1 -
- (unsigned char) *Buffer2));
+ return (NULL);
}
-
+#endif
/*******************************************************************************
*
- * FUNCTION: strncmp
+ * FUNCTION: AcpiUtStrncmp (strncmp)
*
* PARAMETERS: String1 - First string
* String2 - Second string
@@ -343,7 +451,7 @@
/*******************************************************************************
*
- * FUNCTION: Strcat
+ * FUNCTION: AcpiUtStrcat (Strcat)
*
* PARAMETERS: DstString - Target of the copy
* SrcString - The source string to copy
@@ -378,7 +486,7 @@
/*******************************************************************************
*
- * FUNCTION: strncat
+ * FUNCTION: AcpiUtStrncat (strncat)
*
* PARAMETERS: DstString - Target of the copy
* SrcString - The source string to copy
@@ -426,81 +534,292 @@
/*******************************************************************************
*
- * FUNCTION: memcpy
+ * FUNCTION: AcpiUtStrstr (strstr)
*
- * PARAMETERS: Dest - Target of the copy
- * Src - Source buffer to copy
- * Count - Number of bytes to copy
+ * PARAMETERS: String1 - Target string
+ * String2 - Substring to search for
*
- * RETURN: Dest
+ * RETURN: Where substring match starts, Null if no match found
*
- * DESCRIPTION: Copy arbitrary bytes of memory
+ * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
+ * full implementation of strstr, only sufficient for command
+ * matching
*
******************************************************************************/
-void *
-AcpiUtMemcpy (
- void *Dest,
- const void *Src,
- ACPI_SIZE Count)
+char *
+AcpiUtStrstr (
+ char *String1,
+ char *String2)
{
- char *New = (char *) Dest;
- char *Old = (char *) Src;
+ char *String;
- while (Count)
+ if (AcpiUtStrlen (String2) > AcpiUtStrlen (String1))
{
- *New = *Old;
- New++;
- Old++;
- Count--;
+ return (NULL);
}
- return (Dest);
+ /* Walk entire string, comparing the letters */
+
+ for (String = String1; *String2; )
+ {
+ if (*String2 != *String)
+ {
+ return (NULL);
+ }
+
+ String2++;
+ String++;
+ }
+
+ return (String1);
}
/*******************************************************************************
*
- * FUNCTION: memset
+ * FUNCTION: AcpiUtStrtoul (strtoul)
*
- * PARAMETERS: Dest - Buffer to set
- * Value - Value to set each byte of memory
- * Count - Number of bytes to set
+ * PARAMETERS: String - Null terminated string
+ * Terminater - Where a pointer to the terminating byte is
+ * returned
+ * Base - Radix of the string
*
- * RETURN: Dest
+ * RETURN: Converted value
*
- * DESCRIPTION: Initialize a buffer to a known value.
+ * DESCRIPTION: Convert a string into a 32-bit unsigned value.
+ * Note: use AcpiUtStrtoul64 for 64-bit integers.
*
******************************************************************************/
-void *
-AcpiUtMemset (
- void *Dest,
- ACPI_NATIVE_UINT Value,
- ACPI_SIZE Count)
+UINT32
+AcpiUtStrtoul (
+ const char *String,
+ char **Terminator,
+ UINT32 Base)
{
- char *New = (char *) Dest;
+ UINT32 converted = 0;
+ UINT32 index;
+ UINT32 sign;
+ const char *StringStart;
+ UINT32 ReturnValue = 0;
+ ACPI_STATUS Status = AE_OK;
- while (Count)
+ /*
+ * 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 (ACPI_IS_SPACE (*String) || *String == '\t')
{
- *New = (char) Value;
- New++;
- Count--;
+ ++String;
}
- return (Dest);
-}
-
+ /*
+ * 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;
+ }
-#define NEGATIVE 1
-#define POSITIVE 0
+ /*
+ * 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 (AcpiUtToLower (*(++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;
+ }
-const UINT8 _acpi_ctype[257] = {
- _ACPI_CN, /* 0x0 0. */
- _ACPI_CN, /* 0x1 1. */
- _ACPI_CN, /* 0x2 2. */
+ /*
+ * 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' &&
+ AcpiUtToLower (*(++String)) == 'x')
+ {
+ String++;
+ }
+
+ /*
+ * Main loop: convert the string to an unsigned long:
+ */
+ while (*String)
+ {
+ if (ACPI_IS_DIGIT (*String))
+ {
+ index = (UINT32) ((UINT8) *String - '0');
+ }
+ else
+ {
+ index = (UINT32) AcpiUtToUpper (*String);
+ if (ACPI_IS_UPPER (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_UINT32_MAX - (UINT32) index) /
+ (UINT32) Base))
+ {
+ Status = AE_ERROR;
+ ReturnValue = 0; /* 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 == 0 && String != NULL)
+ {
+ *Terminator = (char *) StringStart;
+ }
+ else
+ {
+ *Terminator = (char *) String;
+ }
+ }
+
+ if (Status == AE_ERROR)
+ {
+ ReturnValue = ACPI_UINT32_MAX;
+ }
+
+ /*
+ * If a minus sign was present, then "the conversion is negated":
+ */
+ if (sign == NEGATIVE)
+ {
+ ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
+ }
+
+ return (ReturnValue);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtToUpper (TOUPPER)
+ *
+ * PARAMETERS: c - Character to convert
+ *
+ * RETURN: Converted character as an int
+ *
+ * DESCRIPTION: Convert character to uppercase
+ *
+ ******************************************************************************/
+
+int
+AcpiUtToUpper (
+ int c)
+{
+
+ return (ACPI_IS_LOWER(c) ? ((c)-0x20) : (c));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtToLower (TOLOWER)
+ *
+ * PARAMETERS: c - Character to convert
+ *
+ * RETURN: Converted character as an int
+ *
+ * DESCRIPTION: Convert character to lowercase
+ *
+ ******************************************************************************/
+
+int
+AcpiUtToLower (
+ int c)
+{
+
+ return (ACPI_IS_UPPER(c) ? ((c)+0x20) : (c));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: is* functions
+ *
+ * DESCRIPTION: is* functions use the ctype table below
+ *
+ ******************************************************************************/
+
+const UINT8 _acpi_ctype[257] = {
+ _ACPI_CN, /* 0x0 0. */
+ _ACPI_CN, /* 0x1 1. */
+ _ACPI_CN, /* 0x2 2. */
_ACPI_CN, /* 0x3 3. */
_ACPI_CN, /* 0x4 4. */
_ACPI_CN, /* 0x5 5. */
@@ -637,286 +956,6 @@
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* 0xF0 to 0x100 */
};
-#define IS_UPPER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_UP))
-#define IS_LOWER(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_LO))
-#define IS_DIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_DI))
-#define IS_SPACE(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_SP))
-#define IS_XDIGIT(c) (_acpi_ctype[(unsigned char)(c)] & (_ACPI_XD))
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtToUpper
- *
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Convert character to uppercase
- *
- ******************************************************************************/
-
-int
-AcpiUtToUpper (
- int c)
-{
-
- return (IS_LOWER(c) ? ((c)-0x20) : (c));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtToLower
- *
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Convert character to lowercase
- *
- ******************************************************************************/
-
-int
-AcpiUtToLower (
- int c)
-{
-
- return (IS_UPPER(c) ? ((c)+0x20) : (c));
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: strstr
- *
- * PARAMETERS: String1 -
- * String2
- *
- * RETURN:
- *
- * DESCRIPTION: Checks if String2 occurs in String1. This is not really a
- * full implementation of strstr, only sufficient for command
- * matching
- *
- ******************************************************************************/
-
-char *
-AcpiUtStrstr (
- char *String1,
- char *String2)
-{
- char *String;
-
-
- if (AcpiUtStrlen (String2) > AcpiUtStrlen (String1))
- {
- return (NULL);
- }
-
- /* Walk entire string, comparing the letters */
-
- for (String = String1; *String2; )
- {
- if (*String2 != *String)
- {
- return (NULL);
- }
-
- String2++;
- String++;
- }
-
- return (String1);
-}
-
-
-/*******************************************************************************
- *
- * 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.
- *
- ******************************************************************************/
-
-UINT32
-AcpiUtStrtoul (
- const char *String,
- char **Terminator,
- UINT32 Base)
-{
- UINT32 converted = 0;
- UINT32 index;
- UINT32 sign;
- const char *StringStart;
- UINT32 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 (IS_SPACE (*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 (AcpiUtToLower (*(++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' &&
- AcpiUtToLower (*(++String)) == 'x')
- {
- String++;
- }
-
-
- /*
- * Main loop: convert the string to an unsigned long:
- */
- while (*String)
- {
- if (IS_DIGIT (*String))
- {
- index = (UINT32) ((UINT8) *String - '0');
- }
- else
- {
- index = (UINT32) AcpiUtToUpper (*String);
- if (IS_UPPER (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_UINT32_MAX - (UINT32) index) /
- (UINT32) Base))
- {
- Status = AE_ERROR;
- ReturnValue = 0; /* 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 == 0 && String != NULL)
- {
- *Terminator = (char *) StringStart;
- }
- else
- {
- *Terminator = (char *) String;
- }
- }
-
- if (Status == AE_ERROR)
- {
- ReturnValue = ACPI_UINT32_MAX;
- }
-
- /*
- * If a minus sign was present, then "the conversion is negated":
- */
- if (sign == NEGATIVE)
- {
- ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
- }
-
- return (ReturnValue);
-}
#endif /* ACPI_USE_SYSTEM_CLIBRARY */
Index: dsmethod.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dsmethod.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dsmethod.c -L sys/contrib/dev/acpica/dsmethod.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dsmethod.c
+++ sys/contrib/dev/acpica/dsmethod.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dsmethod - Parser/Interpreter interface - control method parsing
- * $Revision: 101 $
+ * $Revision: 1.136 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,137 +122,125 @@
#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acinterp.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acdisasm.h>
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dsmethod")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDsCreateMethodMutex (
+ ACPI_OPERAND_OBJECT *MethodDesc);
+
/*******************************************************************************
*
- * FUNCTION: AcpiDsParseMethod
+ * FUNCTION: AcpiDsMethodError
*
- * PARAMETERS: ObjHandle - Method node
+ * PARAMETERS: Status - Execution status
+ * WalkState - Current state
*
* RETURN: Status
*
- * DESCRIPTION: Call the parser and parse the AML that is associated with the
- * method.
+ * DESCRIPTION: Called on method error. Invoke the global exception handler if
+ * present, dump the method data if the disassembler is configured
*
- * MUTEX: Assumes parser is locked
+ * Note: Allows the exception handler to change the status code
*
******************************************************************************/
ACPI_STATUS
-AcpiDsParseMethod (
- ACPI_HANDLE ObjHandle)
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
{
- ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_PARSE_OBJECT *Op;
- ACPI_NAMESPACE_NODE *Node;
- ACPI_OWNER_ID OwnerId;
- ACPI_WALK_STATE *WalkState;
-
+ ACPI_FUNCTION_ENTRY ();
- ACPI_FUNCTION_TRACE_PTR ("DsParseMethod", ObjHandle);
+ /* Ignore AE_OK and control exception codes */
- /* Parameter Validation */
-
- if (!ObjHandle)
+ if (ACPI_SUCCESS (Status) ||
+ (Status & AE_CODE_CONTROL))
{
- return_ACPI_STATUS (AE_NULL_ENTRY);
+ return (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Parsing [%4.4s] **** NamedObj=%p\n",
- AcpiUtGetNodeName (ObjHandle), ObjHandle));
-
- /* Extract the method object from the method Node */
+ /* Invoke the global exception handler */
- Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
- ObjDesc = AcpiNsGetAttachedObject (Node);
- if (!ObjDesc)
+ if (AcpiGbl_ExceptionHandler)
{
- return_ACPI_STATUS (AE_NULL_OBJECT);
- }
+ /* Exit the interpreter, allow handler to execute methods */
- /* Create a mutex for the method if there is a concurrency limit */
+ AcpiExExitInterpreter ();
- if ((ObjDesc->Method.Concurrency != ACPI_INFINITE_CONCURRENCY) &&
- (!ObjDesc->Method.Semaphore))
- {
- Status = AcpiOsCreateSemaphore (ObjDesc->Method.Concurrency,
- ObjDesc->Method.Concurrency,
- &ObjDesc->Method.Semaphore);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ /*
+ * Handler can map the exception code to anything it wants, including
+ * AE_OK, in which case the executing method will not be aborted.
+ */
+ Status = AcpiGbl_ExceptionHandler (Status,
+ WalkState->MethodNode ?
+ WalkState->MethodNode->Name.Integer : 0,
+ WalkState->Opcode, WalkState->AmlOffset, NULL);
+ (void) AcpiExEnterInterpreter ();
}
- /*
- * Allocate a new parser op to be the root of the parsed
- * method tree
- */
- Op = AcpiPsAllocOp (AML_METHOD_OP);
- if (!Op)
+#ifdef ACPI_DISASSEMBLER
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ /* Display method locals/args if disassembler is present */
+
+ AcpiDmDumpMethodInfo (Status, WalkState, WalkState->Op);
}
+#endif
+
+ return (Status);
+}
- /* Init new op with the method name and pointer back to the Node */
- AcpiPsSetName (Op, Node->Name.Integer);
- Op->Common.Node = Node;
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDsCreateMethodMutex
+ *
+ * PARAMETERS: ObjDesc - The method object
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Create a mutex object for a serialized control method
+ *
+ ******************************************************************************/
- /*
- * Get a new OwnerId for objects created by this method. Namespace
- * objects (such as Operation Regions) can be created during the
- * first pass parse.
- */
- OwnerId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
- ObjDesc->Method.OwningId = OwnerId;
+static ACPI_STATUS
+AcpiDsCreateMethodMutex (
+ ACPI_OPERAND_OBJECT *MethodDesc)
+{
+ ACPI_OPERAND_OBJECT *MutexDesc;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (DsCreateMethodMutex);
- /* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
- if (!WalkState)
+ /* Create the new mutex object */
+
+ MutexDesc = AcpiUtCreateInternalObject (ACPI_TYPE_MUTEX);
+ if (!MutexDesc)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiDsInitAmlWalk (WalkState, Op, Node,
- ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, 1);
- if (ACPI_FAILURE (Status))
- {
- AcpiDsDeleteWalkState (WalkState);
- return_ACPI_STATUS (Status);
- }
+ /* Create the actual OS Mutex */
- /*
- * Parse the method, first pass
- *
- * The first pass load is where newly declared named objects are
- * added into the namespace. Actual evaluation of
- * the named objects (what would be called a "second
- * pass") happens during the actual execution of the
- * method so that operands to the named objects can
- * take on dynamic run-time values.
- */
- Status = AcpiPsParseAml (WalkState);
+ Status = AcpiOsCreateMutex (&MutexDesc->Mutex.OsMutex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "**** [%4.4s] Parsed **** NamedObj=%p Op=%p\n",
- AcpiUtGetNodeName (ObjHandle), ObjHandle, Op));
-
- AcpiPsDeleteParseTree (Op);
- return_ACPI_STATUS (Status);
+ MutexDesc->Mutex.SyncLevel = MethodDesc->Method.SyncLevel;
+ MethodDesc->Method.Mutex = MutexDesc;
+ return_ACPI_STATUS (AE_OK);
}
@@ -262,7 +250,8 @@
*
* PARAMETERS: MethodNode - Node of the method
* ObjDesc - The method object
- * CallingMethodNode - Caller of this method (if non-null)
+ * WalkState - current state, NULL if not yet executing
+ * a method.
*
* RETURN: Status
*
@@ -276,12 +265,12 @@
AcpiDsBeginMethodExecution (
ACPI_NAMESPACE_NODE *MethodNode,
ACPI_OPERAND_OBJECT *ObjDesc,
- ACPI_NAMESPACE_NODE *CallingMethodNode)
+ ACPI_WALK_STATE *WalkState)
{
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("DsBeginMethodExecution", MethodNode);
+ ACPI_FUNCTION_TRACE_PTR (DsBeginMethodExecution, MethodNode);
if (!MethodNode)
@@ -289,34 +278,105 @@
return_ACPI_STATUS (AE_NULL_ENTRY);
}
+ /* Prevent wraparound of thread count */
+
+ if (ObjDesc->Method.ThreadCount == ACPI_UINT8_MAX)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Method reached maximum reentrancy limit (255)"));
+ return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
+ }
+
/*
- * If there is a concurrency limit on this method, we need to
- * obtain a unit from the method semaphore.
+ * If this method is serialized, we need to acquire the method mutex.
*/
- if (ObjDesc->Method.Semaphore)
+ if (ObjDesc->Method.MethodFlags & AML_METHOD_SERIALIZED)
{
/*
- * Allow recursive method calls, up to the reentrancy/concurrency
- * limit imposed by the SERIALIZED rule and the SyncLevel method
- * parameter.
- *
- * The point of this code is to avoid permanently blocking a
- * thread that is making recursive method calls.
+ * Create a mutex for the method if it is defined to be Serialized
+ * and a mutex has not already been created. We defer the mutex creation
+ * until a method is actually executed, to minimize the object count
*/
- if (MethodNode == CallingMethodNode)
+ if (!ObjDesc->Method.Mutex)
{
- if (ObjDesc->Method.ThreadCount >= ObjDesc->Method.Concurrency)
+ Status = AcpiDsCreateMethodMutex (ObjDesc);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_AML_METHOD_LIMIT);
+ return_ACPI_STATUS (Status);
}
}
/*
- * Get a unit from the method semaphore. This releases the
- * interpreter if we block
+ * The CurrentSyncLevel (per-thread) must be less than or equal to
+ * the sync level of the method. This mechanism provides some
+ * deadlock prevention
+ *
+ * Top-level method invocation has no walk state at this point
+ */
+ if (WalkState &&
+ (WalkState->Thread->CurrentSyncLevel > ObjDesc->Method.Mutex->Mutex.SyncLevel))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Cannot acquire Mutex for method [%4.4s], current SyncLevel is too large (%d)",
+ AcpiUtGetNodeName (MethodNode),
+ WalkState->Thread->CurrentSyncLevel));
+
+ return_ACPI_STATUS (AE_AML_MUTEX_ORDER);
+ }
+
+ /*
+ * Obtain the method mutex if necessary. Do not acquire mutex for a
+ * recursive call.
*/
- Status = AcpiExSystemWaitSemaphore (ObjDesc->Method.Semaphore,
- ACPI_WAIT_FOREVER);
+ if (!WalkState ||
+ !ObjDesc->Method.Mutex->Mutex.ThreadId ||
+ (WalkState->Thread->ThreadId != ObjDesc->Method.Mutex->Mutex.ThreadId))
+ {
+ /*
+ * Acquire the method mutex. This releases the interpreter if we
+ * block (and reacquires it before it returns)
+ */
+ Status = AcpiExSystemWaitMutex (ObjDesc->Method.Mutex->Mutex.OsMutex,
+ ACPI_WAIT_FOREVER);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Update the mutex and walk info and save the original SyncLevel */
+
+ if (WalkState)
+ {
+ ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
+ WalkState->Thread->CurrentSyncLevel;
+
+ ObjDesc->Method.Mutex->Mutex.ThreadId = WalkState->Thread->ThreadId;
+ WalkState->Thread->CurrentSyncLevel = ObjDesc->Method.SyncLevel;
+ }
+ else
+ {
+ ObjDesc->Method.Mutex->Mutex.OriginalSyncLevel =
+ ObjDesc->Method.Mutex->Mutex.SyncLevel;
+ }
+ }
+
+ /* Always increase acquisition depth */
+
+ ObjDesc->Method.Mutex->Mutex.AcquisitionDepth++;
+ }
+
+ /*
+ * Allocate an Owner ID for this method, only if this is the first thread
+ * to begin concurrent execution. We only need one OwnerId, even if the
+ * method is invoked recursively.
+ */
+ if (!ObjDesc->Method.OwnerId)
+ {
+ Status = AcpiUtAllocateOwnerId (&ObjDesc->Method.OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ goto Cleanup;
+ }
}
/*
@@ -325,6 +385,16 @@
*/
ObjDesc->Method.ThreadCount++;
return_ACPI_STATUS (Status);
+
+
+Cleanup:
+ /* On error, must release the method mutex (if present) */
+
+ if (ObjDesc->Method.Mutex)
+ {
+ AcpiOsReleaseMutex (ObjDesc->Method.Mutex->Mutex.OsMutex);
+ }
+ return_ACPI_STATUS (Status);
}
@@ -350,15 +420,15 @@
{
ACPI_STATUS Status;
ACPI_NAMESPACE_NODE *MethodNode;
- ACPI_WALK_STATE *NextWalkState;
+ ACPI_WALK_STATE *NextWalkState = NULL;
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
UINT32 i;
- ACPI_FUNCTION_TRACE_PTR ("DsCallControlMethod", ThisWalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsCallControlMethod, ThisWalkState);
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Execute method %p, currentstate=%p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Calling method %p, currentstate=%p\n",
ThisWalkState->PrevOp, ThisWalkState));
/*
@@ -376,75 +446,51 @@
return_ACPI_STATUS (AE_NULL_OBJECT);
}
- ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
-
- /* Init for new method, wait on concurrency semaphore */
+ /* Init for new method, possibly wait on method mutex */
Status = AcpiDsBeginMethodExecution (MethodNode, ObjDesc,
- ThisWalkState->MethodNode);
+ ThisWalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
- if (!(ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY))
- {
- /* 1) Parse: Create a new walk state for the preempting walk */
-
- NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
- Op, ObjDesc, NULL);
- if (!NextWalkState)
- {
- return_ACPI_STATUS (AE_NO_MEMORY);
- }
-
- /* Create and init a Root Node */
-
- Op = AcpiPsCreateScopeOp ();
- if (!Op)
- {
- Status = AE_NO_MEMORY;
- goto Cleanup;
- }
-
- Status = AcpiDsInitAmlWalk (NextWalkState, Op, MethodNode,
- ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
- NULL, 1);
- if (ACPI_FAILURE (Status))
- {
- AcpiDsDeleteWalkState (NextWalkState);
- goto Cleanup;
- }
-
- /* Begin AML parse */
-
- Status = AcpiPsParseAml (NextWalkState);
- AcpiPsDeleteParseTree (Op);
- }
-
- /* 2) Execute: Create a new state for the preempting walk */
+ /* Begin method parse/execution. Create a new walk state */
- NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
- NULL, ObjDesc, Thread);
+ NextWalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwnerId,
+ NULL, ObjDesc, Thread);
if (!NextWalkState)
{
Status = AE_NO_MEMORY;
goto Cleanup;
}
+
/*
* The resolved arguments were put on the previous walk state's operand
- * stack. Operands on the previous walk state stack always
- * start at index 0.
- * Null terminate the list of arguments
+ * stack. Operands on the previous walk state stack always
+ * start at index 0. Also, null terminate the list of arguments
*/
ThisWalkState->Operands [ThisWalkState->NumOperands] = NULL;
- Info.Parameters = &ThisWalkState->Operands[0];
- Info.ParameterType = ACPI_PARAM_ARGS;
+ /*
+ * Allocate and initialize the evaluation information block
+ * TBD: this is somewhat inefficient, should change interface to
+ * DsInitAmlWalk. For now, keeps this struct off the CPU stack
+ */
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->Parameters = &ThisWalkState->Operands[0];
+ Info->ParameterType = ACPI_PARAM_ARGS;
Status = AcpiDsInitAmlWalk (NextWalkState, NULL, MethodNode,
- ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
- &Info, 3);
+ ObjDesc->Method.AmlStart, ObjDesc->Method.AmlLength,
+ Info, ACPI_IMODE_EXECUTE);
+
+ ACPI_FREE (Info);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -465,28 +511,29 @@
ThisWalkState->NumOperands = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "Starting nested execution, newstate=%p\n", NextWalkState));
+ "**** Begin nested execution of [%4.4s] **** WalkState=%p\n",
+ MethodNode->Name.Ascii, NextWalkState));
+
+ /* Invoke an internal method if necessary */
if (ObjDesc->Method.MethodFlags & AML_METHOD_INTERNAL_ONLY)
{
Status = ObjDesc->Method.Implementation (NextWalkState);
- return_ACPI_STATUS (Status);
}
- return_ACPI_STATUS (AE_OK);
-
+ return_ACPI_STATUS (Status);
- /* On error, we must delete the new walk state */
Cleanup:
- if (NextWalkState && (NextWalkState->MethodDesc))
- {
- /* Decrement the thread count on the method parse tree */
- NextWalkState->MethodDesc->Method.ThreadCount--;
+ /* On error, we must terminate the method properly */
+
+ AcpiDsTerminateControlMethod (ObjDesc, NextWalkState);
+ if (NextWalkState)
+ {
+ AcpiDsDeleteWalkState (NextWalkState);
}
- (void) AcpiDsTerminateControlMethod (NextWalkState);
- AcpiDsDeleteWalkState (NextWalkState);
+
return_ACPI_STATUS (Status);
}
@@ -511,15 +558,16 @@
ACPI_OPERAND_OBJECT *ReturnDesc)
{
ACPI_STATUS Status;
+ int SameAsImplicitReturn;
- ACPI_FUNCTION_TRACE_PTR ("DsRestartControlMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsRestartControlMethod, WalkState);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"****Restart [%4.4s] Op %p ReturnValueFromCallee %p\n",
- (char *) &WalkState->MethodNode->Name, WalkState->MethodCallOp,
- ReturnDesc));
+ AcpiUtGetNodeName (WalkState->MethodNode),
+ WalkState->MethodCallOp, ReturnDesc));
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
" ReturnFromThisMethodUsed?=%X ResStack %p Walk %p\n",
@@ -530,6 +578,10 @@
if (ReturnDesc)
{
+ /* Is the implicit return object the same as the return desc? */
+
+ SameAsImplicitReturn = (WalkState->ImplicitReturnObj == ReturnDesc);
+
/* Are we actually going to use the return value? */
if (WalkState->ReturnUsed)
@@ -549,11 +601,25 @@
*/
WalkState->ReturnDesc = ReturnDesc;
}
- else
+
+ /*
+ * The following code is the optional support for the so-called
+ * "implicit return". Some AML code assumes that the last value of the
+ * method is "implicitly" returned to the caller, in the absence of an
+ * explicit return value.
+ *
+ * Just save the last result of the method as the return value.
+ *
+ * NOTE: this is optional because the ASL language does not actually
+ * support this behavior.
+ */
+ else if (!AcpiDsDoImplicitReturn (ReturnDesc, WalkState, FALSE) ||
+ SameAsImplicitReturn)
{
/*
* Delete the return value if it will not be used by the
- * calling method
+ * calling method or remove one reference if the explicit return
+ * is the same as the implicit return value.
*/
AcpiUtRemoveReference (ReturnDesc);
}
@@ -567,135 +633,122 @@
*
* FUNCTION: AcpiDsTerminateControlMethod
*
- * PARAMETERS: WalkState - State of the method
+ * PARAMETERS: MethodDesc - Method object
+ * WalkState - State associated with the method
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Terminate a control method. Delete everything that the method
* created, delete all locals and arguments, and delete the parse
* tree if requested.
*
+ * MUTEX: Interpreter is locked
+ *
******************************************************************************/
-ACPI_STATUS
+void
AcpiDsTerminateControlMethod (
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState)
{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_NAMESPACE_NODE *MethodNode;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("DsTerminateControlMethod", WalkState);
-
+ ACPI_FUNCTION_TRACE_PTR (DsTerminateControlMethod, WalkState);
- if (!WalkState)
- {
- return (AE_BAD_PARAMETER);
- }
- /* The current method object was saved in the walk state */
+ /* MethodDesc is required, WalkState is optional */
- ObjDesc = WalkState->MethodDesc;
- if (!ObjDesc)
+ if (!MethodDesc)
{
- return_ACPI_STATUS (AE_OK);
+ return_VOID;
}
- /* Delete all arguments and locals */
+ if (WalkState)
+ {
+ /* Delete all arguments and locals */
- AcpiDsMethodDataDeleteAll (WalkState);
+ AcpiDsMethodDataDeleteAll (WalkState);
+ }
/*
- * Lock the parser while we terminate this method.
- * If this is the last thread executing the method,
- * we have additional cleanup to perform
+ * If method is serialized, release the mutex and restore the
+ * current sync level for this thread
*/
- Status = AcpiUtAcquireMutex (ACPI_MTX_PARSER);
- if (ACPI_FAILURE (Status))
+ if (MethodDesc->Method.Mutex)
{
- return_ACPI_STATUS (Status);
- }
-
- /* Signal completion of the execution of this method if necessary */
+ /* Acquisition Depth handles recursive calls */
- if (WalkState->MethodDesc->Method.Semaphore)
- {
- Status = AcpiOsSignalSemaphore (
- WalkState->MethodDesc->Method.Semaphore, 1);
- if (ACPI_FAILURE (Status))
+ MethodDesc->Method.Mutex->Mutex.AcquisitionDepth--;
+ if (!MethodDesc->Method.Mutex->Mutex.AcquisitionDepth)
{
- ACPI_REPORT_ERROR (("Could not signal method semaphore\n"));
- Status = AE_OK;
+ WalkState->Thread->CurrentSyncLevel =
+ MethodDesc->Method.Mutex->Mutex.OriginalSyncLevel;
- /* Ignore error and continue cleanup */
+ AcpiOsReleaseMutex (MethodDesc->Method.Mutex->Mutex.OsMutex);
+ MethodDesc->Method.Mutex->Mutex.ThreadId = 0;
}
}
- if (WalkState->MethodDesc->Method.ThreadCount)
+ if (WalkState)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
- "*** Not deleting method namespace, there are still %d threads\n",
- WalkState->MethodDesc->Method.ThreadCount));
+ /*
+ * Delete any namespace objects created anywhere within
+ * the namespace by the execution of this method
+ */
+ AcpiNsDeleteNamespaceByOwner (MethodDesc->Method.OwnerId);
+ }
+
+ /* Decrement the thread count on the method */
+
+ if (MethodDesc->Method.ThreadCount)
+ {
+ MethodDesc->Method.ThreadCount--;
+ }
+ else
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Invalid zero thread count in method"));
}
- if (!WalkState->MethodDesc->Method.ThreadCount)
+ /* Are there any other threads currently executing this method? */
+
+ if (MethodDesc->Method.ThreadCount)
{
/*
+ * Additional threads. Do not release the OwnerId in this case,
+ * we immediately reuse it for the next thread executing this method
+ */
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "*** Completed execution of one thread, %d threads remaining\n",
+ MethodDesc->Method.ThreadCount));
+ }
+ else
+ {
+ /* This is the only executing thread for this method */
+
+ /*
* Support to dynamically change a method from NotSerialized to
- * Serialized if it appears that the method is written foolishly and
- * does not support multiple thread execution. The best example of this
- * is if such a method creates namespace objects and blocks. A second
+ * Serialized if it appears that the method is incorrectly written and
+ * does not support multiple thread execution. The best example of this
+ * is if such a method creates namespace objects and blocks. A second
* thread will fail with an AE_ALREADY_EXISTS exception
*
* This code is here because we must wait until the last thread exits
* before creating the synchronization semaphore.
*/
- if ((WalkState->MethodDesc->Method.Concurrency == 1) &&
- (!WalkState->MethodDesc->Method.Semaphore))
+ if ((MethodDesc->Method.MethodFlags & AML_METHOD_SERIALIZED) &&
+ (!MethodDesc->Method.Mutex))
{
- Status = AcpiOsCreateSemaphore (1,
- 1,
- &WalkState->MethodDesc->Method.Semaphore);
+ Status = AcpiDsCreateMethodMutex (MethodDesc);
}
- /*
- * There are no more threads executing this method. Perform
- * additional cleanup.
- *
- * The method Node is stored in the walk state
- */
- MethodNode = WalkState->MethodNode;
+ /* No more threads, we can free the OwnerId */
- /*
- * Delete any namespace entries created immediately underneath
- * the method
- */
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- if (MethodNode->Child)
- {
- AcpiNsDeleteNamespaceSubtree (MethodNode);
- }
-
- /*
- * Delete any namespace entries created anywhere else within
- * the namespace
- */
- AcpiNsDeleteNamespaceByOwner (WalkState->MethodDesc->Method.OwningId);
- Status = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ AcpiUtReleaseOwnerId (&MethodDesc->Method.OwnerId);
}
- Status = AcpiUtReleaseMutex (ACPI_MTX_PARSER);
- return_ACPI_STATUS (Status);
+ return_VOID;
}
Index: acpica_prep.sh
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acpica_prep.sh,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acpica_prep.sh -L sys/contrib/dev/acpica/acpica_prep.sh -u -r1.1.1.1 -r1.2
--- sys/contrib/dev/acpica/acpica_prep.sh
+++ sys/contrib/dev/acpica/acpica_prep.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# $FreeBSD: src/sys/contrib/dev/acpica/acpica_prep.sh,v 1.7 2004/04/14 02:03:33 njl Exp $
+# $FreeBSD: src/sys/contrib/dev/acpica/acpica_prep.sh,v 1.10 2007/03/22 18:08:11 jkim Exp $
#
# Unpack an ACPI CA drop and restructure it to fit the FreeBSD layout
#
@@ -17,9 +17,18 @@
fulldirs="common compiler"
# files to remove
stripdirs="generate acpisrc"
-stripfiles="16bit.h Makefile README a16find.c a16utils.asm \
- a16utils.lst a16utils.obj adisasm.h acdos16.h acintel.h \
- aclinux.h acmsvc.h acnetbsd.h acwin.h acwin64.h readme.txt"
+stripfiles="16bit.h Makefile README a16find.c a16utils.asm a16utils.obj \
+ acdos16.h acintel.h aclinux.h acmsvc.h acnetbsd.h acpixtract.c \
+ acwin.h acwin64.h aeexec.c aemain.c osdosxf.c osunixdir.c \
+ oswindir.c oswinxf.c readme.txt"
+# include files to canonify
+src_headers="acapps.h acconfig.h acdebug.h acdisasm.h acdispat.h \
+ acenv.h acevents.h acexcep.h acfreebsd.h acgcc.h acglobal.h \
+ achware.h acinterp.h aclocal.h acmacros.h acnames.h acnamesp.h \
+ acobject.h acopcode.h acoutput.h acparser.h acpi.h acpiosxf.h \
+ acpixf.h acresrc.h acstruct.h actables.h actbl.h actbl1.h \
+ actbl2.h actypes.h acutils.h aecommon.h amlcode.h amlresrc.h"
+comp_headers="aslcompiler.h asldefine.h aslglobal.h asltypes.h"
# files to update paths in
src_update_files="acpi.h acpiosxf.h"
@@ -31,12 +40,6 @@
mkdir -p ${wrk}
mkdir -p ${dst}
-# fetch document
-echo fetch document
-fetch http://developer.intel.com/technology/iapc/acpi/downloads/CHANGES.txt
-tr -d '\r' < CHANGES.txt > CHANGES.txt.tmp
-mv CHANGES.txt.tmp CHANGES.txt
-
# unpack
echo unpack
tar -x -z -f ${src} -C ${wrk}
@@ -44,27 +47,37 @@
# strip files
echo strip
for i in ${stripdirs}; do
- find ${wrk} -name ${i} -type d | xargs rm -r
+ find ${wrk} -name ${i} -type d | xargs rm -r
done
for i in ${stripfiles}; do
- find ${wrk} -name ${i} -type f -delete
+ find ${wrk} -name ${i} -type f -delete
done
echo copying full dirs
for i in ${fulldirs}; do
- find ${wrk} -name ${i} -type d | xargs -J % mv % ${dst}
+ find ${wrk} -name ${i} -type d | xargs -J % mv % ${dst}
done
# move files to destination
echo copying flat dirs
find ${wrk} -type f | xargs -J % mv % ${dst}
-mv CHANGES.txt ${dst}
+mv ${dst}/changes.txt ${dst}/CHANGES.txt
# update src/headers for appropriate paths
echo updating paths
for i in ${src_update_files}; do
- i=${dst}/$i
- sed -e 's/platform\///' $i > $i.new && mv $i.new $i
+ i=${dst}/$i
+ sed -e 's/platform\///' $i > $i.new && mv $i.new $i
+done
+
+# canonify include paths
+for H in ${src_headers}; do
+ find ${dst} -name "*.[chy]" -type f | \
+ xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/$H\>|g"
+done
+for H in ${comp_headers}; do
+ find ${dst}/compiler -name "*.[chly]" -type f | \
+ xargs sed -i "" -e "s|[\"<]$H[\">]|\<contrib/dev/acpica/compiler/$H\>|g"
done
# post-clean
@@ -73,6 +86,7 @@
# assist the developer in generating a diff
echo "Directories you may want to 'cvs diff':"
-echo " src/sys/dev/acpica src/sys/i386/acpica src/sys/ia64/acpica \\"
-echo " src/sys/modules/acpi src/sys/boot src/sys/i386/include \\"
-echo " src/usr.sbin/acpi src/sys/contrib/dev/acpica"
+echo " src/sys/contrib/dev/acpica src/sys/dev/acpica \\"
+echo " src/sys/amd64/acpica src/sys/i386/acpica src/sys/ia64/acpica \\"
+echo " src/sys/amd64/include src/sys/i386/include src/sys/ia64/include \\"
+echo " src/sys/boot src/sys/conf src/sys/modules/acpi src/usr.sbin/acpi"
Index: dbcmds.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbcmds.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbcmds.c -L sys/contrib/dev/acpica/dbcmds.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbcmds.c
+++ sys/contrib/dev/acpica/dbcmds.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbcmds - debug commands and output routines
- * $Revision: 115 $
+ * $Revision: 1.150 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -132,16 +132,61 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbcmds")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDbIntegrityWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbWalkAndMatchName (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbWalkForReferences (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+AcpiDbWalkForSpecificObjects (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_NAMESPACE_NODE *
+AcpiDbConvertToNode (
+ char *InString);
+
+static void
+AcpiDmCompareAmlResources (
+ UINT8 *Aml1Buffer,
+ ACPI_RSDESC_SIZE Aml1BufferLength,
+ UINT8 *Aml2Buffer,
+ ACPI_RSDESC_SIZE Aml2BufferLength);
+
+static ACPI_STATUS
+AcpiDmTestResourceConversion (
+ ACPI_NAMESPACE_NODE *Node,
+ char *Name);
+
/*
* Arguments for the Objects command
* These object types map directly to the ACPI_TYPES
*/
-
static ARGUMENT_INFO AcpiDbObjectTypes [] =
{
{"ANY"},
- {"NUMBERS"},
+ {"INTEGERS"},
{"STRINGS"},
{"BUFFERS"},
{"PACKAGES"},
@@ -156,12 +201,76 @@
{"THERMALZONES"},
{"BUFFERFIELDS"},
{"DDBHANDLES"},
+ {"DEBUG"},
+ {"REGIONFIELDS"},
+ {"BANKFIELDS"},
+ {"INDEXFIELDS"},
+ {"REFERENCES"},
+ {"ALIAS"},
{NULL} /* Must be null terminated */
};
/*******************************************************************************
*
+ * FUNCTION: AcpiDbConvertToNode
+ *
+ * PARAMETERS: InString - String to convert
+ *
+ * RETURN: Pointer to a NS node
+ *
+ * DESCRIPTION: Convert a string to a valid NS pointer. Handles numeric or
+ * alpha strings.
+ *
+ ******************************************************************************/
+
+static ACPI_NAMESPACE_NODE *
+AcpiDbConvertToNode (
+ char *InString)
+{
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ if ((*InString >= 0x30) && (*InString <= 0x39))
+ {
+ /* Numeric argument, convert */
+
+ Node = ACPI_TO_POINTER (ACPI_STRTOUL (InString, NULL, 16));
+ if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
+ {
+ AcpiOsPrintf ("Address %p is invalid in this address space\n",
+ Node);
+ return (NULL);
+ }
+
+ /* Make sure pointer is valid NS node */
+
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
+ {
+ AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
+ Node, AcpiUtGetDescriptorName (Node));
+ return (NULL);
+ }
+ }
+ else
+ {
+ /* Alpha argument */
+ /* The parameter is a name string that must be resolved to a
+ * Named obj
+ */
+ Node = AcpiDbLocalNsLookup (InString);
+ if (!Node)
+ {
+ Node = AcpiGbl_RootNode;
+ }
+ }
+
+ return (Node);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AcpiDbSleep
*
* PARAMETERS: ObjectArg - Desired sleep state (0-5)
@@ -176,9 +285,6 @@
AcpiDbSleep (
char *ObjectArg)
{
-#if ACPI_MACHINE_WIDTH == 16
- return (AE_OK);
-#else
ACPI_STATUS Status;
UINT8 SleepState;
@@ -203,7 +309,6 @@
Status = AcpiLeaveSleepState (SleepState);
return (Status);
-#endif
}
@@ -222,7 +327,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbWalkForReferences (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -296,16 +401,17 @@
******************************************************************************/
void
-AcpiDbDisplayLocks (void)
+AcpiDbDisplayLocks (
+ void)
{
UINT32 i;
- for (i = 0; i < MAX_MUTEX; i++)
+ for (i = 0; i < ACPI_MAX_MUTEX; i++)
{
AcpiOsPrintf ("%26s : %s\n", AcpiUtGetMutexName (i),
- AcpiGbl_MutexInfo[i].OwnerId == ACPI_MUTEX_NOT_ACQUIRED
- ? "Locked" : "Unlocked");
+ AcpiGbl_MutexInfo[i].ThreadId == ACPI_MUTEX_NOT_ACQUIRED
+ ? "Locked" : "Unlocked");
}
}
@@ -327,30 +433,28 @@
AcpiDbDisplayTableInfo (
char *TableArg)
{
- UINT32 i;
+ ACPI_NATIVE_UINT i;
ACPI_TABLE_DESC *TableDesc;
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
- {
- TableDesc = AcpiGbl_TableLists[i].Next;
- while (TableDesc)
- {
- AcpiOsPrintf ( "%s at %p length %.5X",
- AcpiGbl_TableData[i].Name, TableDesc->Pointer,
- (UINT32) TableDesc->Length);
-
- if (i != ACPI_TABLE_FACS)
- {
- AcpiOsPrintf (" OemID=%6s TableId=%8s OemRevision=%8.8X",
- TableDesc->Pointer->OemId,
- TableDesc->Pointer->OemTableId,
- TableDesc->Pointer->OemRevision);
- }
- AcpiOsPrintf ("\n");
+ /*
+ * Walk the root table list
+ */
+ for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
+ {
+ TableDesc = &AcpiGbl_RootTableList.Tables[i];
+ AcpiOsPrintf ( "%4.4s at %p length %.5X",
+ TableDesc->Signature.Ascii, TableDesc->Pointer,
+ (UINT32) TableDesc->Length);
- TableDesc = TableDesc->Next;
+ if (TableDesc->Pointer && (i != ACPI_TABLE_INDEX_FACS))
+ {
+ AcpiOsPrintf (" OemId=\"%6s\" OemTableId=\"%8s\" OemRevision=%8.8X",
+ TableDesc->Pointer->OemId,
+ TableDesc->Pointer->OemTableId,
+ TableDesc->Pointer->OemRevision);
}
+ AcpiOsPrintf ("\n");
}
}
@@ -375,13 +479,16 @@
char *TableArg,
char *InstanceArg)
{
+/* TBD: Need to reimplement for new data structures */
+
+#if 0
UINT32 i;
ACPI_STATUS Status;
/* Search all tables for the target type */
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ for (i = 0; i < (ACPI_TABLE_ID_MAX+1); i++)
{
if (!ACPI_STRNCMP (TableArg, AcpiGbl_TableData[i].Signature,
AcpiGbl_TableData[i].SigLength))
@@ -404,6 +511,7 @@
}
AcpiOsPrintf ("Unknown table type [%s]\n", TableArg);
+#endif
}
@@ -442,7 +550,8 @@
Address = ACPI_STRTOUL (Location, NULL, 16);
if (Address <= Op->Common.AmlOffset)
{
- AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n", Address, Op->Common.AmlOffset);
+ AcpiOsPrintf ("Breakpoint %X is beyond current address %X\n",
+ Address, Op->Common.AmlOffset);
}
/* Save breakpoint in current walk */
@@ -524,7 +633,7 @@
*
* FUNCTION: AcpiDbDisassembleMethod
*
- * PARAMETERS: Method - Name of control method
+ * PARAMETERS: Name - Name of control method
*
* RETURN: None
*
@@ -544,7 +653,7 @@
ACPI_NAMESPACE_NODE *Method;
- Method = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ACPI_STRTOUL (Name, NULL, 16));
+ Method = AcpiDbConvertToNode (Name);
if (!Method)
{
return (AE_BAD_PARAMETER);
@@ -568,7 +677,7 @@
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL,
ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, 1);
+ ObjDesc->Method.AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -577,9 +686,12 @@
/* Parse the AML */
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
+#ifdef ACPI_DISASSEMBLER
AcpiDmDisassemble (NULL, Op, 0);
+#endif
AcpiPsDeleteParseTree (Op);
return (AE_OK);
}
@@ -612,34 +724,10 @@
if (StartArg)
{
- /* Check if numeric argument, must be a Node */
-
- if ((StartArg[0] >= 0x30) && (StartArg[0] <= 0x39))
+ SubtreeEntry = AcpiDbConvertToNode (StartArg);
+ if (!SubtreeEntry)
{
- SubtreeEntry = ACPI_TO_POINTER (ACPI_STRTOUL (StartArg, NULL, 16));
- if (!AcpiOsReadable (SubtreeEntry, sizeof (ACPI_NAMESPACE_NODE)))
- {
- AcpiOsPrintf ("Address %p is invalid in this address space\n", SubtreeEntry);
- return;
- }
-
- if (ACPI_GET_DESCRIPTOR_TYPE (SubtreeEntry) != ACPI_DESC_TYPE_NAMED)
- {
- AcpiOsPrintf ("Address %p is not a valid NS node [%s]\n",
- SubtreeEntry, AcpiUtGetDescriptorName (SubtreeEntry));
- return;
- }
- }
- else
- {
- /* Alpha argument */
- /* The parameter is a name string that must be resolved to a Named obj*/
-
- SubtreeEntry = AcpiDbLocalNsLookup (StartArg);
- if (!SubtreeEntry)
- {
- SubtreeEntry = AcpiGbl_RootNode;
- }
+ return;
}
/* Now we can check for the depth argument */
@@ -651,12 +739,14 @@
}
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
- AcpiOsPrintf ("ACPI Namespace (from %p subtree):\n", SubtreeEntry);
+ AcpiOsPrintf ("ACPI Namespace (from %4.4s (%p) subtree):\n",
+ ((ACPI_NAMESPACE_NODE *) SubtreeEntry)->Name.Ascii, SubtreeEntry);
/* Display the subtree */
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
- AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, ACPI_UINT32_MAX, SubtreeEntry);
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth,
+ ACPI_OWNER_ID_MAX, SubtreeEntry);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
@@ -681,10 +771,10 @@
{
ACPI_HANDLE SubtreeEntry = AcpiGbl_RootNode;
UINT32 MaxDepth = ACPI_UINT32_MAX;
- UINT16 OwnerId;
+ ACPI_OWNER_ID OwnerId;
- OwnerId = (UINT16) ACPI_STRTOUL (OwnerArg, NULL, 0);
+ OwnerId = (ACPI_OWNER_ID) ACPI_STRTOUL (OwnerArg, NULL, 0);
/* Now we can check for the depth argument */
@@ -699,7 +789,8 @@
/* Display the subtree */
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
- AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId, SubtreeEntry);
+ AcpiNsDumpObjects (ACPI_TYPE_ANY, ACPI_DISPLAY_SUMMARY, MaxDepth, OwnerId,
+ SubtreeEntry);
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
}
@@ -729,7 +820,7 @@
/* Translate name to an Named object */
- Node = AcpiDbLocalNsLookup (Name);
+ Node = AcpiDbConvertToNode (Name);
if (!Node)
{
return;
@@ -785,23 +876,39 @@
ACPI_WALK_STATE *WalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
/* Validate TypeArg */
- ACPI_STRUPR (TypeArg);
+ AcpiUtStrupr (TypeArg);
Type = TypeArg[0];
if ((Type != 'L') &&
- (Type != 'A'))
+ (Type != 'A') &&
+ (Type != 'N'))
{
AcpiOsPrintf ("Invalid SET operand: %s\n", TypeArg);
return;
}
+ Value = ACPI_STRTOUL (ValueArg, NULL, 16);
+
+ if (Type == 'N')
+ {
+ Node = AcpiDbConvertToNode (IndexArg);
+ if (Node->Type != ACPI_TYPE_INTEGER)
+ {
+ AcpiOsPrintf ("Can only set Integer nodes\n");
+ return;
+ }
+ ObjDesc = Node->Object;
+ ObjDesc->Integer.Value = Value;
+ return;
+ }
+
/* Get the index and value */
Index = ACPI_STRTOUL (IndexArg, NULL, 16);
- Value = ACPI_STRTOUL (ValueArg, NULL, 16);
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
if (!WalkState)
@@ -832,13 +939,14 @@
if (Index > ACPI_METHOD_MAX_ARG)
{
AcpiOsPrintf ("Arg%d - Invalid argument name\n", Index);
- return;
+ goto Cleanup;
}
- Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc, WalkState);
+ Status = AcpiDsStoreObjectToLocal (AML_ARG_OP, Index, ObjDesc,
+ WalkState);
if (ACPI_FAILURE (Status))
{
- return;
+ goto Cleanup;
}
ObjDesc = WalkState->Arguments[Index].Object;
@@ -854,13 +962,14 @@
if (Index > ACPI_METHOD_MAX_LOCAL)
{
AcpiOsPrintf ("Local%d - Invalid local variable name\n", Index);
- return;
+ goto Cleanup;
}
- Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc, WalkState);
+ Status = AcpiDsStoreObjectToLocal (AML_LOCAL_OP, Index, ObjDesc,
+ WalkState);
if (ACPI_FAILURE (Status))
{
- return;
+ goto Cleanup;
}
ObjDesc = WalkState->LocalVariables[Index].Object;
@@ -872,6 +981,9 @@
default:
break;
}
+
+Cleanup:
+ AcpiUtRemoveReference (ObjDesc);
}
@@ -887,19 +999,19 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbWalkForSpecificObjects (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue)
{
- ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_STATUS Status;
+ ACPI_WALK_INFO *Info = (ACPI_WALK_INFO *) Context;
ACPI_BUFFER Buffer;
+ ACPI_STATUS Status;
- ObjDesc = AcpiNsGetAttachedObject ((ACPI_NAMESPACE_NODE *) ObjHandle);
+ Info->Count++;
/* Get and display the full pathname to this object */
@@ -912,52 +1024,11 @@
}
AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
- ACPI_MEM_FREE (Buffer.Pointer);
-
- /* Display short information about the object */
+ ACPI_FREE (Buffer.Pointer);
- if (ObjDesc)
- {
- AcpiOsPrintf (" %p/%p", ObjHandle, ObjDesc);
-
- switch (ACPI_GET_OBJECT_TYPE (ObjDesc))
- {
- case ACPI_TYPE_METHOD:
- AcpiOsPrintf (" #Args %d Concurrency %X",
- ObjDesc->Method.ParamCount, ObjDesc->Method.Concurrency);
- break;
-
- case ACPI_TYPE_INTEGER:
- AcpiOsPrintf (" Value %8.8X%8.8X",
- ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
- break;
-
- case ACPI_TYPE_STRING:
- AcpiOsPrintf (" \"%s\"", ObjDesc->String.Pointer);
- break;
-
- case ACPI_TYPE_REGION:
- AcpiOsPrintf (" SpaceId %X Length %X Address %8.8X%8.8X",
- ObjDesc->Region.SpaceId,
- ObjDesc->Region.Length,
- ACPI_FORMAT_UINT64 (ObjDesc->Region.Address));
- break;
-
- case ACPI_TYPE_PACKAGE:
- AcpiOsPrintf (" #Elements %X", ObjDesc->Package.Count);
- break;
-
- case ACPI_TYPE_BUFFER:
- AcpiOsPrintf (" Length %X", ObjDesc->Buffer.Length);
- break;
-
- default:
- /* Ignore other object types */
- break;
- }
- }
+ /* Dump short info about the object */
- AcpiOsPrintf ("\n");
+ (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, Info, NULL);
return (AE_OK);
}
@@ -980,6 +1051,7 @@
char *ObjTypeArg,
char *DisplayCountArg)
{
+ ACPI_WALK_INFO Info;
ACPI_OBJECT_TYPE Type;
@@ -993,15 +1065,25 @@
}
AcpiDbSetOutputDestination (ACPI_DB_DUPLICATE_OUTPUT);
- AcpiOsPrintf ("Objects of type [%s] defined in the current ACPI Namespace: \n",
+ AcpiOsPrintf (
+ "Objects of type [%s] defined in the current ACPI Namespace:\n",
AcpiUtGetTypeName (Type));
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
+ Info.Count = 0;
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
+ Info.DebugLevel = ACPI_UINT32_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
+
/* Walk the namespace from the root */
(void) AcpiWalkNamespace (Type, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- AcpiDbWalkForSpecificObjects, (void *) &Type, NULL);
+ AcpiDbWalkForSpecificObjects, (void *) &Info, NULL);
+
+ AcpiOsPrintf (
+ "\nFound %u objects of type [%s] in the current ACPI Namespace\n",
+ Info.Count, AcpiUtGetTypeName (Type));
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return (AE_OK);
@@ -1021,7 +1103,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbWalkAndMatchName (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -1032,6 +1114,7 @@
char *RequestedName = (char *) Context;
UINT32 i;
ACPI_BUFFER Buffer;
+ ACPI_WALK_INFO Info;
/* Check for a name match */
@@ -1059,9 +1142,13 @@
}
else
{
- AcpiOsPrintf ("%32s (%p) - %s\n", (char *) Buffer.Pointer, ObjHandle,
- AcpiUtGetTypeName (((ACPI_NAMESPACE_NODE *) ObjHandle)->Type));
- ACPI_MEM_FREE (Buffer.Pointer);
+ Info.OwnerId = ACPI_OWNER_ID_MAX;
+ Info.DebugLevel = ACPI_UINT32_MAX;
+ Info.DisplayType = ACPI_DISPLAY_SUMMARY | ACPI_DISPLAY_SHORT;
+
+ AcpiOsPrintf ("%32s", (char *) Buffer.Pointer);
+ (void) AcpiNsDumpOneObject (ObjHandle, NestingLevel, &Info, NULL);
+ ACPI_FREE (Buffer.Pointer);
}
return (AE_OK);
@@ -1094,6 +1181,7 @@
/* Walk the namespace from the root */
+ AcpiUtStrupr (NameArg);
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbWalkAndMatchName, NameArg, NULL);
@@ -1135,7 +1223,8 @@
{
/* Validate new scope from the root */
- Status = AcpiNsGetNodeByPath (Name, AcpiGbl_RootNode, ACPI_NS_NO_UPSEARCH, &Node);
+ Status = AcpiNsGetNode (AcpiGbl_RootNode, Name, ACPI_NS_NO_UPSEARCH,
+ &Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -1148,7 +1237,8 @@
{
/* Validate new scope relative to old scope */
- Status = AcpiNsGetNodeByPath (Name, AcpiGbl_DbScopeNode, ACPI_NS_NO_UPSEARCH, &Node);
+ Status = AcpiNsGetNode (AcpiGbl_DbScopeNode, Name, ACPI_NS_NO_UPSEARCH,
+ &Node);
if (ACPI_FAILURE (Status))
{
goto ErrorExit;
@@ -1164,7 +1254,178 @@
ErrorExit:
- AcpiOsPrintf ("Could not attach scope: %s, %s\n", Name, AcpiFormatException (Status));
+ AcpiOsPrintf ("Could not attach scope: %s, %s\n",
+ Name, AcpiFormatException (Status));
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCompareAmlResources
+ *
+ * PARAMETERS: Aml1Buffer - Contains first resource list
+ * Aml1BufferLength - Length of first resource list
+ * Aml2Buffer - Contains second resource list
+ * Aml2BufferLength - Length of second resource list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Compare two AML resource lists, descriptor by descriptor (in
+ * order to isolate a miscompare to an individual resource)
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmCompareAmlResources (
+ UINT8 *Aml1Buffer,
+ ACPI_RSDESC_SIZE Aml1BufferLength,
+ UINT8 *Aml2Buffer,
+ ACPI_RSDESC_SIZE Aml2BufferLength)
+{
+ UINT8 *Aml1;
+ UINT8 *Aml2;
+ ACPI_RSDESC_SIZE Aml1Length;
+ ACPI_RSDESC_SIZE Aml2Length;
+ ACPI_RSDESC_SIZE Offset = 0;
+ UINT8 ResourceType;
+ UINT32 Count = 0;
+
+
+ /* Compare overall buffer sizes (may be different due to size rounding) */
+
+ if (Aml1BufferLength != Aml2BufferLength)
+ {
+ AcpiOsPrintf (
+ "**** Buffer length mismatch in converted AML: original %X new %X ****\n",
+ Aml1BufferLength, Aml2BufferLength);
+ }
+
+ Aml1 = Aml1Buffer;
+ Aml2 = Aml2Buffer;
+
+ /* Walk the descriptor lists, comparing each descriptor */
+
+ while (Aml1 < (Aml1Buffer + Aml1BufferLength))
+ {
+ /* Get the lengths of each descriptor */
+
+ Aml1Length = AcpiUtGetDescriptorLength (Aml1);
+ Aml2Length = AcpiUtGetDescriptorLength (Aml2);
+ ResourceType = AcpiUtGetResourceType (Aml1);
+
+ /* Check for descriptor length match */
+
+ if (Aml1Length != Aml2Length)
+ {
+ AcpiOsPrintf (
+ "**** Length mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X L1 %X L2 %X ****\n",
+ Count, ResourceType, Offset, Aml1Length, Aml2Length);
+ }
+
+ /* Check for descriptor byte match */
+
+ else if (ACPI_MEMCMP (Aml1, Aml2, Aml1Length))
+ {
+ AcpiOsPrintf (
+ "**** Data mismatch in descriptor [%.2X] type %2.2X, Offset %8.8X ****\n",
+ Count, ResourceType, Offset);
+ }
+
+ /* Exit on EndTag descriptor */
+
+ if (ResourceType == ACPI_RESOURCE_NAME_END_TAG)
+ {
+ return;
+ }
+
+ /* Point to next descriptor in each buffer */
+
+ Count++;
+ Offset += Aml1Length;
+ Aml1 += Aml1Length;
+ Aml2 += Aml2Length;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmTestResourceConversion
+ *
+ * PARAMETERS: Node - Parent device node
+ * Name - resource method name (_CRS)
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Compare the original AML with a conversion of the AML to
+ * internal resource list, then back to AML.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmTestResourceConversion (
+ ACPI_NAMESPACE_NODE *Node,
+ char *Name)
+{
+ ACPI_STATUS Status;
+ ACPI_BUFFER ReturnObj;
+ ACPI_BUFFER ResourceObj;
+ ACPI_BUFFER NewAml;
+ ACPI_OBJECT *OriginalAml;
+
+
+ AcpiOsPrintf ("Resource Conversion Comparison:\n");
+
+ NewAml.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ ReturnObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ ResourceObj.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+
+ /* Get the original _CRS AML resource template */
+
+ Status = AcpiEvaluateObject (Node, Name, NULL, &ReturnObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not obtain %s: %s\n",
+ Name, AcpiFormatException (Status));
+ return (Status);
+ }
+
+ /* Get the AML resource template, converted to internal resource structs */
+
+ Status = AcpiGetCurrentResources (Node, &ResourceObj);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto Exit1;
+ }
+
+ /* Convert internal resource list to external AML resource template */
+
+ Status = AcpiRsCreateAmlResources (ResourceObj.Pointer, &NewAml);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("AcpiRsCreateAmlResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto Exit2;
+ }
+
+ /* Compare original AML to the newly created AML resource list */
+
+ OriginalAml = ReturnObj.Pointer;
+
+ AcpiDmCompareAmlResources (
+ OriginalAml->Buffer.Pointer, OriginalAml->Buffer.Length,
+ NewAml.Pointer, NewAml.Length);
+
+ /* Cleanup and exit */
+
+ ACPI_FREE (NewAml.Pointer);
+Exit2:
+ ACPI_FREE (ResourceObj.Pointer);
+Exit1:
+ ACPI_FREE (ReturnObj.Pointer);
+ return (Status);
}
@@ -1184,9 +1445,7 @@
AcpiDbDisplayResources (
char *ObjectArg)
{
-#if ACPI_MACHINE_WIDTH != 16
-
- ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_NAMESPACE_NODE *Node;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
@@ -1196,71 +1455,94 @@
/* Convert string to object pointer */
- ObjDesc = ACPI_TO_POINTER (ACPI_STRTOUL (ObjectArg, NULL, 16));
+ Node = AcpiDbConvertToNode (ObjectArg);
+ if (!Node)
+ {
+ return;
+ }
/* Prepare for a return object of arbitrary size */
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
/* _PRT */
AcpiOsPrintf ("Evaluating _PRT\n");
- Status = AcpiEvaluateObject (ObjDesc, "_PRT", NULL, &ReturnObj);
+ /* Check if _PRT exists */
+
+ Status = AcpiEvaluateObject (Node, METHOD_NAME__PRT, NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not obtain _PRT: %s\n", AcpiFormatException (Status));
+ AcpiOsPrintf ("Could not obtain _PRT: %s\n",
+ AcpiFormatException (Status));
goto GetCrs;
}
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiGetIrqRoutingTable (ObjDesc, &ReturnObj);
+ Status = AcpiGetIrqRoutingTable (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n", AcpiFormatException (Status));
- }
- else
- {
- AcpiRsDumpIrqList ((UINT8 *) AcpiGbl_DbBuffer);
+ AcpiOsPrintf ("GetIrqRoutingTable failed: %s\n",
+ AcpiFormatException (Status));
+ goto GetCrs;
}
+ AcpiRsDumpIrqList (ACPI_CAST_PTR (UINT8, AcpiGbl_DbBuffer));
+
/* _CRS */
GetCrs:
AcpiOsPrintf ("Evaluating _CRS\n");
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ /* Check if _CRS exists */
- Status = AcpiEvaluateObject (ObjDesc, "_CRS", NULL, &ReturnObj);
+ Status = AcpiEvaluateObject (Node, METHOD_NAME__CRS, NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not obtain _CRS: %s\n", AcpiFormatException (Status));
+ AcpiOsPrintf ("Could not obtain _CRS: %s\n",
+ AcpiFormatException (Status));
goto GetPrs;
}
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ /* Get the _CRS resource list */
- Status = AcpiGetCurrentResources (ObjDesc, &ReturnObj);
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ Status = AcpiGetCurrentResources (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n", AcpiFormatException (Status));
+ AcpiOsPrintf ("AcpiGetCurrentResources failed: %s\n",
+ AcpiFormatException (Status));
goto GetPrs;
}
- else
- {
- AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
- }
- Status = AcpiSetCurrentResources (ObjDesc, &ReturnObj);
+ /* Dump the _CRS resource list */
+
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE,
+ ReturnObj.Pointer));
+
+ /*
+ * Perform comparison of original AML to newly created AML. This tests both
+ * the AML->Resource conversion and the Resource->Aml conversion.
+ */
+ Status = AcpiDmTestResourceConversion (Node, METHOD_NAME__CRS);
+
+ /* Execute _SRS with the resource list */
+
+ Status = AcpiSetCurrentResources (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n", AcpiFormatException (Status));
+ AcpiOsPrintf ("AcpiSetCurrentResources failed: %s\n",
+ AcpiFormatException (Status));
goto GetPrs;
}
@@ -1270,34 +1552,36 @@
GetPrs:
AcpiOsPrintf ("Evaluating _PRS\n");
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+
+ /* Check if _PRS exists */
- Status = AcpiEvaluateObject (ObjDesc, "_PRS", NULL, &ReturnObj);
+ Status = AcpiEvaluateObject (Node, METHOD_NAME__PRS, NULL, &ReturnObj);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("Could not obtain _PRS: %s\n", AcpiFormatException (Status));
+ AcpiOsPrintf ("Could not obtain _PRS: %s\n",
+ AcpiFormatException (Status));
goto Cleanup;
}
- ReturnObj.Pointer = AcpiGbl_DbBuffer;
- ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
+ ReturnObj.Pointer = AcpiGbl_DbBuffer;
+ ReturnObj.Length = ACPI_DEBUG_BUFFER_SIZE;
- Status = AcpiGetPossibleResources (ObjDesc, &ReturnObj);
+ Status = AcpiGetPossibleResources (Node, &ReturnObj);
if (ACPI_FAILURE (Status))
{
- AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n", AcpiFormatException (Status));
- }
- else
- {
- AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
+ AcpiOsPrintf ("AcpiGetPossibleResources failed: %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
}
+ AcpiRsDumpResourceList (ACPI_CAST_PTR (ACPI_RESOURCE, AcpiGbl_DbBuffer));
+
Cleanup:
AcpiDbSetOutputDestination (ACPI_DB_CONSOLE_OUTPUT);
return;
-#endif
}
@@ -1313,7 +1597,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbIntegrityWalk (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -1371,7 +1655,8 @@
******************************************************************************/
void
-AcpiDbCheckIntegrity (void)
+AcpiDbCheckIntegrity (
+ void)
{
ACPI_INTEGRITY_INFO Info = {0,0};
@@ -1380,7 +1665,8 @@
(void) AcpiWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
AcpiDbIntegrityWalk, (void *) &Info, NULL);
- AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n", Info.Nodes, Info.Objects);
+ AcpiOsPrintf ("Verified %d namespace nodes with %d Objects\n",
+ Info.Nodes, Info.Objects);
}
@@ -1388,7 +1674,9 @@
*
* FUNCTION: AcpiDbGenerateGpe
*
- * PARAMETERS: None
+ * PARAMETERS: GpeArg - Raw GPE number, ascii string
+ * BlockArg - GPE block number, ascii string
+ * 0 or 1 for FADT GPE blocks
*
* RETURN: None
*
@@ -1410,7 +1698,8 @@
BlockNumber = ACPI_STRTOUL (BlockArg, NULL, 0);
- GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber), GpeNumber);
+ GpeEventInfo = AcpiEvGetGpeEventInfo (ACPI_TO_POINTER (BlockNumber),
+ GpeNumber);
if (!GpeEventInfo)
{
AcpiOsPrintf ("Invalid GPE\n");
@@ -1420,4 +1709,130 @@
(void) AcpiEvGpeDispatch (GpeEventInfo, GpeNumber);
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbBusWalk
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Display info about device objects that have a corresponding
+ * _PRT method.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDbBusWalk (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_STATUS Status;
+ ACPI_BUFFER Buffer;
+ ACPI_INTEGER ADR;
+ ACPI_DEVICE_ID Id;
+ ACPI_COMPATIBLE_ID_LIST *Cid;
+ ACPI_NAMESPACE_NODE *TempNode;
+
+
+ /* Exit if there is no _PRT under this device */
+
+ Status = AcpiGetHandle (Node, METHOD_NAME__PRT,
+ ACPI_CAST_PTR (ACPI_HANDLE, &TempNode));
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /* Get the full path to this device object */
+
+ Buffer.Length = ACPI_ALLOCATE_LOCAL_BUFFER;
+ Status = AcpiNsHandleToPathname (ObjHandle, &Buffer);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could Not get pathname for object %p\n", ObjHandle);
+ return (AE_OK);
+ }
+
+ /* Display the full path */
+
+ AcpiOsPrintf ("%-32s", (char *) Buffer.Pointer);
+ ACPI_FREE (Buffer.Pointer);
+
+ /* _PRT info */
+
+ AcpiOsPrintf ("_PRT=%p", TempNode);
+
+ /* Get the _ADR value */
+
+ Status = AcpiUtEvaluateNumericObject (METHOD_NAME__ADR, Node, &ADR);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf (" No _ADR ");
+ }
+ else
+ {
+ AcpiOsPrintf (" _ADR=%8.8X", (UINT32) ADR);
+ }
+
+ /* Get the _HID if present */
+
+ Status = AcpiUtExecute_HID (Node, &Id);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf (" _HID=%s", Id.Value);
+ }
+ else
+ {
+ AcpiOsPrintf (" ");
+ }
+
+ /* Get the _UID if present */
+
+ Status = AcpiUtExecute_UID (Node, &Id);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf (" _UID=%s", Id.Value);
+ }
+
+ /* Get the _CID if present */
+
+ Status = AcpiUtExecute_CID (Node, &Cid);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiOsPrintf (" _CID=%s", Cid->Id[0].Value);
+ ACPI_FREE (Cid);
+ }
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbGetBusInfo
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display info about system busses.
+ *
+ ******************************************************************************/
+
+void
+AcpiDbGetBusInfo (
+ void)
+{
+ /* Search all nodes in namespace */
+
+ (void) AcpiWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
+ AcpiDbBusWalk, NULL, NULL);
+}
+
#endif /* ACPI_DEBUGGER */
Index: dmobject.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmobject.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmobject.c -L sys/contrib/dev/acpica/dmobject.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmobject.c
+++ sys/contrib/dev/acpica/dmobject.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmobject - ACPI object decode and display
- * $Revision: 11 $
+ * $Revision: 1.22 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,8 +127,14 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmnames")
+/* Local prototypes */
-/*****************************************************************************
+static void
+AcpiDmDecodeNode (
+ ACPI_NAMESPACE_NODE *Node);
+
+
+/*******************************************************************************
*
* FUNCTION: AcpiDmDumpMethodInfo
*
@@ -142,7 +148,7 @@
* Dumps the method execution stack, and the method locals/args,
* and disassembles the AML opcode that failed.
*
- ****************************************************************************/
+ ******************************************************************************/
void
AcpiDmDumpMethodInfo (
@@ -171,6 +177,17 @@
return;
}
+ /*
+ * If there is no Thread, we are not actually executing a method.
+ * This can happen when the iASL compiler calls the interpreter
+ * to perform constant folding.
+ */
+ Thread = WalkState->Thread;
+ if (!Thread)
+ {
+ return;
+ }
+
/* Display exception and method name */
AcpiOsPrintf ("\n**** Exception %s during execution of method ",
@@ -180,7 +197,6 @@
/* Display stack of executing methods */
AcpiOsPrintf ("\n\nMethod Execution Stack:\n");
- Thread = WalkState->Thread;
NextWalkState = Thread->WalkStateList;
/* Walk list of linked walk states */
@@ -194,13 +210,16 @@
if (NextWalkState == WalkState)
{
- /* Display currently executing ASL statement */
+ if (Op)
+ {
+ /* Display currently executing ASL statement */
- Next = Op->Common.Next;
- Op->Common.Next = NULL;
+ Next = Op->Common.Next;
+ Op->Common.Next = NULL;
- AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
- Op->Common.Next = Next;
+ AcpiDmDisassemble (NextWalkState, Op, ACPI_UINT32_MAX);
+ Op->Common.Next = Next;
+ }
}
else
{
@@ -236,7 +255,7 @@
*
* RETURN: None
*
- * DESCRIPTION: Short display of an internal object. Numbers and Strings.
+ * DESCRIPTION: Short display of an internal object. Numbers/Strings/Buffers.
*
******************************************************************************/
@@ -316,12 +335,11 @@
*
******************************************************************************/
-void
+static void
AcpiDmDecodeNode (
ACPI_NAMESPACE_NODE *Node)
{
-
AcpiOsPrintf ("<Node> Name %4.4s",
AcpiUtGetNodeName (Node));
@@ -363,7 +381,7 @@
if (!ObjDesc)
{
- AcpiOsPrintf ("<NullObj>\n");
+ AcpiOsPrintf ("<Null Object>\n");
return;
}
@@ -405,7 +423,8 @@
AcpiOsPrintf ("[Local%d] ", ObjDesc->Reference.Offset);
if (WalkState)
{
- ObjDesc = WalkState->LocalVariables[ObjDesc->Reference.Offset].Object;
+ ObjDesc = WalkState->LocalVariables[
+ ObjDesc->Reference.Offset].Object;
AcpiOsPrintf ("%p", ObjDesc);
AcpiDmDecodeInternalObject (ObjDesc);
}
@@ -417,7 +436,8 @@
AcpiOsPrintf ("[Arg%d] ", ObjDesc->Reference.Offset);
if (WalkState)
{
- ObjDesc = WalkState->Arguments[ObjDesc->Reference.Offset].Object;
+ ObjDesc = WalkState->Arguments[
+ ObjDesc->Reference.Offset].Object;
AcpiOsPrintf ("%p", ObjDesc);
AcpiDmDecodeInternalObject (ObjDesc);
}
@@ -449,7 +469,8 @@
}
else
{
- AcpiDmDecodeInternalObject (*(ObjDesc->Reference.Where));
+ AcpiDmDecodeInternalObject (
+ *(ObjDesc->Reference.Where));
}
break;
@@ -493,6 +514,10 @@
}
break;
+ case AML_INT_NAMEPATH_OP:
+
+ AcpiDmDecodeNode (ObjDesc->Reference.Node);
+ break;
default:
@@ -527,7 +552,7 @@
*
* FUNCTION: AcpiDmDisplayLocals
*
- * PARAMETERS: None
+ * PARAMETERS: WalkState - State for current method
*
* RETURN: None
*
@@ -548,7 +573,8 @@
Node = WalkState->MethodNode;
if (!Node)
{
- AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
+ AcpiOsPrintf (
+ "No method node (Executing subtree for buffer or opregion)\n");
return;
}
@@ -574,7 +600,7 @@
*
* FUNCTION: AcpiDmDisplayArguments
*
- * PARAMETERS: None
+ * PARAMETERS: WalkState - State for current method
*
* RETURN: None
*
@@ -588,8 +614,6 @@
{
UINT32 i;
ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 NumArgs;
- UINT32 Concurrency;
ACPI_NAMESPACE_NODE *Node;
@@ -597,7 +621,8 @@
Node = WalkState->MethodNode;
if (!Node)
{
- AcpiOsPrintf ("No method node (Executing subtree for buffer or opregion)\n");
+ AcpiOsPrintf (
+ "No method node (Executing subtree for buffer or opregion)\n");
return;
}
@@ -607,11 +632,9 @@
return;
}
- NumArgs = ObjDesc->Method.ParamCount;
- Concurrency = ObjDesc->Method.Concurrency;
-
- AcpiOsPrintf ("Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n",
- AcpiUtGetNodeName (Node), NumArgs, Concurrency);
+ AcpiOsPrintf (
+ "Arguments for Method [%4.4s]: (%X arguments defined, max concurrency = %X)\n",
+ AcpiUtGetNodeName (Node), ObjDesc->Method.ParamCount, ObjDesc->Method.SyncLevel);
for (i = 0; i < ACPI_METHOD_NUM_ARGS; i++)
{
Index: evxfregn.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evxfregn.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evxfregn.c -L sys/contrib/dev/acpica/evxfregn.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evxfregn.c
+++ sys/contrib/dev/acpica/evxfregn.c
@@ -2,7 +2,7 @@
*
* Module Name: evxfregn - External Interfaces, ACPI Operation Regions and
* Address Spaces.
- * $Revision: 63 $
+ * $Revision: 1.70 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -42,7 +42,7 @@
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial prton of the Covered
+ * Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
@@ -153,7 +153,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiInstallAddressSpaceHandler");
+ ACPI_FUNCTION_TRACE (AcpiInstallAddressSpaceHandler);
/* Parameter validation */
@@ -195,6 +195,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallAddressSpaceHandler)
+
/*******************************************************************************
*
@@ -224,7 +226,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiRemoveAddressSpaceHandler");
+ ACPI_FUNCTION_TRACE (AcpiRemoveAddressSpaceHandler);
/* Parameter validation */
@@ -243,7 +245,11 @@
/* Convert and validate the device handle */
Node = AcpiNsMapHandleToNode (Device);
- if (!Node)
+ if (!Node ||
+ ((Node->Type != ACPI_TYPE_DEVICE) &&
+ (Node->Type != ACPI_TYPE_PROCESSOR) &&
+ (Node->Type != ACPI_TYPE_THERMAL) &&
+ (Node != AcpiGbl_RootNode)))
{
Status = AE_BAD_PARAMETER;
goto UnlockAndExit;
@@ -268,6 +274,14 @@
if (HandlerObj->AddressSpace.SpaceId == SpaceId)
{
+ /* Handler must be the same as the installed handler */
+
+ if (HandlerObj->AddressSpace.Handler != Handler)
+ {
+ Status = AE_BAD_PARAMETER;
+ goto UnlockAndExit;
+ }
+
/* Matched SpaceId, first dereference this in the Regions */
ACPI_DEBUG_PRINT ((ACPI_DB_OPREGION,
@@ -327,4 +341,5 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveAddressSpaceHandler)
Index: nswalk.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nswalk.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nswalk.c -L sys/contrib/dev/acpica/nswalk.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nswalk.c
+++ sys/contrib/dev/acpica/nswalk.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nswalk - Functions for walking the ACPI namespace
- * $Revision: 37 $
+ * $Revision: 1.46 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -131,7 +131,7 @@
*
* PARAMETERS: Type - Type of node to be searched for
* ParentNode - Parent node whose children we are
- * getting
+ * getting
* ChildNode - Previous child that was found.
* The NEXT child will be returned
*
@@ -160,10 +160,7 @@
{
/* It's really the parent's _scope_ that we want */
- if (ParentNode->Child)
- {
- NextNode = ParentNode->Child;
- }
+ NextNode = ParentNode->Child;
}
else
@@ -211,7 +208,7 @@
* PARAMETERS: Type - ACPI_OBJECT_TYPE to search for
* StartNode - Handle in namespace where search begins
* MaxDepth - Depth to which search is to reach
- * UnlockBeforeCallback- Whether to unlock the NS before invoking
+ * Flags - Whether to unlock the NS before invoking
* the callback routine
* UserFunction - Called when an object of "Type" is found
* Context - Passed to user function
@@ -239,7 +236,7 @@
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartNode,
UINT32 MaxDepth,
- BOOLEAN UnlockBeforeCallback,
+ UINT32 Flags,
ACPI_WALK_CALLBACK UserFunction,
void *Context,
void **ReturnValue)
@@ -252,7 +249,7 @@
UINT32 Level;
- ACPI_FUNCTION_TRACE ("NsWalkNamespace");
+ ACPI_FUNCTION_TRACE (NsWalkNamespace);
/* Special case for the namespace Root Node */
@@ -282,22 +279,36 @@
ChildNode = AcpiNsGetNextNode (ACPI_TYPE_ANY, ParentNode, ChildNode);
if (ChildNode)
{
- /*
- * Found node, Get the type if we are not
- * searching for ANY
- */
+ /* Found next child, get the type if we are not searching for ANY */
+
if (Type != ACPI_TYPE_ANY)
{
ChildType = ChildNode->Type;
}
- if (ChildType == Type)
+ /*
+ * Ignore all temporary namespace nodes (created during control
+ * method execution) unless told otherwise. These temporary nodes
+ * can cause a race condition because they can be deleted during the
+ * execution of the user function (if the namespace is unlocked before
+ * invocation of the user function.) Only the debugger namespace dump
+ * will examine the temporary nodes.
+ */
+ if ((ChildNode->Flags & ANOBJ_TEMPORARY) &&
+ !(Flags & ACPI_NS_WALK_TEMP_NODES))
+ {
+ Status = AE_CTRL_DEPTH;
+ }
+
+ /* Type must match requested type */
+
+ else if (ChildType == Type)
{
/*
- * Found a matching node, invoke the user
- * callback function
+ * Found a matching node, invoke the user callback function.
+ * Unlock the namespace if flag is set.
*/
- if (UnlockBeforeCallback)
+ if (Flags & ACPI_NS_WALK_UNLOCK)
{
MutexStatus = AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (MutexStatus))
@@ -306,10 +317,9 @@
}
}
- Status = UserFunction (ChildNode, Level,
- Context, ReturnValue);
+ Status = UserFunction (ChildNode, Level, Context, ReturnValue);
- if (UnlockBeforeCallback)
+ if (Flags & ACPI_NS_WALK_UNLOCK)
{
MutexStatus = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (MutexStatus))
@@ -341,33 +351,28 @@
}
/*
- * Depth first search:
- * Attempt to go down another level in the namespace
- * if we are allowed to. Don't go any further if we
- * have reached the caller specified maximum depth
- * or if the user function has specified that the
- * maximum depth has been reached.
+ * Depth first search: Attempt to go down another level in the
+ * namespace if we are allowed to. Don't go any further if we have
+ * reached the caller specified maximum depth or if the user
+ * function has specified that the maximum depth has been reached.
*/
if ((Level < MaxDepth) && (Status != AE_CTRL_DEPTH))
{
if (AcpiNsGetNextNode (ACPI_TYPE_ANY, ChildNode, NULL))
{
- /*
- * There is at least one child of this
- * node, visit the onde
- */
+ /* There is at least one child of this node, visit it */
+
Level++;
ParentNode = ChildNode;
- ChildNode = NULL;
+ ChildNode = NULL;
}
}
}
else
{
/*
- * No more children of this node (AcpiNsGetNextNode
- * failed), go back upwards in the namespace tree to
- * the node's parent.
+ * No more children of this node (AcpiNsGetNextNode failed), go
+ * back upwards in the namespace tree to the node's parent.
*/
Level--;
ChildNode = ParentNode;
Index: exstoren.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exstoren.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exstoren.c -L sys/contrib/dev/acpica/exstoren.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exstoren.c
+++ sys/contrib/dev/acpica/exstoren.c
@@ -3,7 +3,7 @@
*
* Module Name: exstoren - AML Interpreter object store support,
* Store to Node (namespace object)
- * $Revision: 59 $
+ * $Revision: 1.71 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -152,12 +152,11 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExResolveObject");
+ ACPI_FUNCTION_TRACE (ExResolveObject);
- /*
- * Ensure we have a Target that can be stored to
- */
+ /* Ensure we have a Target that can be stored to */
+
switch (TargetType)
{
case ACPI_TYPE_BUFFER_FIELD:
@@ -196,19 +195,17 @@
break;
}
- /*
- * Must have a Integer, Buffer, or String
- */
+ /* Must have a Integer, Buffer, or String */
+
if ((ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_INTEGER) &&
(ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_BUFFER) &&
(ACPI_GET_OBJECT_TYPE (SourceDesc) != ACPI_TYPE_STRING) &&
!((ACPI_GET_OBJECT_TYPE (SourceDesc) == ACPI_TYPE_LOCAL_REFERENCE) && (SourceDesc->Reference.Opcode == AML_LOAD_OP)))
{
- /*
- * Conversion successful but still not a valid type
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Cannot assign type %s to %s (must be type Int/Str/Buf)\n",
+ /* Conversion successful but still not a valid type */
+
+ ACPI_ERROR ((AE_INFO,
+ "Cannot assign type %s to %s (must be type Int/Str/Buf)",
AcpiUtGetObjectTypeName (SourceDesc),
AcpiUtGetTypeName (TargetType)));
Status = AE_AML_OPERAND_TYPE;
@@ -220,9 +217,10 @@
case ACPI_TYPE_LOCAL_METHOD_ALIAS:
/*
- * Aliases are resolved by AcpiExPrepOperands
+ * All aliases should have been resolved earlier, during the
+ * operand resolution phase.
*/
- ACPI_REPORT_ERROR (("Store into Alias - should never happen\n"));
+ ACPI_ERROR ((AE_INFO, "Store into an unresolved Alias object"));
Status = AE_AML_INTERNAL;
break;
@@ -287,7 +285,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreObjectToObject", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreObjectToObject, SourceDesc);
ActualSrcDesc = SourceDesc;
@@ -313,8 +311,8 @@
* Otherwise, ActualSrcDesc is a temporary object to hold the
* converted object.
*/
- Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc), SourceDesc,
- &ActualSrcDesc, WalkState);
+ Status = AcpiExConvertToTargetType (ACPI_GET_OBJECT_TYPE (DestDesc),
+ SourceDesc, &ActualSrcDesc, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -323,7 +321,7 @@
if (SourceDesc == ActualSrcDesc)
{
/*
- * No conversion was performed. Return the SourceDesc as the
+ * No conversion was performed. Return the SourceDesc as the
* new object.
*/
*NewDesc = SourceDesc;
@@ -358,14 +356,15 @@
case ACPI_TYPE_PACKAGE:
- Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc, WalkState);
+ Status = AcpiUtCopyIobjectToIobject (ActualSrcDesc, &DestDesc,
+ WalkState);
break;
default:
/*
* All other types come here.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "Store into type %s not implemented\n",
+ ACPI_WARNING ((AE_INFO, "Store into type %s not implemented",
AcpiUtGetObjectTypeName (DestDesc)));
Status = AE_NOT_IMPLEMENTED;
Index: nsparse.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/nsparse.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/nsparse.c -L sys/contrib/dev/acpica/nsparse.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/nsparse.c
+++ sys/contrib/dev/acpica/nsparse.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: nsparse - namespace interface to AML parser
- * $Revision: 6 $
+ * $Revision: 1.16 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,6 +120,7 @@
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_NAMESPACE
@@ -141,17 +142,27 @@
ACPI_STATUS
AcpiNsOneCompleteParse (
- UINT32 PassNumber,
- ACPI_TABLE_DESC *TableDesc)
+ ACPI_NATIVE_UINT PassNumber,
+ ACPI_NATIVE_UINT TableIndex)
{
ACPI_PARSE_OBJECT *ParseRoot;
ACPI_STATUS Status;
+ ACPI_NATIVE_UINT AmlLength;
+ UINT8 *AmlStart;
ACPI_WALK_STATE *WalkState;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_OWNER_ID OwnerId;
- ACPI_FUNCTION_TRACE ("NsOneCompleteParse");
+ ACPI_FUNCTION_TRACE (NsOneCompleteParse);
+ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Create and init a Root Node */
ParseRoot = AcpiPsCreateScopeOp ();
@@ -162,26 +173,46 @@
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (TableDesc->TableId,
- NULL, NULL, NULL);
+ WalkState = AcpiDsCreateWalkState (OwnerId, NULL, NULL, NULL);
if (!WalkState)
{
AcpiPsFreeOp (ParseRoot);
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
- TableDesc->AmlStart, TableDesc->AmlLength,
- NULL, PassNumber);
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiDsDeleteWalkState (WalkState);
+ AcpiPsFreeOp (ParseRoot);
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Table must consist of at least a complete header */
+
+ if (Table->Length < sizeof (ACPI_TABLE_HEADER))
+ {
+ Status = AE_BAD_HEADER;
+ }
+ else
+ {
+ AmlStart = (UINT8 *) Table + sizeof (ACPI_TABLE_HEADER);
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+ Status = AcpiDsInitAmlWalk (WalkState, ParseRoot, NULL,
+ AmlStart, AmlLength, NULL, (UINT8) PassNumber);
+ }
+
if (ACPI_FAILURE (Status))
{
AcpiDsDeleteWalkState (WalkState);
+ AcpiPsDeleteParseTree (ParseRoot);
return_ACPI_STATUS (Status);
}
/* Parse the AML */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %d parse\n", PassNumber));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "*PARSE* pass %lu parse\n",
+ (unsigned long) PassNumber));
Status = AcpiPsParseAml (WalkState);
AcpiPsDeleteParseTree (ParseRoot);
@@ -204,13 +235,13 @@
ACPI_STATUS
AcpiNsParseTable (
- ACPI_TABLE_DESC *TableDesc,
+ ACPI_NATIVE_UINT TableIndex,
ACPI_NAMESPACE_NODE *StartNode)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("NsParseTable");
+ ACPI_FUNCTION_TRACE (NsParseTable);
/*
@@ -221,9 +252,10 @@
* each Parser Op subtree is deleted when it is finished. This saves
* a great deal of memory, and allows a small cache of parse objects
* to service the entire parse. The second pass of the parse then
- * performs another complete parse of the AML..
+ * performs another complete parse of the AML.
*/
- Status = AcpiNsOneCompleteParse (1, TableDesc);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 1\n"));
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS1, TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -238,7 +270,8 @@
* overhead of this is compensated for by the fact that the
* parse objects are all cached.
*/
- Status = AcpiNsOneCompleteParse (2, TableDesc);
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "**** Start pass 2\n"));
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
Index: acnamesp.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acnamesp.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acnamesp.h -L sys/contrib/dev/acpica/acnamesp.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acnamesp.h
+++ sys/contrib/dev/acpica/acnamesp.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acnamesp.h - Namespace subcomponent prototypes and defines
- * $Revision: 136 $
+ * $Revision: 1.152 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,17 +130,6 @@
#define ACPI_NS_NEWSCOPE 1 /* a definition of this type opens a name scope */
#define ACPI_NS_LOCAL 2 /* suppress search of enclosing scopes */
-
-/* Definitions of the predefined namespace names */
-
-#define ACPI_UNKNOWN_NAME (UINT32) 0x3F3F3F3F /* Unknown name is "????" */
-#define ACPI_ROOT_NAME (UINT32) 0x5F5F5F5C /* Root name is "\___" */
-#define ACPI_SYS_BUS_NAME (UINT32) 0x5F53425F /* Sys bus name is "_SB_" */
-
-#define ACPI_NS_ROOT_PATH "\\"
-#define ACPI_NS_SYSTEM_BUS "_SB_"
-
-
/* Flags for AcpiNsLookup, AcpiNsSearchAndEnter */
#define ACPI_NS_NO_UPSEARCH 0
@@ -148,15 +137,20 @@
#define ACPI_NS_DONT_OPEN_SCOPE 0x02
#define ACPI_NS_NO_PEER_SEARCH 0x04
#define ACPI_NS_ERROR_IF_FOUND 0x08
+#define ACPI_NS_PREFIX_IS_SCOPE 0x10
+#define ACPI_NS_EXTERNAL 0x20
+#define ACPI_NS_TEMPORARY 0x40
-#define ACPI_NS_WALK_UNLOCK TRUE
-#define ACPI_NS_WALK_NO_UNLOCK FALSE
+/* Flags for AcpiNsWalkNamespace */
+#define ACPI_NS_WALK_NO_UNLOCK 0
+#define ACPI_NS_WALK_UNLOCK 0x01
+#define ACPI_NS_WALK_TEMP_NODES 0x02
-ACPI_STATUS
-AcpiNsLoadNamespace (
- void);
+/*
+ * nsinit - Namespace initialization
+ */
ACPI_STATUS
AcpiNsInitializeObjects (
void);
@@ -166,29 +160,28 @@
void);
-/* Namespace init - nsxfinit */
-
+/*
+ * nsload - Namespace loading
+ */
ACPI_STATUS
-AcpiNsInitOneDevice (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
+AcpiNsLoadNamespace (
+ void);
ACPI_STATUS
-AcpiNsInitOneObject (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Context,
- void **ReturnValue);
+AcpiNsLoadTable (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_NAMESPACE_NODE *Node);
+/*
+ * nswalk - walk the namespace
+ */
ACPI_STATUS
AcpiNsWalkNamespace (
ACPI_OBJECT_TYPE Type,
ACPI_HANDLE StartObject,
UINT32 MaxDepth,
- BOOLEAN UnlockBeforeCallback,
+ UINT32 Flags,
ACPI_WALK_CALLBACK UserFunction,
void *Context,
void **ReturnValue);
@@ -199,37 +192,24 @@
ACPI_NAMESPACE_NODE *Parent,
ACPI_NAMESPACE_NODE *Child);
-void
-AcpiNsDeleteNamespaceByOwner (
- UINT16 TableId);
-
-
-/* Namespace loading - nsload */
-
-ACPI_STATUS
-AcpiNsOneCompleteParse (
- UINT32 PassNumber,
- ACPI_TABLE_DESC *TableDesc);
+/*
+ * nsparse - table parsing
+ */
ACPI_STATUS
AcpiNsParseTable (
- ACPI_TABLE_DESC *TableDesc,
- ACPI_NAMESPACE_NODE *Scope);
-
-ACPI_STATUS
-AcpiNsLoadTable (
- ACPI_TABLE_DESC *TableDesc,
- ACPI_NAMESPACE_NODE *Node);
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_NAMESPACE_NODE *StartNode);
ACPI_STATUS
-AcpiNsLoadTableByType (
- ACPI_TABLE_TYPE TableType);
+AcpiNsOneCompleteParse (
+ ACPI_NATIVE_UINT PassNumber,
+ ACPI_NATIVE_UINT TableIndex);
/*
- * Top-level namespace access - nsaccess
+ * nsaccess - Top-level namespace access
*/
-
ACPI_STATUS
AcpiNsRootInitialize (
void);
@@ -246,9 +226,8 @@
/*
- * Named object allocation/deallocation - nsalloc
+ * nsalloc - Named object allocation/deallocation
*/
-
ACPI_NAMESPACE_NODE *
AcpiNsCreateNode (
UINT32 Name);
@@ -262,6 +241,10 @@
ACPI_NAMESPACE_NODE *ParentHandle);
void
+AcpiNsDeleteNamespaceByOwner (
+ ACPI_OWNER_ID OwnerId);
+
+void
AcpiNsDetachObject (
ACPI_NAMESPACE_NODE *Node);
@@ -274,28 +257,10 @@
char *Name1,
char *Name2);
-void
-AcpiNsRemoveReference (
- ACPI_NAMESPACE_NODE *Node);
-
/*
- * Namespace modification - nsmodify
+ * nsdump - Namespace dump/print utilities
*/
-
-ACPI_STATUS
-AcpiNsUnloadNamespace (
- ACPI_HANDLE Handle);
-
-ACPI_STATUS
-AcpiNsDeleteSubtree (
- ACPI_HANDLE StartHandle);
-
-
-/*
- * Namespace dump/print utilities - nsdump
- */
-
void
AcpiNsDumpTables (
ACPI_HANDLE SearchBase,
@@ -319,17 +284,6 @@
char *Pathname);
ACPI_STATUS
-AcpiNsDumpOneDevice (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Context,
- void **ReturnValue);
-
-void
-AcpiNsDumpRootDevices (
- void);
-
-ACPI_STATUS
AcpiNsDumpOneObject (
ACPI_HANDLE ObjHandle,
UINT32 Level,
@@ -341,50 +295,21 @@
ACPI_OBJECT_TYPE Type,
UINT8 DisplayType,
UINT32 MaxDepth,
- UINT32 OwnderId,
+ ACPI_OWNER_ID OwnerId,
ACPI_HANDLE StartHandle);
/*
- * Namespace evaluation functions - nseval
+ * nseval - Namespace evaluation functions
*/
-
-ACPI_STATUS
-AcpiNsEvaluateByHandle (
- ACPI_PARAMETER_INFO *Info);
-
-ACPI_STATUS
-AcpiNsEvaluateByName (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info);
-
ACPI_STATUS
-AcpiNsEvaluateRelative (
- char *Pathname,
- ACPI_PARAMETER_INFO *Info);
-
-ACPI_STATUS
-AcpiNsExecuteControlMethod (
- ACPI_PARAMETER_INFO *Info);
-
-ACPI_STATUS
-AcpiNsGetObjectValue (
- ACPI_PARAMETER_INFO *Info);
-
-
-/*
- * Parent/Child/Peer utility functions
- */
-
-ACPI_NAME
-AcpiNsFindParentName (
- ACPI_NAMESPACE_NODE *NodeToSearch);
+AcpiNsEvaluate (
+ ACPI_EVALUATE_INFO *Info);
/*
- * Name and Scope manipulation - nsnames
+ * nsnames - Name and Scope manipulation
*/
-
UINT32
AcpiNsOpensScope (
ACPI_OBJECT_TYPE Type);
@@ -414,9 +339,9 @@
char *SearchFor);
ACPI_STATUS
-AcpiNsGetNodeByPath (
+AcpiNsGetNode (
+ ACPI_NAMESPACE_NODE *PrefixNode,
char *ExternalPathname,
- ACPI_NAMESPACE_NODE *InPrefixNode,
UINT32 Flags,
ACPI_NAMESPACE_NODE **OutNode);
@@ -426,9 +351,8 @@
/*
- * Object management for namespace nodes - nsobject
+ * nsobject - Object management for namespace nodes
*/
-
ACPI_STATUS
AcpiNsAttachObject (
ACPI_NAMESPACE_NODE *Node,
@@ -462,9 +386,8 @@
/*
- * Namespace searching and entry - nssearch
+ * nssearch - Namespace searching and entry
*/
-
ACPI_STATUS
AcpiNsSearchAndEnter (
UINT32 EntryName,
@@ -476,7 +399,7 @@
ACPI_NAMESPACE_NODE **RetNode);
ACPI_STATUS
-AcpiNsSearchNode (
+AcpiNsSearchOneScope (
UINT32 EntryName,
ACPI_NAMESPACE_NODE *Node,
ACPI_OBJECT_TYPE Type,
@@ -491,17 +414,12 @@
/*
- * Utility functions - nsutils
+ * nsutils - Utility functions
*/
-
BOOLEAN
AcpiNsValidRootPrefix (
char Prefix);
-BOOLEAN
-AcpiNsValidPathSeparator (
- char Sep);
-
ACPI_OBJECT_TYPE
AcpiNsGetType (
ACPI_NAMESPACE_NODE *Node);
@@ -514,7 +432,6 @@
AcpiNsReportError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *InternalName,
ACPI_STATUS LookupStatus);
@@ -522,7 +439,6 @@
AcpiNsReportMethodError (
char *ModuleName,
UINT32 LineNumber,
- UINT32 ComponentId,
char *Message,
ACPI_NAMESPACE_NODE *Node,
char *Path,
@@ -574,5 +490,4 @@
AcpiNsGetNextValidNode (
ACPI_NAMESPACE_NODE *Node);
-
#endif /* __ACNAMESP_H__ */
Index: evxfevnt.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evxfevnt.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evxfevnt.c -L sys/contrib/dev/acpica/evxfevnt.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evxfevnt.c
+++ sys/contrib/dev/acpica/evxfevnt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evxfevnt - External Interfaces, ACPI event disable/enable
- * $Revision: 79 $
+ * $Revision: 1.93 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -41,7 +41,7 @@
* 3. Conditions
*
* 3.1. Redistribution of Source with Rights to Further Distribute Source.
- * Redistribution of source code of any substantial prton of the Covered
+ * Redistribution of source code of any substantial portion of the Covered
* Code or modification with rights to further distribute source must include
* the above Copyright Notice, the above License, this list of Conditions,
* and the following Disclaimer and Export Compliance provision. In addition,
@@ -120,6 +120,7 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acevents.h>
#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evxfevnt")
@@ -138,22 +139,24 @@
******************************************************************************/
ACPI_STATUS
-AcpiEnable (void)
+AcpiEnable (
+ void)
{
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiEnable");
+ ACPI_FUNCTION_TRACE (AcpiEnable);
- /* Make sure we have the FADT*/
+ /* ACPI tables must be present */
- if (!AcpiGbl_FADT)
+ if (!AcpiTbTablesLoaded ())
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
return_ACPI_STATUS (AE_NO_ACPI_TABLES);
}
+ /* Check current mode */
+
if (AcpiHwGetMode() == ACPI_SYS_MODE_ACPI)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in ACPI mode\n"));
@@ -165,16 +168,19 @@
Status = AcpiHwSetMode (ACPI_SYS_MODE_ACPI);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not transition to ACPI mode.\n"));
+ ACPI_ERROR ((AE_INFO, "Could not transition to ACPI mode"));
return_ACPI_STATUS (Status);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "Transition to ACPI mode successful\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
+ "Transition to ACPI mode successful\n"));
}
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEnable)
+
/*******************************************************************************
*
@@ -184,28 +190,24 @@
*
* RETURN: Status
*
- * DESCRIPTION: Transfers the system into LEGACY mode.
+ * DESCRIPTION: Transfers the system into LEGACY (non-ACPI) mode.
*
******************************************************************************/
ACPI_STATUS
-AcpiDisable (void)
+AcpiDisable (
+ void)
{
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiDisable");
-
+ ACPI_FUNCTION_TRACE (AcpiDisable);
- if (!AcpiGbl_FADT)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "No FADT information present!\n"));
- return_ACPI_STATUS (AE_NO_ACPI_TABLES);
- }
if (AcpiHwGetMode() == ACPI_SYS_MODE_LEGACY)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "System is already in legacy (non-ACPI) mode\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
+ "System is already in legacy (non-ACPI) mode\n"));
}
else
{
@@ -215,7 +217,8 @@
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not exit ACPI mode to legacy mode"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not exit ACPI mode to legacy mode"));
return_ACPI_STATUS (Status);
}
@@ -225,6 +228,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDisable)
+
/*******************************************************************************
*
@@ -248,7 +253,7 @@
UINT32 Value;
- ACPI_FUNCTION_TRACE ("AcpiEnableEvent");
+ ACPI_FUNCTION_TRACE (AcpiEnableEvent);
/* Decode the Fixed Event */
@@ -262,8 +267,7 @@
* Enable the requested fixed event (by writing a one to the
* enable register bit)
*/
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 1, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -272,7 +276,7 @@
/* Make sure that the hardware responded */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- &Value, ACPI_MTX_LOCK);
+ &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -280,14 +284,16 @@
if (Value != 1)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not enable %s event\n", AcpiUtGetEventName (Event)));
+ ACPI_ERROR ((AE_INFO,
+ "Could not enable %s event", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEnableEvent)
+
/*******************************************************************************
*
@@ -299,7 +305,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Enable an ACPI event (general purpose)
+ * DESCRIPTION: Set the type of an individual GPE
*
******************************************************************************/
@@ -313,7 +319,7 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiSetGpeType");
+ ACPI_FUNCTION_TRACE (AcpiSetGpeType);
/* Ensure that we have a valid GPE number */
@@ -338,6 +344,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiSetGpeType)
+
/*******************************************************************************
*
@@ -364,7 +372,7 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiEnableGpe");
+ ACPI_FUNCTION_TRACE (AcpiEnableGpe);
/* Use semaphore lock if not executing at interrupt level */
@@ -399,6 +407,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiEnableGpe)
+
/*******************************************************************************
*
@@ -425,7 +435,7 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiDisableGpe");
+ ACPI_FUNCTION_TRACE (AcpiDisableGpe);
/* Use semaphore lock if not executing at interrupt level */
@@ -458,6 +468,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDisableGpe)
+
/*******************************************************************************
*
@@ -481,7 +493,7 @@
UINT32 Value;
- ACPI_FUNCTION_TRACE ("AcpiDisableEvent");
+ ACPI_FUNCTION_TRACE (AcpiDisableEvent);
/* Decode the Fixed Event */
@@ -495,15 +507,14 @@
* Disable the requested fixed event (by writing a zero to the
* enable register bit)
*/
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- 0, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId, 0);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].EnableRegisterId,
- &Value, ACPI_MTX_LOCK);
+ &Value);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -511,14 +522,16 @@
if (Value != 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Could not disable %s events\n", AcpiUtGetEventName (Event)));
+ ACPI_ERROR ((AE_INFO,
+ "Could not disable %s events", AcpiUtGetEventName (Event)));
return_ACPI_STATUS (AE_NO_HARDWARE_RESPONSE);
}
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiDisableEvent)
+
/*******************************************************************************
*
@@ -539,7 +552,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiClearEvent");
+ ACPI_FUNCTION_TRACE (AcpiClearEvent);
/* Decode the Fixed Event */
@@ -553,12 +566,13 @@
* Clear the requested fixed event (By writing a one to the
* status register bit)
*/
- Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- 1, ACPI_MTX_LOCK);
+ Status = AcpiSetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId, 1);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiClearEvent)
+
/*******************************************************************************
*
@@ -584,7 +598,7 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiClearGpe");
+ ACPI_FUNCTION_TRACE (AcpiClearGpe);
/* Use semaphore lock if not executing at interrupt level */
@@ -617,13 +631,15 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiClearGpe)
+
/*******************************************************************************
*
* FUNCTION: AcpiGetEventStatus
*
* PARAMETERS: Event - The fixed event
- * Event Status - Where the current status of the event will
+ * EventStatus - Where the current status of the event will
* be returned
*
* RETURN: Status
@@ -640,7 +656,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("AcpiGetEventStatus");
+ ACPI_FUNCTION_TRACE (AcpiGetEventStatus);
if (!EventStatus)
@@ -658,11 +674,13 @@
/* Get the status of the requested fixed event */
Status = AcpiGetRegister (AcpiGbl_FixedEventInfo[Event].StatusRegisterId,
- EventStatus, ACPI_MTX_LOCK);
+ EventStatus);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetEventStatus)
+
/*******************************************************************************
*
@@ -671,7 +689,7 @@
* PARAMETERS: GpeDevice - Parent GPE Device
* GpeNumber - GPE level within the GPE block
* Flags - Called from an ISR or not
- * Event Status - Where the current status of the event will
+ * EventStatus - Where the current status of the event will
* be returned
*
* RETURN: Status
@@ -691,7 +709,7 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_FUNCTION_TRACE ("AcpiGetGpeStatus");
+ ACPI_FUNCTION_TRACE (AcpiGetGpeStatus);
/* Use semaphore lock if not executing at interrupt level */
@@ -726,6 +744,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetGpeStatus)
+
/*******************************************************************************
*
@@ -734,7 +754,7 @@
* PARAMETERS: GpeDevice - Handle to the parent GPE Block Device
* GpeBlockAddress - Address and SpaceID
* RegisterCount - Number of GPE register pairs in the block
- * InterruptLevel - H/W interrupt for the block
+ * InterruptNumber - H/W interrupt for the block
*
* RETURN: Status
*
@@ -747,7 +767,7 @@
ACPI_HANDLE GpeDevice,
ACPI_GENERIC_ADDRESS *GpeBlockAddress,
UINT32 RegisterCount,
- UINT32 InterruptLevel)
+ UINT32 InterruptNumber)
{
ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
@@ -755,7 +775,7 @@
ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_FUNCTION_TRACE ("AcpiInstallGpeBlock");
+ ACPI_FUNCTION_TRACE (AcpiInstallGpeBlock);
if ((!GpeDevice) ||
@@ -783,7 +803,15 @@
* is always zero
*/
Status = AcpiEvCreateGpeBlock (Node, GpeBlockAddress, RegisterCount,
- 0, InterruptLevel, &GpeBlock);
+ 0, InterruptNumber, &GpeBlock);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Run the _PRW methods and enable the GPEs */
+
+ Status = AcpiEvInitializeGpeBlock (Node, GpeBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -825,6 +853,8 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInstallGpeBlock)
+
/*******************************************************************************
*
@@ -847,7 +877,7 @@
ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("AcpiRemoveGpeBlock");
+ ACPI_FUNCTION_TRACE (AcpiRemoveGpeBlock);
if (!GpeDevice)
@@ -890,3 +920,5 @@
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiRemoveGpeBlock)
+
Index: dswstate.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dswstate.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dswstate.c -L sys/contrib/dev/acpica/dswstate.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dswstate.c
+++ sys/contrib/dev/acpica/dswstate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswstate - Dispatcher parse tree walk management routines
- * $Revision: 81 $
+ * $Revision: 1.101 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,324 +125,172 @@
#define _COMPONENT ACPI_DISPATCHER
ACPI_MODULE_NAME ("dswstate")
+/* Local prototypes */
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultInsert
- *
- * PARAMETERS: Object - Object to push
- * Index - Where to insert the object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Insert an object onto this walk's result stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultInsert (
- void *Object,
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_NAME ("DsResultInsert");
-
-
- State = WalkState->Results;
- if (!State)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
- WalkState));
- return (AE_NOT_EXIST);
- }
-
- if (Index >= ACPI_OBJ_NUM_OPERANDS)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index out of range: %X Obj=%p State=%p Num=%X\n",
- Index, Object, WalkState, State->Results.NumResults));
- return (AE_BAD_PARAMETER);
- }
-
- if (!Object)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null Object! Index=%X Obj=%p State=%p Num=%X\n",
- Index, Object, WalkState, State->Results.NumResults));
- return (AE_BAD_PARAMETER);
- }
-
- State->Results.ObjDesc [Index] = Object;
- State->Results.NumResults++;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
- Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
- WalkState, State->Results.NumResults, WalkState->CurrentResult));
+static ACPI_STATUS
+AcpiDsResultStackPush (
+ ACPI_WALK_STATE *WalkState);
- return (AE_OK);
-}
+static ACPI_STATUS
+AcpiDsResultStackPop (
+ ACPI_WALK_STATE *WalkState);
/*******************************************************************************
*
- * FUNCTION: AcpiDsResultRemove
+ * FUNCTION: AcpiDsResultPop
*
* PARAMETERS: Object - Where to return the popped object
- * Index - Where to extract the object
* WalkState - Current Walk state
*
* RETURN: Status
*
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
+ * DESCRIPTION: Pop an object off the top of this walk's result stack
*
******************************************************************************/
ACPI_STATUS
-AcpiDsResultRemove (
+AcpiDsResultPop (
ACPI_OPERAND_OBJECT **Object,
- UINT32 Index,
ACPI_WALK_STATE *WalkState)
{
+ ACPI_NATIVE_UINT Index;
ACPI_GENERIC_STATE *State;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("DsResultRemove");
+ ACPI_FUNCTION_NAME (DsResultPop);
State = WalkState->Results;
- if (!State)
+
+ /* Incorrect state of result stack */
+
+ if (State && !WalkState->ResultCount)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result object pushed! State=%p\n",
- WalkState));
- return (AE_NOT_EXIST);
+ ACPI_ERROR ((AE_INFO, "No results on result stack"));
+ return (AE_AML_INTERNAL);
}
- if (Index >= ACPI_OBJ_MAX_OPERAND)
+ if (!State && WalkState->ResultCount)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Index out of range: %X State=%p Num=%X\n",
- Index, WalkState, State->Results.NumResults));
+ ACPI_ERROR ((AE_INFO, "No result state for result stack"));
+ return (AE_AML_INTERNAL);
}
- /* Check for a valid result object */
+ /* Empty result stack */
- if (!State->Results.ObjDesc [Index])
+ if (!State)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null operand! State=%p #Ops=%X, Index=%X\n",
- WalkState, State->Results.NumResults, Index));
+ ACPI_ERROR ((AE_INFO, "Result stack is empty! State=%p", WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
- /* Remove the object */
+ /* Return object of the top element and clean that top element result stack */
- State->Results.NumResults--;
+ WalkState->ResultCount--;
+ Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
*Object = State->Results.ObjDesc [Index];
- State->Results.ObjDesc [Index] = NULL;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Obj=%p [%s] Index=%X State=%p Num=%X\n",
- *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
- Index, WalkState, State->Results.NumResults));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultPop
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultPop (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_NATIVE_UINT Index;
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_NAME ("DsResultPop");
-
-
- State = WalkState->Results;
- if (!State)
- {
- return (AE_OK);
- }
-
- if (!State->Results.NumResults)
+ if (!*Object)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Result stack is empty! State=%p\n",
+ ACPI_ERROR ((AE_INFO, "No result objects on result stack, State=%p",
WalkState));
return (AE_AML_NO_RETURN_VALUE);
}
- /* Remove top element */
-
- State->Results.NumResults--;
-
- for (Index = ACPI_OBJ_NUM_OPERANDS; Index; Index--)
+ State->Results.ObjDesc [Index] = NULL;
+ if (Index == 0)
{
- /* Check for a valid result object */
-
- if (State->Results.ObjDesc [Index -1])
+ Status = AcpiDsResultStackPop (WalkState);
+ if (ACPI_FAILURE (Status))
{
- *Object = State->Results.ObjDesc [Index -1];
- State->Results.ObjDesc [Index -1] = NULL;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] Index=%X State=%p Num=%X\n",
- *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
- (UINT32) Index -1, WalkState, State->Results.NumResults));
-
- return (AE_OK);
+ return (Status);
}
}
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
- return (AE_AML_NO_RETURN_VALUE);
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Obj=%p [%s] Index=%X State=%p Num=%X\n", *Object,
+ AcpiUtGetObjectTypeName (*Object),
+ (UINT32) Index, WalkState, WalkState->ResultCount));
+
+ return (AE_OK);
}
/*******************************************************************************
*
- * FUNCTION: AcpiDsResultPopFromBottom
+ * FUNCTION: AcpiDsResultPush
*
* PARAMETERS: Object - Where to return the popped object
* WalkState - Current Walk state
*
* RETURN: Status
*
- * DESCRIPTION: Pop an object off the bottom of this walk's result stack. In
- * other words, this is a FIFO.
+ * DESCRIPTION: Push an object onto the current result stack
*
******************************************************************************/
ACPI_STATUS
-AcpiDsResultPopFromBottom (
- ACPI_OPERAND_OBJECT **Object,
+AcpiDsResultPush (
+ ACPI_OPERAND_OBJECT *Object,
ACPI_WALK_STATE *WalkState)
{
- ACPI_NATIVE_UINT Index;
ACPI_GENERIC_STATE *State;
+ ACPI_STATUS Status;
+ ACPI_NATIVE_UINT Index;
- ACPI_FUNCTION_NAME ("DsResultPopFromBottom");
+ ACPI_FUNCTION_NAME (DsResultPush);
- State = WalkState->Results;
- if (!State)
+ if (WalkState->ResultCount > WalkState->ResultSize)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Warning: No result object pushed! State=%p\n", WalkState));
- return (AE_NOT_EXIST);
+ ACPI_ERROR ((AE_INFO, "Result stack is full"));
+ return (AE_AML_INTERNAL);
}
-
- if (!State->Results.NumResults)
+ else if (WalkState->ResultCount == WalkState->ResultSize)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "No result objects! State=%p\n", WalkState));
- return (AE_AML_NO_RETURN_VALUE);
- }
+ /* Extend the result stack */
- /* Remove Bottom element */
-
- *Object = State->Results.ObjDesc [0];
-
- /* Push entire stack down one element */
-
- for (Index = 0; Index < State->Results.NumResults; Index++)
- {
- State->Results.ObjDesc [Index] = State->Results.ObjDesc [Index + 1];
+ Status = AcpiDsResultStackPush (WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR ((AE_INFO, "Failed to extend the result stack"));
+ return (Status);
+ }
}
- State->Results.NumResults--;
-
- /* Check for a valid result object */
-
- if (!*Object)
+ if (!(WalkState->ResultCount < WalkState->ResultSize))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null operand! State=%p #Ops=%X, Index=%X\n",
- WalkState, State->Results.NumResults, (UINT32) Index));
- return (AE_AML_NO_RETURN_VALUE);
+ ACPI_ERROR ((AE_INFO, "No free elements in result stack"));
+ return (AE_AML_INTERNAL);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s], Results=%p State=%p\n",
- *Object, (*Object) ? AcpiUtGetObjectTypeName (*Object) : "NULL",
- State, WalkState));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsResultPush
- *
- * PARAMETERS: Object - Where to return the popped object
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Push an object onto the current result stack
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsResultPush (
- ACPI_OPERAND_OBJECT *Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_GENERIC_STATE *State;
-
-
- ACPI_FUNCTION_NAME ("DsResultPush");
-
-
State = WalkState->Results;
if (!State)
{
- ACPI_REPORT_ERROR (("No result stack frame during push\n"));
+ ACPI_ERROR ((AE_INFO, "No result stack frame during push"));
return (AE_AML_INTERNAL);
}
- if (State->Results.NumResults == ACPI_OBJ_NUM_OPERANDS)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Result stack overflow: Obj=%p State=%p Num=%X\n",
- Object, WalkState, State->Results.NumResults));
- return (AE_STACK_OVERFLOW);
- }
-
if (!Object)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Null Object! Obj=%p State=%p Num=%X\n",
- Object, WalkState, State->Results.NumResults));
+ ACPI_ERROR ((AE_INFO,
+ "Null Object! Obj=%p State=%p Num=%X",
+ Object, WalkState, WalkState->ResultCount));
return (AE_BAD_PARAMETER);
}
- State->Results.ObjDesc [State->Results.NumResults] = Object;
- State->Results.NumResults++;
+ /* Assign the address of object to the top free element of result stack */
+
+ Index = WalkState->ResultCount % ACPI_RESULTS_FRAME_OBJ_NUM;
+ State->Results.ObjDesc [Index] = Object;
+ WalkState->ResultCount++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p Num=%X Cur=%X\n",
- Object, Object ? AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object) : "NULL",
- WalkState, State->Results.NumResults, WalkState->CurrentResult));
+ Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
+ WalkState, WalkState->ResultCount, WalkState->CurrentResult));
return (AE_OK);
}
@@ -456,18 +304,29 @@
*
* RETURN: Status
*
- * DESCRIPTION: Push an object onto the WalkState result stack.
+ * DESCRIPTION: Push an object onto the WalkState result stack
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsResultStackPush (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_NAME ("DsResultStackPush");
+ ACPI_FUNCTION_NAME (DsResultStackPush);
+
+
+ /* Check for stack overflow */
+
+ if ((WalkState->ResultSize + ACPI_RESULTS_FRAME_OBJ_NUM) >
+ ACPI_RESULTS_OBJ_NUM_MAX)
+ {
+ ACPI_ERROR ((AE_INFO, "Result stack overflow: State=%p Num=%X",
+ WalkState, WalkState->ResultSize));
+ return (AE_STACK_OVERFLOW);
+ }
State = AcpiUtCreateGenericState ();
if (!State)
@@ -475,9 +334,13 @@
return (AE_NO_MEMORY);
}
- State->Common.DataType = ACPI_DESC_TYPE_STATE_RESULT;
+ State->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RESULT;
AcpiUtPushGenericState (&WalkState->Results, State);
+ /* Increase the length of the result stack by the length of frame */
+
+ WalkState->ResultSize += ACPI_RESULTS_FRAME_OBJ_NUM;
+
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Results=%p State=%p\n",
State, WalkState));
@@ -493,75 +356,47 @@
*
* RETURN: Status
*
- * DESCRIPTION: Pop an object off of the WalkState result stack.
+ * DESCRIPTION: Pop an object off of the WalkState result stack
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDsResultStackPop (
ACPI_WALK_STATE *WalkState)
{
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_NAME ("DsResultStackPop");
+
+ ACPI_FUNCTION_NAME (DsResultStackPop);
/* Check for stack underflow */
if (WalkState->Results == NULL)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Underflow - State=%p\n",
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Result stack underflow - State=%p\n",
WalkState));
return (AE_AML_NO_OPERAND);
}
- State = AcpiUtPopGenericState (&WalkState->Results);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
- "Result=%p RemainingResults=%X State=%p\n",
- State, State->Results.NumResults, WalkState));
+ if (WalkState->ResultSize < ACPI_RESULTS_FRAME_OBJ_NUM)
+ {
+ ACPI_ERROR ((AE_INFO, "Insufficient result stack size"));
+ return (AE_AML_INTERNAL);
+ }
+ State = AcpiUtPopGenericState (&WalkState->Results);
AcpiUtDeleteGenericState (State);
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackDeleteAll
- *
- * PARAMETERS: WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Clear the object stack by deleting all objects that are on it.
- * Should be used with great care, if at all!
- *
- ******************************************************************************/
+ /* Decrease the length of result stack by the length of frame */
-ACPI_STATUS
-AcpiDsObjStackDeleteAll (
- ACPI_WALK_STATE *WalkState)
-{
- UINT32 i;
+ WalkState->ResultSize -= ACPI_RESULTS_FRAME_OBJ_NUM;
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "Result=%p RemainingResults=%X State=%p\n",
+ State, WalkState->ResultCount, WalkState));
- ACPI_FUNCTION_TRACE_PTR ("DsObjStackDeleteAll", WalkState);
-
-
- /* The stack size is configurable, but fixed */
-
- for (i = 0; i < ACPI_OBJ_NUM_OPERANDS; i++)
- {
- if (WalkState->Operands[i])
- {
- AcpiUtRemoveReference (WalkState->Operands[i]);
- WalkState->Operands[i] = NULL;
- }
- }
-
- return_ACPI_STATUS (AE_OK);
+ return (AE_OK);
}
@@ -583,93 +418,34 @@
void *Object,
ACPI_WALK_STATE *WalkState)
{
- ACPI_FUNCTION_NAME ("DsObjStackPush");
+ ACPI_FUNCTION_NAME (DsObjStackPush);
/* Check for stack overflow */
if (WalkState->NumOperands >= ACPI_OBJ_NUM_OPERANDS)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "overflow! Obj=%p State=%p #Ops=%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Object stack overflow! Obj=%p State=%p #Ops=%X",
Object, WalkState, WalkState->NumOperands));
return (AE_STACK_OVERFLOW);
}
/* Put the object onto the stack */
- WalkState->Operands [WalkState->NumOperands] = Object;
+ WalkState->Operands [WalkState->OperandIndex] = Object;
WalkState->NumOperands++;
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
- Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
- WalkState, WalkState->NumOperands));
-
- return (AE_OK);
-}
-
-
-#if 0
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackPopObject
- *
- * PARAMETERS: PopCount - Number of objects/entries to pop
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Pop this walk's object stack. Objects on the stack are NOT
- * deleted by this routine.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiDsObjStackPopObject (
- ACPI_OPERAND_OBJECT **Object,
- ACPI_WALK_STATE *WalkState)
-{
- ACPI_FUNCTION_NAME ("DsObjStackPopObject");
-
-
- /* Check for stack underflow */
-
- if (WalkState->NumOperands == 0)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Missing operand/stack empty! State=%p #Ops=%X\n",
- WalkState, WalkState->NumOperands));
- *Object = NULL;
- return (AE_AML_NO_OPERAND);
- }
-
- /* Pop the stack */
-
- WalkState->NumOperands--;
-
- /* Check for a valid operand */
-
- if (!WalkState->Operands [WalkState->NumOperands])
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Null operand! State=%p #Ops=%X\n",
- WalkState, WalkState->NumOperands));
- *Object = NULL;
- return (AE_AML_NO_OPERAND);
- }
-
- /* Get operand and set stack entry to null */
+ /* For the usual order of filling the operand stack */
- *Object = WalkState->Operands [WalkState->NumOperands];
- WalkState->Operands [WalkState->NumOperands] = NULL;
+ WalkState->OperandIndex++;
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Obj=%p [%s] State=%p #Ops=%X\n",
- *Object, AcpiUtGetObjectTypeName (*Object),
- WalkState, WalkState->NumOperands));
+ Object, AcpiUtGetObjectTypeName ((ACPI_OPERAND_OBJECT *) Object),
+ WalkState, WalkState->NumOperands));
return (AE_OK);
}
-#endif
/*******************************************************************************
@@ -693,7 +469,8 @@
{
UINT32 i;
- ACPI_FUNCTION_NAME ("DsObjStackPop");
+
+ ACPI_FUNCTION_NAME (DsObjStackPop);
for (i = 0; i < PopCount; i++)
@@ -702,8 +479,8 @@
if (WalkState->NumOperands == 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Underflow! Count=%X State=%p #Ops=%X\n",
+ ACPI_ERROR ((AE_INFO,
+ "Object stack underflow! Count=%X State=%p #Ops=%X",
PopCount, WalkState, WalkState->NumOperands));
return (AE_STACK_UNDERFLOW);
}
@@ -715,7 +492,7 @@
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
+ PopCount, WalkState, WalkState->NumOperands));
return (AE_OK);
}
@@ -735,7 +512,7 @@
*
******************************************************************************/
-ACPI_STATUS
+void
AcpiDsObjStackPopAndDelete (
UINT32 PopCount,
ACPI_WALK_STATE *WalkState)
@@ -744,79 +521,34 @@
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_NAME ("DsObjStackPopAndDelete");
+ ACPI_FUNCTION_NAME (DsObjStackPopAndDelete);
- for (i = 0; i < PopCount; i++)
+ if (PopCount == 0)
{
- /* Check for stack underflow */
+ return;
+ }
+ for (i = (PopCount - 1); i >= 0; i--)
+ {
if (WalkState->NumOperands == 0)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Underflow! Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
- return (AE_STACK_UNDERFLOW);
+ return;
}
/* Pop the stack and delete an object if present in this stack entry */
WalkState->NumOperands--;
- ObjDesc = WalkState->Operands [WalkState->NumOperands];
+ ObjDesc = WalkState->Operands [i];
if (ObjDesc)
{
- AcpiUtRemoveReference (WalkState->Operands [WalkState->NumOperands]);
- WalkState->Operands [WalkState->NumOperands] = NULL;
+ AcpiUtRemoveReference (WalkState->Operands [i]);
+ WalkState->Operands [i] = NULL;
}
}
ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Count=%X State=%p #Ops=%X\n",
- PopCount, WalkState, WalkState->NumOperands));
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiDsObjStackGetValue
- *
- * PARAMETERS: Index - Stack index whose value is desired. Based
- * on the top of the stack (index=0 == top)
- * WalkState - Current Walk state
- *
- * RETURN: Status
- *
- * DESCRIPTION: Retrieve an object from this walk's object stack. Index must
- * be within the range of the current stack pointer.
- *
- ******************************************************************************/
-
-void *
-AcpiDsObjStackGetValue (
- UINT32 Index,
- ACPI_WALK_STATE *WalkState)
-{
-
- ACPI_FUNCTION_TRACE_PTR ("DsObjStackGetValue", WalkState);
-
-
- /* Can't do it if the stack is empty */
-
- if (WalkState->NumOperands == 0)
- {
- return_PTR (NULL);
- }
-
- /* or if the index is past the top of the stack */
-
- if (Index > (WalkState->NumOperands - (UINT32) 1))
- {
- return_PTR (NULL);
- }
-
- return_PTR (WalkState->Operands[(ACPI_NATIVE_UINT)(WalkState->NumOperands - 1) -
- Index]);
+ PopCount, WalkState, WalkState->NumOperands));
}
@@ -836,9 +568,8 @@
ACPI_WALK_STATE *
AcpiDsGetCurrentWalkState (
ACPI_THREAD_STATE *Thread)
-
{
- ACPI_FUNCTION_NAME ("DsGetCurrentWalkState");
+ ACPI_FUNCTION_NAME (DsGetCurrentWalkState);
if (!Thread)
@@ -858,11 +589,11 @@
* FUNCTION: AcpiDsPushWalkState
*
* PARAMETERS: WalkState - State to push
- * WalkList - The list that owns the walk stack
+ * Thread - Thread state object
*
* RETURN: None
*
- * DESCRIPTION: Place the WalkState at the head of the state list.
+ * DESCRIPTION: Place the Thread state at the head of the state list
*
******************************************************************************/
@@ -871,10 +602,10 @@
ACPI_WALK_STATE *WalkState,
ACPI_THREAD_STATE *Thread)
{
- ACPI_FUNCTION_TRACE ("DsPushWalkState");
+ ACPI_FUNCTION_TRACE (DsPushWalkState);
- WalkState->Next = Thread->WalkStateList;
+ WalkState->Next = Thread->WalkStateList;
Thread->WalkStateList = WalkState;
return_VOID;
@@ -885,9 +616,9 @@
*
* FUNCTION: AcpiDsPopWalkState
*
- * PARAMETERS: WalkList - The list that owns the walk stack
+ * PARAMETERS: Thread - Current thread state
*
- * RETURN: A WalkState object popped from the stack
+ * RETURN: A WalkState object popped from the thread's stack
*
* DESCRIPTION: Remove and return the walkstate object that is at the head of
* the walk stack for the given walk list. NULL indicates that
@@ -902,7 +633,7 @@
ACPI_WALK_STATE *WalkState;
- ACPI_FUNCTION_TRACE ("DsPopWalkState");
+ ACPI_FUNCTION_TRACE (DsPopWalkState);
WalkState = Thread->WalkStateList;
@@ -916,7 +647,7 @@
/*
* Don't clear the NEXT field, this serves as an indicator
* that there is a parent WALK STATE
- * NO: WalkState->Next = NULL;
+ * Do Not: WalkState->Next = NULL;
*/
}
@@ -928,7 +659,9 @@
*
* FUNCTION: AcpiDsCreateWalkState
*
- * PARAMETERS: Origin - Starting point for this walk
+ * PARAMETERS: OwnerId - ID for object creation
+ * Origin - Starting point for this walk
+ * MethodDesc - Method object
* Thread - Current thread state
*
* RETURN: Pointer to the new walk state.
@@ -942,27 +675,26 @@
AcpiDsCreateWalkState (
ACPI_OWNER_ID OwnerId,
ACPI_PARSE_OBJECT *Origin,
- ACPI_OPERAND_OBJECT *MthDesc,
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_THREAD_STATE *Thread)
{
ACPI_WALK_STATE *WalkState;
- ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("DsCreateWalkState");
+ ACPI_FUNCTION_TRACE (DsCreateWalkState);
- WalkState = AcpiUtAcquireFromCache (ACPI_MEM_LIST_WALK);
+ WalkState = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_WALK_STATE));
if (!WalkState)
{
return_PTR (NULL);
}
- WalkState->DataType = ACPI_DESC_TYPE_WALK;
- WalkState->OwnerId = OwnerId;
- WalkState->Origin = Origin;
- WalkState->MethodDesc = MthDesc;
- WalkState->Thread = Thread;
+ WalkState->DescriptorType = ACPI_DESC_TYPE_WALK;
+ WalkState->MethodDesc = MethodDesc;
+ WalkState->OwnerId = OwnerId;
+ WalkState->Origin = Origin;
+ WalkState->Thread = Thread;
WalkState->ParserState.StartOp = Origin;
@@ -972,15 +704,6 @@
AcpiDsMethodDataInit (WalkState);
#endif
- /* Create an initial result stack entry */
-
- Status = AcpiDsResultStackPush (WalkState);
- if (ACPI_FAILURE (Status))
- {
- AcpiUtReleaseToCache (ACPI_MEM_LIST_WALK, WalkState);
- return_PTR (NULL);
- }
-
/* Put the new state at the head of the walk list */
if (Thread)
@@ -1001,8 +724,7 @@
* MethodNode - Control method NS node, if any
* AmlStart - Start of AML
* AmlLength - Length of AML
- * Params - Method args, if any
- * ReturnObjDesc - Where to store a return object, if any
+ * Info - Method info block (params, etc.)
* PassNumber - 1, 2, or 3
*
* RETURN: Status
@@ -1018,37 +740,38 @@
ACPI_NAMESPACE_NODE *MethodNode,
UINT8 *AmlStart,
UINT32 AmlLength,
- ACPI_PARAMETER_INFO *Info,
- UINT32 PassNumber)
+ ACPI_EVALUATE_INFO *Info,
+ UINT8 PassNumber)
{
ACPI_STATUS Status;
ACPI_PARSE_STATE *ParserState = &WalkState->ParserState;
ACPI_PARSE_OBJECT *ExtraOp;
- ACPI_FUNCTION_TRACE ("DsInitAmlWalk");
+ ACPI_FUNCTION_TRACE (DsInitAmlWalk);
- WalkState->ParserState.Aml =
+ WalkState->ParserState.Aml =
WalkState->ParserState.AmlStart = AmlStart;
- WalkState->ParserState.AmlEnd =
- WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
+ WalkState->ParserState.AmlEnd =
+ WalkState->ParserState.PkgEnd = AmlStart + AmlLength;
/* The NextOp of the NextWalk will be the beginning of the method */
- WalkState->NextOp = NULL;
+ WalkState->NextOp = NULL;
+ WalkState->PassNumber = PassNumber;
if (Info)
{
if (Info->ParameterType == ACPI_PARAM_GPE)
{
- WalkState->GpeEventInfo = ACPI_CAST_PTR (ACPI_GPE_EVENT_INFO,
- Info->Parameters);
+ WalkState->GpeEventInfo =
+ ACPI_CAST_PTR (ACPI_GPE_EVENT_INFO, Info->Parameters);
}
else
{
- WalkState->Params = Info->Parameters;
- WalkState->CallerReturnDesc = &Info->ReturnObject;
+ WalkState->Params = Info->Parameters;
+ WalkState->CallerReturnDesc = &Info->ReturnObject;
}
}
@@ -1061,9 +784,9 @@
if (MethodNode)
{
WalkState->ParserState.StartNode = MethodNode;
- WalkState->WalkType = ACPI_WALK_METHOD;
- WalkState->MethodNode = MethodNode;
- WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
+ WalkState->WalkType = ACPI_WALK_METHOD;
+ WalkState->MethodNode = MethodNode;
+ WalkState->MethodDesc = AcpiNsGetAttachedObject (MethodNode);
/* Push start scope on scope stack and make it current */
@@ -1075,7 +798,8 @@
/* Init the method arguments */
- Status = AcpiDsMethodDataInitArgs (WalkState->Params, ACPI_METHOD_NUM_ARGS, WalkState);
+ Status = AcpiDsMethodDataInitArgs (WalkState->Params,
+ ACPI_METHOD_NUM_ARGS, WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -1141,7 +865,7 @@
ACPI_GENERIC_STATE *State;
- ACPI_FUNCTION_TRACE_PTR ("DsDeleteWalkState", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (DsDeleteWalkState, WalkState);
if (!WalkState)
@@ -1149,15 +873,20 @@
return;
}
- if (WalkState->DataType != ACPI_DESC_TYPE_WALK)
+ if (WalkState->DescriptorType != ACPI_DESC_TYPE_WALK)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p is not a valid walk state\n", WalkState));
+ ACPI_ERROR ((AE_INFO, "%p is not a valid walk state",
+ WalkState));
return;
}
+ /* There should not be any open scopes */
+
if (WalkState->ParserState.Scope)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "%p walk still has a scope list\n", WalkState));
+ ACPI_ERROR ((AE_INFO, "%p walk still has a scope list",
+ WalkState));
+ AcpiPsCleanupScope (&WalkState->ParserState);
}
/* Always must free any linked control states */
@@ -1190,32 +919,7 @@
AcpiUtDeleteGenericState (State);
}
- AcpiUtReleaseToCache (ACPI_MEM_LIST_WALK, WalkState);
- return_VOID;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AcpiDsDeleteWalkStateCache
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Purge the global state object cache. Used during subsystem
- * termination.
- *
- ******************************************************************************/
-
-void
-AcpiDsDeleteWalkStateCache (
- void)
-{
- ACPI_FUNCTION_TRACE ("DsDeleteWalkStateCache");
-
-
- AcpiUtDeleteGenericCache (ACPI_MEM_LIST_WALK);
+ ACPI_FREE (WalkState);
return_VOID;
}
Index: acgcc.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acgcc.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acgcc.h -L sys/contrib/dev/acpica/acgcc.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acgcc.h
+++ sys/contrib/dev/acpica/acgcc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acgcc.h - GCC specific defines, etc.
- * $Revision: 26 $
+ * $Revision: 1.32 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,16 +117,23 @@
#ifndef __ACGCC_H__
#define __ACGCC_H__
-/* This macro is used to tag functions as "printf-like" because
+/* Function name is used for debug output. Non-ANSI, compiler-dependent */
+
+#define ACPI_GET_FUNCTION_NAME __FUNCTION__
+
+/*
+ * This macro is used to tag functions as "printf-like" because
* some compilers (like GCC) can catch printf format string problems.
*/
-#define ACPI_PRINTF_LIKE_FUNC __attribute__ ((__format__ (__printf__, 4, 5)))
+#define ACPI_PRINTF_LIKE(c) __attribute__ ((__format__ (__printf__, c, c+1)))
-/* Some compilers complain about unused variables. Sometimes we don't want to
- * use all the variables (most specifically for _THIS_MODULE). This allow us
+/*
+ * Some compilers complain about unused variables. Sometimes we don't want to
+ * use all the variables (for example, _AcpiModuleName). This allows us
* to to tell the compiler warning in a per-variable manner that a variable
* is unused.
*/
#define ACPI_UNUSED_VAR __attribute__ ((unused))
+
#endif /* __ACGCC_H__ */
Index: utglobal.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utglobal.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utglobal.c -L sys/contrib/dev/acpica/utglobal.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utglobal.c
+++ sys/contrib/dev/acpica/utglobal.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: utglobal - Global variables for the ACPI subsystem
- * $Revision: 202 $
+ * $Revision: 1.249 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,97 +120,13 @@
#include <contrib/dev/acpica/acpi.h>
#include <contrib/dev/acpica/acnamesp.h>
+ACPI_EXPORT_SYMBOL (AcpiGbl_FADT)
+
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utglobal")
-/******************************************************************************
- *
- * FUNCTION: AcpiFormatException
- *
- * PARAMETERS: Status - The ACPI_STATUS code to be formatted
- *
- * RETURN: A string containing the exception text
- *
- * DESCRIPTION: This function translates an ACPI exception into an ASCII string.
- *
- ******************************************************************************/
-
-const char *
-AcpiFormatException (
- ACPI_STATUS Status)
-{
- const char *Exception = "UNKNOWN_STATUS_CODE";
- ACPI_STATUS SubStatus;
-
-
- ACPI_FUNCTION_NAME ("FormatException");
-
-
- SubStatus = (Status & ~AE_CODE_MASK);
-
- switch (Status & AE_CODE_MASK)
- {
- case AE_CODE_ENVIRONMENTAL:
-
- if (SubStatus <= AE_CODE_ENV_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Env [SubStatus];
- break;
- }
- goto Unknown;
-
- case AE_CODE_PROGRAMMER:
-
- if (SubStatus <= AE_CODE_PGM_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Pgm [SubStatus -1];
- break;
- }
- goto Unknown;
-
- case AE_CODE_ACPI_TABLES:
-
- if (SubStatus <= AE_CODE_TBL_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Tbl [SubStatus -1];
- break;
- }
- goto Unknown;
-
- case AE_CODE_AML:
-
- if (SubStatus <= AE_CODE_AML_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Aml [SubStatus -1];
- break;
- }
- goto Unknown;
-
- case AE_CODE_CONTROL:
-
- if (SubStatus <= AE_CODE_CTRL_MAX)
- {
- Exception = AcpiGbl_ExceptionNames_Ctrl [SubStatus -1];
- break;
- }
- goto Unknown;
-
- default:
- 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);
-}
-
-
-/******************************************************************************
+/*******************************************************************************
*
* Static global variable initialization.
*
@@ -234,7 +150,6 @@
UINT32 AcpiDbgLayer = ACPI_COMPONENT_DEFAULT;
UINT32 AcpiGbl_NestingLevel = 0;
-
/* Debugger globals */
BOOLEAN AcpiGbl_DbTerminateThreads = FALSE;
@@ -249,8 +164,6 @@
BOOLEAN AcpiGbl_Shutdown = TRUE;
-const UINT8 AcpiGbl_DecodeTo8bit [8] = {1,2,4,8,16,32,64,128};
-
const char *AcpiGbl_SleepStateNames[ACPI_S_STATE_COUNT] =
{
"\\_S0_",
@@ -269,37 +182,62 @@
"_S4D"
};
-/*
- * Strings supported by the _OSI predefined (internal) method.
- * When adding strings, be sure to update ACPI_NUM_OSI_STRINGS.
- */
-const char *AcpiGbl_ValidOsiStrings[ACPI_NUM_OSI_STRINGS] =
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiFormatException
+ *
+ * PARAMETERS: Status - The ACPI_STATUS code to be formatted
+ *
+ * RETURN: A string containing the exception text. A valid pointer is
+ * always returned.
+ *
+ * DESCRIPTION: This function translates an ACPI exception into an ASCII string
+ * It is here instead of utxface.c so it is always present.
+ *
+ ******************************************************************************/
+
+const char *
+AcpiFormatException (
+ ACPI_STATUS Status)
{
- "Linux",
- "Windows 2000",
- "Windows 2001",
- "Windows 2001.1",
- "Windows 2001 SP0",
- "Windows 2001 SP1",
- "Windows 2001 SP2",
- "Windows 2001 SP3",
- "Windows 2001 SP4"
-};
+ const char *Exception = NULL;
-/******************************************************************************
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Exception = AcpiUtValidateException (Status);
+ if (!Exception)
+ {
+ /* Exception code was not recognized */
+
+ ACPI_ERROR ((AE_INFO,
+ "Unknown exception code: 0x%8.8X", Status));
+
+ Exception = "UNKNOWN_STATUS_CODE";
+ }
+
+ return (ACPI_CAST_PTR (const char, Exception));
+}
+
+ACPI_EXPORT_SYMBOL (AcpiFormatException)
+
+
+/*******************************************************************************
*
* Namespace globals
*
******************************************************************************/
-
/*
* Predefined ACPI Names (Built-in to the Interpreter)
*
* NOTES:
* 1) _SB_ is defined to be a device to allow \_SB_._INI to be run
* during the initialization sequence.
+ * 2) _TZ_ is defined to be a thermal zone in order to allow ASL code to
+ * perform a Notify() operation on it.
*/
const ACPI_PREDEFINED_NAMES AcpiGbl_PreDefinedNames[] =
{
@@ -308,16 +246,18 @@
{"_SB_", ACPI_TYPE_DEVICE, NULL},
{"_SI_", ACPI_TYPE_LOCAL_SCOPE, NULL},
{"_TZ_", ACPI_TYPE_THERMAL, NULL},
- {"_REV", ACPI_TYPE_INTEGER, "2"},
+ {"_REV", ACPI_TYPE_INTEGER, (char *) ACPI_CA_SUPPORT_LEVEL},
{"_OS_", ACPI_TYPE_STRING, ACPI_OS_NAME},
- {"_GL_", ACPI_TYPE_MUTEX, "0"},
+ {"_GL_", ACPI_TYPE_MUTEX, (char *) 1},
#if !defined (ACPI_NO_METHOD_EXECUTION) || defined (ACPI_CONSTANT_EVAL_ONLY)
- {"_OSI", ACPI_TYPE_METHOD, "1"},
+ {"_OSI", ACPI_TYPE_METHOD, (char *) 1},
#endif
- {NULL, ACPI_TYPE_ANY, NULL} /* Table terminator */
-};
+ /* Table terminator */
+
+ {NULL, ACPI_TYPE_ANY, NULL}
+};
/*
* Properties of the ACPI Object Types, both internal and external.
@@ -362,22 +302,25 @@
/* Hex to ASCII conversion table */
static const char AcpiGbl_HexToAscii[] =
- {'0','1','2','3','4','5','6','7',
- '8','9','A','B','C','D','E','F'};
+{
+ '0','1','2','3','4','5','6','7',
+ '8','9','A','B','C','D','E','F'
+};
+
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtHexToAsciiChar
*
* PARAMETERS: Integer - Contains the hex digit
* Position - bit position of the digit within the
- * integer
+ * integer (multiple of 4)
*
- * RETURN: Ascii character
+ * RETURN: The converted Ascii character
*
- * DESCRIPTION: Convert a hex digit to an ascii character
+ * DESCRIPTION: Convert a hex digit to an Ascii character
*
- ****************************************************************************/
+ ******************************************************************************/
char
AcpiUtHexToAsciiChar (
@@ -391,35 +334,6 @@
/******************************************************************************
*
- * Table name globals
- *
- * NOTE: This table includes ONLY the ACPI tables that the subsystem consumes.
- * it is NOT an exhaustive list of all possible ACPI tables. All ACPI tables
- * that are not used by the subsystem are simply ignored.
- *
- * Do NOT add any table to this list that is not consumed directly by this
- * subsystem.
- *
- ******************************************************************************/
-
-ACPI_TABLE_LIST AcpiGbl_TableLists[NUM_ACPI_TABLE_TYPES];
-
-ACPI_TABLE_SUPPORT AcpiGbl_TableData[NUM_ACPI_TABLE_TYPES] =
-{
- /*********** Name, Signature, Global typed pointer Signature size, Type How many allowed?, Contains valid AML? */
-
- /* RSDP 0 */ {RSDP_NAME, RSDP_SIG, NULL, sizeof (RSDP_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
- /* DSDT 1 */ {DSDT_SIG, DSDT_SIG, (void *) &AcpiGbl_DSDT, sizeof (DSDT_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE | ACPI_TABLE_EXECUTABLE},
- /* FADT 2 */ {FADT_SIG, FADT_SIG, (void *) &AcpiGbl_FADT, sizeof (FADT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_SINGLE},
- /* FACS 3 */ {FACS_SIG, FACS_SIG, (void *) &AcpiGbl_FACS, sizeof (FACS_SIG)-1, ACPI_TABLE_SECONDARY| ACPI_TABLE_SINGLE},
- /* PSDT 4 */ {PSDT_SIG, PSDT_SIG, NULL, sizeof (PSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
- /* SSDT 5 */ {SSDT_SIG, SSDT_SIG, NULL, sizeof (SSDT_SIG)-1, ACPI_TABLE_PRIMARY | ACPI_TABLE_MULTIPLE | ACPI_TABLE_EXECUTABLE},
- /* XSDT 6 */ {XSDT_SIG, XSDT_SIG, NULL, sizeof (RSDT_SIG)-1, ACPI_TABLE_ROOT | ACPI_TABLE_SINGLE},
-};
-
-
-/******************************************************************************
- *
* Event and Hardware globals
*
******************************************************************************/
@@ -435,6 +349,7 @@
/* ACPI_BITREG_SLEEP_BUTTON_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_SLEEP_BUTTON_STATUS, ACPI_BITMASK_SLEEP_BUTTON_STATUS},
/* ACPI_BITREG_RT_CLOCK_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_STATUS},
/* ACPI_BITREG_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_WAKE_STATUS, ACPI_BITMASK_WAKE_STATUS},
+ /* ACPI_BITREG_PCIEXP_WAKE_STATUS */ {ACPI_REGISTER_PM1_STATUS, ACPI_BITPOSITION_PCIEXP_WAKE_STATUS, ACPI_BITMASK_PCIEXP_WAKE_STATUS},
/* ACPI_BITREG_TIMER_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_TIMER_ENABLE, ACPI_BITMASK_TIMER_ENABLE},
/* ACPI_BITREG_GLOBAL_LOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_GLOBAL_LOCK_ENABLE, ACPI_BITMASK_GLOBAL_LOCK_ENABLE},
@@ -442,6 +357,7 @@
/* ACPI_BITREG_SLEEP_BUTTON_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_SLEEP_BUTTON_ENABLE, ACPI_BITMASK_SLEEP_BUTTON_ENABLE},
/* ACPI_BITREG_RT_CLOCK_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_ENABLE},
/* ACPI_BITREG_WAKE_ENABLE */ {ACPI_REGISTER_PM1_ENABLE, 0, 0},
+ /* ACPI_BITREG_PCIEXP_WAKE_DISABLE */ {ACPI_REGISTER_PM1_ENABLE, ACPI_BITPOSITION_PCIEXP_WAKE_DISABLE, ACPI_BITMASK_PCIEXP_WAKE_DISABLE},
/* ACPI_BITREG_SCI_ENABLE */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_SCI_ENABLE, ACPI_BITMASK_SCI_ENABLE},
/* ACPI_BITREG_BUS_MASTER_RLD */ {ACPI_REGISTER_PM1_CONTROL, ACPI_BITPOSITION_BUS_MASTER_RLD, ACPI_BITMASK_BUS_MASTER_RLD},
@@ -463,7 +379,7 @@
/* ACPI_EVENT_RTC */ {ACPI_BITREG_RT_CLOCK_STATUS, ACPI_BITREG_RT_CLOCK_ENABLE, ACPI_BITMASK_RT_CLOCK_STATUS, ACPI_BITMASK_RT_CLOCK_ENABLE},
};
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtGetRegionName
*
@@ -473,13 +389,12 @@
*
* DESCRIPTION: Translate a Space ID into a name string (Debug only)
*
- ****************************************************************************/
+ ******************************************************************************/
/* Region type decoding */
const char *AcpiGbl_RegionTypes[ACPI_NUM_PREDEFINED_REGIONS] =
{
-/*! [Begin] no source code translation (keep these ASL Keywords as-is) */
"SystemMemory",
"SystemIO",
"PCI_Config",
@@ -488,7 +403,6 @@
"CMOS",
"PCIBARTarget",
"DataTable"
-/*! [End] no source code translation !*/
};
@@ -501,17 +415,16 @@
{
return ("UserDefinedRegion");
}
-
else if (SpaceId >= ACPI_NUM_PREDEFINED_REGIONS)
{
return ("InvalidSpaceId");
}
- return ((char *) (uintptr_t) AcpiGbl_RegionTypes[SpaceId]);
+ return (ACPI_CAST_PTR (char, AcpiGbl_RegionTypes[SpaceId]));
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtGetEventName
*
@@ -521,7 +434,7 @@
*
* DESCRIPTION: Translate a Event ID into a name string (Debug only)
*
- ****************************************************************************/
+ ******************************************************************************/
/* Event type decoding */
@@ -545,11 +458,11 @@
return ("InvalidEventID");
}
- return ((char *) (uintptr_t) AcpiGbl_EventTypes[EventId]);
+ return (ACPI_CAST_PTR (char, AcpiGbl_EventTypes[EventId]));
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtGetTypeName
*
@@ -559,20 +472,21 @@
*
* DESCRIPTION: Translate a Type ID into a name string (Debug only)
*
- ****************************************************************************/
+ ******************************************************************************/
/*
* Elements of AcpiGbl_NsTypeNames below must match
* one-to-one with values of ACPI_OBJECT_TYPE
*
- * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching; when
- * stored in a table it really means that we have thus far seen no evidence to
- * indicate what type is actually going to be stored for this entry.
+ * The type ACPI_TYPE_ANY (Untyped) is used as a "don't care" when searching;
+ * when stored in a table it really means that we have thus far seen no
+ * evidence to indicate what type is actually going to be stored for this entry.
*/
static const char AcpiGbl_BadType[] = "UNDEFINED";
-#define TYPE_NAME_LENGTH 12 /* Maximum length of each string */
-static const char *AcpiGbl_NsTypeNames[] = /* printable names of ACPI types */
+/* Printable names of the ACPI object types */
+
+static const char *AcpiGbl_NsTypeNames[] =
{
/* 00 */ "Untyped",
/* 01 */ "Integer",
@@ -615,10 +529,10 @@
if (Type > ACPI_TYPE_INVALID)
{
- return ((char *) (uintptr_t) AcpiGbl_BadType);
+ return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
- return ((char *) (uintptr_t) AcpiGbl_NsTypeNames[Type]);
+ return (ACPI_CAST_PTR (char, AcpiGbl_NsTypeNames[Type]));
}
@@ -636,7 +550,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtGetNodeName
*
@@ -646,7 +560,7 @@
*
* DESCRIPTION: Validate the node and return the node's ACPI name.
*
- ****************************************************************************/
+ ******************************************************************************/
char *
AcpiUtGetNodeName (
@@ -672,16 +586,16 @@
/* Descriptor must be a namespace node */
- if (Node->Descriptor != ACPI_DESC_TYPE_NAMED)
+ if (ACPI_GET_DESCRIPTOR_TYPE (Node) != ACPI_DESC_TYPE_NAMED)
{
return ("####");
}
/* Name must be a valid ACPI name */
- if (!AcpiUtValidAcpiName (* (UINT32 *) Node->Name.Ascii))
+ if (!AcpiUtValidAcpiName (Node->Name.Integer))
{
- return ("????");
+ Node->Name.Integer = AcpiUtRepairName (Node->Name.Ascii);
}
/* Return the name */
@@ -690,7 +604,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtGetDescriptorName
*
@@ -700,9 +614,11 @@
*
* DESCRIPTION: Validate object and return the descriptor type
*
- ****************************************************************************/
+ ******************************************************************************/
-static const char *AcpiGbl_DescTypeNames[] = /* printable names of descriptor types */
+/* Printable names of object descriptor types */
+
+static const char *AcpiGbl_DescTypeNames[] =
{
/* 00 */ "Invalid",
/* 01 */ "Cached",
@@ -735,10 +651,11 @@
if (ACPI_GET_DESCRIPTOR_TYPE (Object) > ACPI_DESC_TYPE_MAX)
{
- return ((char *) (uintptr_t) AcpiGbl_BadType);
+ return (ACPI_CAST_PTR (char, AcpiGbl_BadType));
}
- return ((char *) (uintptr_t) AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]);
+ return (ACPI_CAST_PTR (char,
+ AcpiGbl_DescTypeNames[ACPI_GET_DESCRIPTOR_TYPE (Object)]));
}
@@ -748,45 +665,45 @@
* Strings and procedures used for debug only
*/
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtGetMutexName
*
- * PARAMETERS: None.
+ * PARAMETERS: MutexId - The predefined ID for this mutex.
*
- * RETURN: Status
+ * RETURN: String containing the name of the mutex. Always returns a valid
+ * pointer.
*
* DESCRIPTION: Translate a mutex ID into a name string (Debug only)
*
- ****************************************************************************/
+ ******************************************************************************/
char *
AcpiUtGetMutexName (
UINT32 MutexId)
{
- if (MutexId > MAX_MUTEX)
+ if (MutexId > ACPI_MAX_MUTEX)
{
return ("Invalid Mutex ID");
}
return (AcpiGbl_MutexNames[MutexId]);
}
-
#endif
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtValidObjectType
*
* PARAMETERS: Type - Object type to be validated
*
- * RETURN: TRUE if valid object type
+ * RETURN: TRUE if valid object type, FALSE otherwise
*
* DESCRIPTION: Validate an object type
*
- ****************************************************************************/
+ ******************************************************************************/
BOOLEAN
AcpiUtValidObjectType (
@@ -804,141 +721,56 @@
}
-/****************************************************************************
- *
- * FUNCTION: AcpiUtAllocateOwnerId
- *
- * PARAMETERS: IdType - Type of ID (method or table)
- *
- * DESCRIPTION: Allocate a table or method owner id
- *
- ***************************************************************************/
-
-ACPI_OWNER_ID
-AcpiUtAllocateOwnerId (
- UINT32 IdType)
-{
- ACPI_OWNER_ID OwnerId = 0xFFFF;
-
-
- ACPI_FUNCTION_TRACE ("UtAllocateOwnerId");
-
-
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
- {
- return (0);
- }
-
- switch (IdType)
- {
- case ACPI_OWNER_TYPE_TABLE:
-
- OwnerId = AcpiGbl_NextTableOwnerId;
- AcpiGbl_NextTableOwnerId++;
-
- /* Check for wraparound */
-
- if (AcpiGbl_NextTableOwnerId == ACPI_FIRST_METHOD_ID)
- {
- AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
- ACPI_REPORT_WARNING (("Table owner ID wraparound\n"));
- }
- break;
-
-
- case ACPI_OWNER_TYPE_METHOD:
-
- OwnerId = AcpiGbl_NextMethodOwnerId;
- AcpiGbl_NextMethodOwnerId++;
-
- if (AcpiGbl_NextMethodOwnerId == ACPI_FIRST_TABLE_ID)
- {
- /* Check for wraparound */
-
- AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
- }
- break;
-
- default:
- break;
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
- return_VALUE (OwnerId);
-}
-
-
-/****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiUtInitGlobals
*
- * PARAMETERS: none
+ * PARAMETERS: None
+ *
+ * RETURN: None
*
* DESCRIPTION: Init library globals. All globals that require specific
* initialization should be initialized here!
*
- ***************************************************************************/
+ ******************************************************************************/
void
AcpiUtInitGlobals (
void)
{
+ ACPI_STATUS Status;
UINT32 i;
- ACPI_FUNCTION_TRACE ("UtInitGlobals");
+ ACPI_FUNCTION_TRACE (UtInitGlobals);
- /* Memory allocation and cache lists */
+ /* Create all memory caches */
- ACPI_MEMSET (AcpiGbl_MemoryLists, 0, sizeof (ACPI_MEMORY_LIST) * ACPI_NUM_MEM_LISTS);
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_GENERIC_STATE *) NULL)->Common.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_PARSE_OBJECT *) NULL)->Common.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_OPERAND_OBJECT *) NULL)->Cache.Next), NULL);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].LinkOffset = (UINT16) ACPI_PTR_DIFF (&(((ACPI_WALK_STATE *) NULL)->Next), NULL);
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ObjectSize = sizeof (ACPI_NAMESPACE_NODE);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ObjectSize = sizeof (ACPI_GENERIC_STATE);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ObjectSize = sizeof (ACPI_PARSE_OBJ_COMMON);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ObjectSize = sizeof (ACPI_PARSE_OBJ_NAMED);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ObjectSize = sizeof (ACPI_OPERAND_OBJECT);
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ObjectSize = sizeof (ACPI_WALK_STATE);
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].MaxCacheDepth = ACPI_MAX_STATE_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].MaxCacheDepth = ACPI_MAX_PARSE_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].MaxCacheDepth = ACPI_MAX_EXTPARSE_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].MaxCacheDepth = ACPI_MAX_OBJECT_CACHE_DEPTH;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].MaxCacheDepth = ACPI_MAX_WALK_CACHE_DEPTH;
-
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].ListName = "Global Memory Allocation");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_NSNODE].ListName = "Namespace Nodes");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_STATE].ListName = "State Object Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE].ListName = "Parse Node Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_PSNODE_EXT].ListName = "Extended Parse Node Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_OPERAND].ListName = "Operand Object Cache");
- ACPI_MEM_TRACKING (AcpiGbl_MemoryLists[ACPI_MEM_LIST_WALK].ListName = "Tree Walk Node Cache");
-
- /* ACPI table structure */
-
- for (i = 0; i < NUM_ACPI_TABLE_TYPES; i++)
+ Status = AcpiUtCreateCaches ();
+ if (ACPI_FAILURE (Status))
{
- AcpiGbl_TableLists[i].Next = NULL;
- AcpiGbl_TableLists[i].Count = 0;
+ return;
}
/* Mutex locked flags */
- for (i = 0; i < NUM_MUTEX; i++)
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
AcpiGbl_MutexInfo[i].Mutex = NULL;
- AcpiGbl_MutexInfo[i].OwnerId = ACPI_MUTEX_NOT_ACQUIRED;
+ AcpiGbl_MutexInfo[i].ThreadId = ACPI_MUTEX_NOT_ACQUIRED;
AcpiGbl_MutexInfo[i].UseCount = 0;
}
+ for (i = 0; i < ACPI_NUM_OWNERID_MASKS; i++)
+ {
+ AcpiGbl_OwnerIdMask[i] = 0;
+ }
+ AcpiGbl_OwnerIdMask[ACPI_NUM_OWNERID_MASKS - 1] = 0x80000000; /* Last ID is never valid */
+
/* GPE support */
+ AcpiGpeCount = 0;
AcpiGbl_GpeXruptListHead = NULL;
AcpiGbl_GpeFadtBlocks[0] = NULL;
AcpiGbl_GpeFadtBlocks[1] = NULL;
@@ -950,32 +782,26 @@
AcpiGbl_ExceptionHandler = NULL;
AcpiGbl_InitHandler = NULL;
- /* Global "typed" ACPI table pointers */
-
- AcpiGbl_RSDP = NULL;
- AcpiGbl_XSDT = NULL;
- AcpiGbl_FACS = NULL;
- AcpiGbl_FADT = NULL;
- AcpiGbl_DSDT = NULL;
-
/* Global Lock support */
+ AcpiGbl_GlobalLockSemaphore = NULL;
+ AcpiGbl_GlobalLockMutex = NULL;
AcpiGbl_GlobalLockAcquired = FALSE;
- AcpiGbl_GlobalLockThreadCount = 0;
AcpiGbl_GlobalLockHandle = 0;
/* Miscellaneous variables */
- AcpiGbl_TableFlags = ACPI_PHYSICAL_POINTER;
- AcpiGbl_RsdpOriginalLocation = 0;
AcpiGbl_CmSingleStep = FALSE;
AcpiGbl_DbTerminateThreads = FALSE;
AcpiGbl_Shutdown = FALSE;
AcpiGbl_NsLookupCount = 0;
AcpiGbl_PsFindCount = 0;
AcpiGbl_AcpiHardwarePresent = TRUE;
- AcpiGbl_NextTableOwnerId = ACPI_FIRST_TABLE_ID;
- AcpiGbl_NextMethodOwnerId = ACPI_FIRST_METHOD_ID;
+ AcpiGbl_LastOwnerIdIndex = 0;
+ AcpiGbl_NextOwnerIdOffset = 0;
+ AcpiGbl_TraceMethodName = 0;
+ AcpiGbl_TraceDbgLevel = 0;
+ AcpiGbl_TraceDbgLayer = 0;
AcpiGbl_DebuggerConfiguration = DEBUGGER_THREADING;
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
@@ -987,9 +813,8 @@
/* Namespace */
AcpiGbl_RootNode = NULL;
-
AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
- AcpiGbl_RootNodeStruct.Descriptor = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
AcpiGbl_RootNodeStruct.Child = NULL;
AcpiGbl_RootNodeStruct.Peer = NULL;
@@ -1001,7 +826,17 @@
AcpiGbl_LowestStackPointer = ACPI_SIZE_MAX;
#endif
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ AcpiGbl_DisplayFinalMemStats = FALSE;
+#endif
+
return_VOID;
}
+/* Public globals */
+
+ACPI_EXPORT_SYMBOL (AcpiDbgLevel)
+ACPI_EXPORT_SYMBOL (AcpiDbgLayer)
+ACPI_EXPORT_SYMBOL (AcpiGpeCount)
+
Index: acpi.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acpi.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acpi.h -L sys/contrib/dev/acpica/acpi.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acpi.h
+++ sys/contrib/dev/acpica/acpi.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acpi.h - Master include file, Publics and external data.
- * $Revision: 57 $
+ * $Revision: 1.61 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -122,6 +122,7 @@
* We put them here because we don't want to duplicate them
* in the rest of the source code again and again.
*/
+#include <contrib/dev/acpica/acnames.h> /* Global ACPI names and strings */
#include <contrib/dev/acpica/acconfig.h> /* Configuration constants */
#include <contrib/dev/acpica/acenv.h> /* Target environment specific items */
#include <contrib/dev/acpica/actypes.h> /* Fundamental common data types */
Index: evmisc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evmisc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evmisc.c -L sys/contrib/dev/acpica/evmisc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evmisc.c
+++ sys/contrib/dev/acpica/evmisc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: evmisc - Miscellaneous event manager support functions
- * $Revision: 79 $
+ * $Revision: 1.103 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,6 +123,41 @@
ACPI_MODULE_NAME ("evmisc")
+/* Names for Notify() values, used for debug output */
+
+#ifdef ACPI_DEBUG_OUTPUT
+static const char *AcpiNotifyValueNames[] =
+{
+ "Bus Check",
+ "Device Check",
+ "Device Wake",
+ "Eject Request",
+ "Device Check Light",
+ "Frequency Mismatch",
+ "Bus Mode Mismatch",
+ "Power Fault"
+};
+#endif
+
+/* Pointer to FACS needed for the Global Lock */
+
+static ACPI_TABLE_FACS *Facs = NULL;
+
+/* Local prototypes */
+
+static void ACPI_SYSTEM_XFACE
+AcpiEvNotifyDispatch (
+ void *Context);
+
+static UINT32
+AcpiEvGlobalLockHandler (
+ void *Context);
+
+static ACPI_STATUS
+AcpiEvRemoveGlobalLockHandler (
+ void);
+
+
/*******************************************************************************
*
* FUNCTION: AcpiEvIsNotifyObject
@@ -172,20 +207,6 @@
*
******************************************************************************/
-#ifdef ACPI_DEBUG_OUTPUT
-static const char *AcpiNotifyValueNames[] =
-{
- "Bus Check",
- "Device Check",
- "Device Wake",
- "Eject request",
- "Device Check Light",
- "Frequency Mismatch",
- "Bus Mode Mismatch",
- "Power Fault"
-};
-#endif
-
ACPI_STATUS
AcpiEvQueueNotifyRequest (
ACPI_NAMESPACE_NODE *Node,
@@ -197,14 +218,15 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_NAME ("EvQueueNotifyRequest");
+ ACPI_FUNCTION_NAME (EvQueueNotifyRequest);
/*
* For value 3 (Ejection Request), some device method may need to be run.
- * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need to be run.
+ * For value 2 (Device Wake) if _PRW exists, the _PS0 method may need
+ * to be run.
* For value 0x80 (Status Change) on the power button or sleep button,
- * initiate soft-off or sleep operation?
+ * initiate soft-off or sleep operation?
*/
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
"Dispatching Notify(%X) on node %p\n", NotifyValue, Node));
@@ -212,12 +234,13 @@
if (NotifyValue <= 7)
{
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: %s\n",
- AcpiNotifyValueNames[NotifyValue]));
+ AcpiNotifyValueNames[NotifyValue]));
}
else
{
- ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "Notify value: 0x%2.2X **Device Specific**\n",
- NotifyValue));
+ ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
+ "Notify value: 0x%2.2X **Device Specific**\n",
+ NotifyValue));
}
/* Get the notify object attached to the NS Node */
@@ -262,13 +285,13 @@
return (AE_NO_MEMORY);
}
- NotifyInfo->Common.DataType = ACPI_DESC_TYPE_STATE_NOTIFY;
- NotifyInfo->Notify.Node = Node;
- NotifyInfo->Notify.Value = (UINT16) NotifyValue;
+ NotifyInfo->Common.DescriptorType = ACPI_DESC_TYPE_STATE_NOTIFY;
+ NotifyInfo->Notify.Node = Node;
+ NotifyInfo->Notify.Value = (UINT16) NotifyValue;
NotifyInfo->Notify.HandlerObj = HandlerObj;
- Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
- AcpiEvNotifyDispatch, NotifyInfo);
+ Status = AcpiOsExecute (
+ OSL_NOTIFY_HANDLER, AcpiEvNotifyDispatch, NotifyInfo);
if (ACPI_FAILURE (Status))
{
AcpiUtDeleteGenericState (NotifyInfo);
@@ -294,7 +317,7 @@
*
* FUNCTION: AcpiEvNotifyDispatch
*
- * PARAMETERS: Context - To be passsed to the notify handler
+ * PARAMETERS: Context - To be passed to the notify handler
*
* RETURN: None.
*
@@ -303,7 +326,7 @@
*
******************************************************************************/
-void ACPI_SYSTEM_XFACE
+static void ACPI_SYSTEM_XFACE
AcpiEvNotifyDispatch (
void *Context)
{
@@ -318,7 +341,8 @@
/*
* We will invoke a global notify handler if installed.
- * This is done _before_ we invoke the per-device handler attached to the device.
+ * This is done _before_ we invoke the per-device handler attached
+ * to the device.
*/
if (NotifyInfo->Notify.Value <= ACPI_MAX_SYS_NOTIFY)
{
@@ -345,7 +369,8 @@
if (GlobalHandler)
{
- GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value, GlobalContext);
+ GlobalHandler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
+ GlobalContext);
}
/* Now invoke the per-device handler, if present */
@@ -353,8 +378,9 @@
HandlerObj = NotifyInfo->Notify.HandlerObj;
if (HandlerObj)
{
- HandlerObj->Notify.Handler (NotifyInfo->Notify.Node, NotifyInfo->Notify.Value,
- HandlerObj->Notify.Context);
+ HandlerObj->Notify.Handler (NotifyInfo->Notify.Node,
+ NotifyInfo->Notify.Value,
+ HandlerObj->Notify.Context);
}
/* All done with the info object */
@@ -365,52 +391,19 @@
/*******************************************************************************
*
- * FUNCTION: AcpiEvGlobalLockThread
- *
- * PARAMETERS: Context - From thread interface, not used
- *
- * RETURN: None
- *
- * DESCRIPTION: Invoked by SCI interrupt handler upon acquisition of the
- * Global Lock. Simply signal all threads that are waiting
- * for the lock.
- *
- ******************************************************************************/
-
-static void ACPI_SYSTEM_XFACE
-AcpiEvGlobalLockThread (
- void *Context)
-{
- ACPI_STATUS Status;
-
-
- /* Signal threads that are waiting for the lock */
-
- if (AcpiGbl_GlobalLockThreadCount)
- {
- /* Send sufficient units to the semaphore */
-
- Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore,
- AcpiGbl_GlobalLockThreadCount);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("Could not signal Global Lock semaphore\n"));
- }
- }
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiEvGlobalLockHandler
*
* PARAMETERS: Context - From thread interface, not used
*
- * RETURN: ACPI_INTERRUPT_HANDLED or ACPI_INTERRUPT_NOT_HANDLED
+ * RETURN: ACPI_INTERRUPT_HANDLED
*
* DESCRIPTION: Invoked directly from the SCI handler when a global lock
- * release interrupt occurs. Grab the global lock and queue
- * the global lock thread for execution
+ * release interrupt occurs. Attempt to acquire the global lock,
+ * if successful, signal the thread waiting for the lock.
+ *
+ * NOTE: Assumes that the semaphore can be signaled from interrupt level. If
+ * this is not possible for some reason, a separate thread will have to be
+ * scheduled to do this.
*
******************************************************************************/
@@ -423,27 +416,24 @@
/*
- * Attempt to get the lock
+ * Attempt to get the lock.
+ *
* If we don't get it now, it will be marked pending and we will
* take another interrupt when it becomes free.
*/
- ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
if (Acquired)
{
- /* Got the lock, now wake all threads waiting for it */
+ /* Got the lock, now wake the thread waiting for it */
AcpiGbl_GlobalLockAcquired = TRUE;
- /* Run the Global Lock thread which will signal all waiting threads */
+ /* Send a unit to the semaphore */
- Status = AcpiOsQueueForExecution (OSD_PRIORITY_HIGH,
- AcpiEvGlobalLockThread, Context);
+ Status = AcpiOsSignalSemaphore (AcpiGbl_GlobalLockSemaphore, 1);
if (ACPI_FAILURE (Status))
{
- ACPI_REPORT_ERROR (("Could not queue Global Lock thread, %s\n",
- AcpiFormatException (Status)));
-
- return (ACPI_INTERRUPT_NOT_HANDLED);
+ ACPI_ERROR ((AE_INFO, "Could not signal Global Lock semaphore"));
}
}
@@ -464,17 +454,25 @@
******************************************************************************/
ACPI_STATUS
-AcpiEvInitGlobalLockHandler (void)
+AcpiEvInitGlobalLockHandler (
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvInitGlobalLockHandler");
+ ACPI_FUNCTION_TRACE (EvInitGlobalLockHandler);
+
+ Status = AcpiGetTableByIndex (ACPI_TABLE_INDEX_FACS,
+ ACPI_CAST_INDIRECT_PTR (ACPI_TABLE_HEADER, &Facs));
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
AcpiGbl_GlobalLockPresent = TRUE;
Status = AcpiInstallFixedEventHandler (ACPI_EVENT_GLOBAL,
- AcpiEvGlobalLockHandler, NULL);
+ AcpiEvGlobalLockHandler, NULL);
/*
* If the global lock does not exist on this platform, the attempt
@@ -485,6 +483,9 @@
*/
if (Status == AE_NO_HARDWARE_RESPONSE)
{
+ ACPI_ERROR ((AE_INFO,
+ "No response from Global Lock hardware, disabling lock"));
+
AcpiGbl_GlobalLockPresent = FALSE;
Status = AE_OK;
}
@@ -493,6 +494,35 @@
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvRemoveGlobalLockHandler
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove the handler for the Global Lock
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiEvRemoveGlobalLockHandler (
+ void)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (EvRemoveGlobalLockHandler);
+
+ AcpiGbl_GlobalLockPresent = FALSE;
+ Status = AcpiRemoveFixedEventHandler (ACPI_EVENT_GLOBAL,
+ AcpiEvGlobalLockHandler);
+
+ return_ACPI_STATUS (Status);
+}
+
+
/******************************************************************************
*
* FUNCTION: AcpiEvAcquireGlobalLock
@@ -503,6 +533,16 @@
*
* DESCRIPTION: Attempt to gain ownership of the Global Lock.
*
+ * MUTEX: Interpreter must be locked
+ *
+ * Note: The original implementation allowed multiple threads to "acquire" the
+ * Global Lock, and the OS would hold the lock until the last thread had
+ * released it. However, this could potentially starve the BIOS out of the
+ * lock, especially in the case where there is a tight handshake between the
+ * Embedded Controller driver and the BIOS. Therefore, this implementation
+ * allows only one thread to acquire the HW Global Lock at a time, and makes
+ * the global lock appear as a standard mutex on the OS side.
+ *
*****************************************************************************/
ACPI_STATUS
@@ -513,54 +553,70 @@
BOOLEAN Acquired = FALSE;
- ACPI_FUNCTION_TRACE ("EvAcquireGlobalLock");
-
+ ACPI_FUNCTION_TRACE (EvAcquireGlobalLock);
-#ifndef ACPI_APPLICATION
- /* Make sure that we actually have a global lock */
- if (!AcpiGbl_GlobalLockPresent)
+ /*
+ * Only one thread can acquire the GL at a time, the GlobalLockMutex
+ * enforces this. This interface releases the interpreter if we must wait.
+ */
+ Status = AcpiExSystemWaitMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex,
+ Timeout);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_NO_GLOBAL_LOCK);
+ return_ACPI_STATUS (Status);
}
-#endif
-
- /* One more thread wants the global lock */
-
- AcpiGbl_GlobalLockThreadCount++;
- /* If we (OS side vs. BIOS side) have the hardware lock already, we are done */
+ /*
+ * Update the global lock handle and check for wraparound. The handle is
+ * only used for the external global lock interfaces, but it is updated
+ * here to properly handle the case where a single thread may acquire the
+ * lock via both the AML and the AcpiAcquireGlobalLock interfaces. The
+ * handle is therefore updated on the first acquire from a given thread
+ * regardless of where the acquisition request originated.
+ */
+ AcpiGbl_GlobalLockHandle++;
+ if (AcpiGbl_GlobalLockHandle == 0)
+ {
+ AcpiGbl_GlobalLockHandle = 1;
+ }
- if (AcpiGbl_GlobalLockAcquired)
+ /*
+ * Make sure that a global lock actually exists. If not, just treat
+ * the lock as a standard mutex.
+ */
+ if (!AcpiGbl_GlobalLockPresent)
{
+ AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
- /* We must acquire the actual hardware lock */
+ /* Attempt to acquire the actual hardware lock */
- ACPI_ACQUIRE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Acquired);
+ ACPI_ACQUIRE_GLOBAL_LOCK (Facs, Acquired);
if (Acquired)
{
/* We got the lock */
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired the HW Global Lock\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Acquired hardware Global Lock\n"));
AcpiGbl_GlobalLockAcquired = TRUE;
return_ACPI_STATUS (AE_OK);
}
/*
- * Did not get the lock. The pending bit was set above, and we must now
+ * Did not get the lock. The pending bit was set above, and we must now
* wait until we get the global lock released interrupt.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for the HW Global Lock\n"));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Waiting for hardware Global Lock\n"));
/*
- * Acquire the global lock semaphore first.
- * Since this wait will block, we must release the interpreter
+ * Wait for handshake with the global lock interrupt handler.
+ * This interface releases the interpreter if we must wait.
*/
Status = AcpiExSystemWaitSemaphore (AcpiGbl_GlobalLockSemaphore,
- Timeout);
+ ACPI_WAIT_FOREVER);
+
return_ACPI_STATUS (Status);
}
@@ -578,47 +634,49 @@
******************************************************************************/
ACPI_STATUS
-AcpiEvReleaseGlobalLock (void)
+AcpiEvReleaseGlobalLock (
+ void)
{
BOOLEAN Pending = FALSE;
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("EvReleaseGlobalLock");
+ ACPI_FUNCTION_TRACE (EvReleaseGlobalLock);
+
+ /* Lock must be already acquired */
- if (!AcpiGbl_GlobalLockThreadCount)
+ if (!AcpiGbl_GlobalLockAcquired)
{
- ACPI_REPORT_WARNING(("Cannot release HW Global Lock, it has not been acquired\n"));
+ ACPI_WARNING ((AE_INFO,
+ "Cannot release the ACPI Global Lock, it has not been acquired"));
return_ACPI_STATUS (AE_NOT_ACQUIRED);
}
- /* One fewer thread has the global lock */
-
- AcpiGbl_GlobalLockThreadCount--;
- if (AcpiGbl_GlobalLockThreadCount)
+ if (AcpiGbl_GlobalLockPresent)
{
- /* There are still some threads holding the lock, cannot release */
+ /* Allow any thread to release the lock */
- return_ACPI_STATUS (AE_OK);
+ ACPI_RELEASE_GLOBAL_LOCK (Facs, Pending);
+
+ /*
+ * If the pending bit was set, we must write GBL_RLS to the control
+ * register
+ */
+ if (Pending)
+ {
+ Status = AcpiSetRegister (
+ ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1);
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Released hardware Global Lock\n"));
}
- /*
- * No more threads holding lock, we can do the actual hardware
- * release
- */
- ACPI_RELEASE_GLOBAL_LOCK (AcpiGbl_CommonFACS.GlobalLock, Pending);
AcpiGbl_GlobalLockAcquired = FALSE;
- /*
- * If the pending bit was set, we must write GBL_RLS to the control
- * register
- */
- if (Pending)
- {
- Status = AcpiSetRegister (ACPI_BITREG_GLOBAL_LOCK_RELEASE, 1, ACPI_MTX_LOCK);
- }
+ /* Release the local GL mutex */
+ AcpiOsReleaseMutex (AcpiGbl_GlobalLockMutex->Mutex.OsMutex);
return_ACPI_STATUS (Status);
}
@@ -636,13 +694,14 @@
******************************************************************************/
void
-AcpiEvTerminate (void)
+AcpiEvTerminate (
+ void)
{
ACPI_NATIVE_UINT i;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvTerminate");
+ ACPI_FUNCTION_TRACE (EvTerminate);
if (AcpiGbl_EventsInitialized)
@@ -659,26 +718,35 @@
Status = AcpiDisableEvent ((UINT32) i, 0);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not disable fixed event %d\n", (UINT32) i));
+ ACPI_ERROR ((AE_INFO,
+ "Could not disable fixed event %d", (UINT32) i));
}
}
/* Disable all GPEs in all GPE blocks */
- Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, ACPI_NOT_ISR);
+ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
/* Remove SCI handler */
Status = AcpiEvRemoveSciHandler ();
if (ACPI_FAILURE(Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not remove SCI handler\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Could not remove SCI handler"));
+ }
+
+ Status = AcpiEvRemoveGlobalLockHandler ();
+ if (ACPI_FAILURE(Status))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Could not remove Global Lock handler"));
}
}
/* Deallocate all handler objects installed within GPE info structs */
- Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers, ACPI_NOT_ISR);
+ Status = AcpiEvWalkGpeList (AcpiEvDeleteGpeHandlers);
/* Return to original mode if necessary */
@@ -687,7 +755,7 @@
Status = AcpiDisable ();
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "AcpiDisable failed\n"));
+ ACPI_WARNING ((AE_INFO, "AcpiDisable failed"));
}
}
return_VOID;
Index: dbinput.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbinput.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbinput.c -L sys/contrib/dev/acpica/dbinput.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbinput.c
+++ sys/contrib/dev/acpica/dbinput.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbinput - user front-end to the AML debugger
- * $Revision: 101 $
+ * $Revision: 1.114 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,29 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbinput")
+/* Local prototypes */
+
+static char *
+AcpiDbGetNextToken (
+ char *String,
+ char **Next);
+
+static UINT32
+AcpiDbGetLine (
+ char *InputBuffer);
+
+static UINT32
+AcpiDbMatchCommand (
+ char *UserCommand);
+
+static void
+AcpiDbSingleThread (
+ void);
+
+static void
+AcpiDbDisplayHelp (
+ char *HelpType);
+
/*
* Top-level debugger commands.
@@ -138,6 +161,7 @@
CMD_ARGS,
CMD_ARGUMENTS,
CMD_BREAKPOINT,
+ CMD_BUSINFO,
CMD_CALL,
CMD_CLOSE,
CMD_DEBUG,
@@ -182,6 +206,7 @@
CMD_TABLES,
CMD_TERMINATE,
CMD_THREADS,
+ CMD_TRACE,
CMD_TREE,
CMD_TYPE,
CMD_UNLOAD
@@ -189,7 +214,6 @@
#define CMD_FIRST_VALID 2
-
static const COMMAND_INFO AcpiGbl_DbCommands[] =
{
{"<NOT FOUND>", 0},
@@ -198,6 +222,7 @@
{"ARGS", 0},
{"ARGUMENTS", 0},
{"BREAKPOINT", 1},
+ {"BUSINFO", 0},
{"CALL", 0},
{"CLOSE", 0},
{"DEBUG", 1},
@@ -242,6 +267,7 @@
{"TABLES", 0},
{"TERMINATE", 0},
{"THREADS", 3},
+ {"TRACE", 1},
{"TREE", 0},
{"TYPE", 1},
{"UNLOAD", 1},
@@ -261,11 +287,12 @@
*
******************************************************************************/
-void
+static void
AcpiDbDisplayHelp (
char *HelpType)
{
+ AcpiUtStrupr (HelpType);
/* No parameter, just give the overview */
@@ -321,23 +348,24 @@
case 'N':
AcpiOsPrintf ("\nNamespace Access Commands\n\n");
+ AcpiOsPrintf ("Businfo Display system bus info\n");
AcpiOsPrintf ("Disassemble <Method> Disassemble a control method\n");
AcpiOsPrintf ("Event <F|G> <Value> Generate AcpiEvent (Fixed/GPE)\n");
- AcpiOsPrintf ("Find <Name> (? is wildcard) Find ACPI name(s) with wildcards\n");
+ AcpiOsPrintf ("Find <AcpiName> (? is wildcard) Find ACPI name(s) with wildcards\n");
AcpiOsPrintf ("Gpe <GpeNum> <GpeBlock> Simulate a GPE\n");
AcpiOsPrintf ("Gpes Display info on all GPEs\n");
AcpiOsPrintf ("Integrity Validate namespace integrity\n");
- AcpiOsPrintf ("Method Display list of loaded control methods\n");
- AcpiOsPrintf ("Namespace [<Addr>|<Path>] [Depth] Display loaded namespace tree/subtree\n");
- AcpiOsPrintf ("Notify <NamePath> <Value> Send a notification\n");
+ AcpiOsPrintf ("Methods Display list of loaded control methods\n");
+ AcpiOsPrintf ("Namespace [Object] [Depth] Display loaded namespace tree/subtree\n");
+ AcpiOsPrintf ("Notify <Object> <Value> Send a notification on Object\n");
AcpiOsPrintf ("Objects <ObjectType> Display all objects of the given type\n");
AcpiOsPrintf ("Owner <OwnerId> [Depth] Display loaded namespace by object owner\n");
AcpiOsPrintf ("Prefix [<NamePath>] Set or Get current execution prefix\n");
AcpiOsPrintf ("References <Addr> Find all references to object at addr\n");
- AcpiOsPrintf ("Resources xxx Get and display resources\n");
+ AcpiOsPrintf ("Resources <Device> Get and display Device resources\n");
+ AcpiOsPrintf ("Set N <NamedObject> <Value> Set value for named integer\n");
AcpiOsPrintf ("Sleep <SleepState> Simulate sleep/wake sequence\n");
AcpiOsPrintf ("Terminate Delete namespace and all internal objects\n");
- AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
AcpiOsPrintf ("Type <Object> Display object type\n");
return;
@@ -356,6 +384,8 @@
AcpiOsPrintf ("Results Display method result stack\n");
AcpiOsPrintf ("Set <A|L> <#> <Value> Set method data (Arguments/Locals)\n");
AcpiOsPrintf ("Stop Terminate control method\n");
+ AcpiOsPrintf ("Thread <Threads><Loops><NamePath> Spawn threads to execute method(s)\n");
+ AcpiOsPrintf ("Trace <method name> Trace method execution\n");
AcpiOsPrintf ("Tree Display control method calling tree\n");
AcpiOsPrintf ("<Enter> Single step next AML opcode (over calls)\n");
return;
@@ -387,7 +417,7 @@
*
******************************************************************************/
-char *
+static char *
AcpiDbGetNextToken (
char *String,
char **Next)
@@ -446,14 +476,14 @@
*
* PARAMETERS: InputBuffer - Command line buffer
*
- * RETURN: None
+ * RETURN: Count of arguments to the command
*
* DESCRIPTION: Get the next command line from the user. Gets entire line
* up to the next newline
*
******************************************************************************/
-UINT32
+static UINT32
AcpiDbGetLine (
char *InputBuffer)
{
@@ -464,7 +494,6 @@
ACPI_STRCPY (AcpiGbl_DbParsedBuf, InputBuffer);
- ACPI_STRUPR (AcpiGbl_DbParsedBuf);
This = AcpiGbl_DbParsedBuf;
for (i = 0; i < ACPI_DEBUGGER_MAX_ARGS; i++)
@@ -482,7 +511,7 @@
if (AcpiGbl_DbArgs[0])
{
- ACPI_STRUPR (AcpiGbl_DbArgs[0]);
+ AcpiUtStrupr (AcpiGbl_DbArgs[0]);
}
Count = i;
@@ -507,7 +536,7 @@
*
******************************************************************************/
-UINT32
+static UINT32
AcpiDbMatchCommand (
char *UserCommand)
{
@@ -544,7 +573,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Command dispatcher. Called from two places:
+ * DESCRIPTION: Command dispatcher.
*
******************************************************************************/
@@ -577,7 +606,9 @@
if (ParamCount < AcpiGbl_DbCommands[CommandIndex].MinArgs)
{
AcpiOsPrintf ("%d parameters entered, [%s] requires %d parameters\n",
- ParamCount, AcpiGbl_DbCommands[CommandIndex].Name, AcpiGbl_DbCommands[CommandIndex].MinArgs);
+ ParamCount, AcpiGbl_DbCommands[CommandIndex].Name,
+ AcpiGbl_DbCommands[CommandIndex].MinArgs);
+
return (AE_CTRL_TRUE);
}
@@ -608,6 +639,10 @@
AcpiDbSetMethodBreakpoint (AcpiGbl_DbArgs[1], WalkState, Op);
break;
+ case CMD_BUSINFO:
+ AcpiDbGetBusInfo ();
+ break;
+
case CMD_CALL:
AcpiDbSetMethodCallBreakpoint (Op);
Status = AE_OK;
@@ -622,7 +657,7 @@
break;
case CMD_DISASSEMBLE:
- AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
+ (void) AcpiDbDisassembleMethod (AcpiGbl_DbArgs[1]);
break;
case CMD_DUMP:
@@ -643,7 +678,8 @@
break;
case CMD_EXECUTE:
- AcpiDbExecute (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP);
+ AcpiDbExecute (AcpiGbl_DbArgs[1],
+ &AcpiGbl_DbArgs[2], EX_NO_SINGLE_STEP);
break;
case CMD_FIND:
@@ -679,10 +715,6 @@
}
Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
- if (ACPI_SUCCESS (Status))
- {
- Status = AE_CTRL_TRUE;
- }
return (Status);
case CMD_HISTORY_LAST:
@@ -693,10 +725,6 @@
}
Status = AcpiDbCommandDispatch (CommandLine, WalkState, Op);
- if (ACPI_SUCCESS (Status))
- {
- Status = AE_CTRL_TRUE;
- }
return (Status);
case CMD_INFORMATION:
@@ -718,20 +746,27 @@
case CMD_LEVEL:
if (ParamCount == 0)
{
- AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n", AcpiGbl_DbDebugLevel);
- AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n", AcpiGbl_DbConsoleDebugLevel);
+ AcpiOsPrintf ("Current debug level for file output is: %8.8lX\n",
+ AcpiGbl_DbDebugLevel);
+ AcpiOsPrintf ("Current debug level for console output is: %8.8lX\n",
+ AcpiGbl_DbConsoleDebugLevel);
}
else if (ParamCount == 2)
{
Temp = AcpiGbl_DbConsoleDebugLevel;
- AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
- AcpiOsPrintf ("Debug Level for console output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbConsoleDebugLevel);
+ AcpiGbl_DbConsoleDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1],
+ NULL, 16);
+ AcpiOsPrintf (
+ "Debug Level for console output was %8.8lX, now %8.8lX\n",
+ Temp, AcpiGbl_DbConsoleDebugLevel);
}
else
{
Temp = AcpiGbl_DbDebugLevel;
AcpiGbl_DbDebugLevel = ACPI_STRTOUL (AcpiGbl_DbArgs[1], NULL, 16);
- AcpiOsPrintf ("Debug Level for file output was %8.8lX, now %8.8lX\n", Temp, AcpiGbl_DbDebugLevel);
+ AcpiOsPrintf (
+ "Debug Level for file output was %8.8lX, now %8.8lX\n",
+ Temp, AcpiGbl_DbDebugLevel);
}
break;
@@ -741,10 +776,6 @@
case CMD_LOAD:
Status = AcpiDbGetTableFromFile (AcpiGbl_DbArgs[1], NULL);
- if (ACPI_FAILURE (Status))
- {
- return (Status);
- }
break;
case CMD_LOCKS:
@@ -769,7 +800,7 @@
break;
case CMD_OBJECT:
- ACPI_STRUPR (AcpiGbl_DbArgs[1]);
+ AcpiUtStrupr (AcpiGbl_DbArgs[1]);
Status = AcpiDbDisplayObjects (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2]);
break;
@@ -798,7 +829,8 @@
break;
case CMD_SET:
- AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
+ AcpiDbSetMethodData (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
+ AcpiGbl_DbArgs[3]);
break;
case CMD_SLEEP:
@@ -820,13 +852,21 @@
AcpiDbSetOutputDestination (ACPI_DB_REDIRECTABLE_OUTPUT);
AcpiUtSubsystemShutdown ();
- /* TBD: [Restructure] Need some way to re-initialize without re-creating the semaphores! */
+ /*
+ * TBD: [Restructure] Need some way to re-initialize without
+ * re-creating the semaphores!
+ */
/* AcpiInitialize (NULL); */
break;
case CMD_THREADS:
- AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2], AcpiGbl_DbArgs[3]);
+ AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],
+ AcpiGbl_DbArgs[3]);
+ break;
+
+ case CMD_TRACE:
+ AcpiDebugTrace (AcpiGbl_DbArgs[1],0,0,1);
break;
case CMD_TREE:
@@ -854,13 +894,8 @@
AcpiDbgLevel = ACPI_DEBUG_DEFAULT;
}
- /* Shutdown */
-
- /* AcpiUtSubsystemShutdown (); */
AcpiDbCloseDebugFile ();
-
AcpiGbl_DbTerminateThreads = TRUE;
-
return (AE_CTRL_TERMINATE);
case CMD_NOT_FOUND:
@@ -869,6 +904,10 @@
return (AE_CTRL_TRUE);
}
+ if (ACPI_SUCCESS (Status))
+ {
+ Status = AE_CTRL_TRUE;
+ }
/* Add all commands that come here to the history buffer */
@@ -933,7 +972,7 @@
*
******************************************************************************/
-void
+static void
AcpiDbSingleThread (
void)
{
@@ -1019,13 +1058,12 @@
}
/*
- * Only this thread (the original thread) should actually terminate the subsystem,
- * because all the semaphores are deleted during termination
+ * Only this thread (the original thread) should actually terminate the
+ * subsystem, because all the semaphores are deleted during termination
*/
Status = AcpiTerminate ();
return (Status);
}
-
#endif /* ACPI_DEBUGGER */
Index: actbl2.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/actbl2.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/actbl2.h -L sys/contrib/dev/acpica/actbl2.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/actbl2.h
+++ sys/contrib/dev/acpica/actbl2.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actbl2.h - ACPI Specification Revision 2.0 Tables
- * $Revision: 37 $
+ * $Revision: 1.51 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,195 +117,7 @@
#ifndef __ACTBL2_H__
#define __ACTBL2_H__
-/*
- * Prefered Power Management Profiles
- */
-#define PM_UNSPECIFIED 0
-#define PM_DESKTOP 1
-#define PM_MOBILE 2
-#define PM_WORKSTATION 3
-#define PM_ENTERPRISE_SERVER 4
-#define PM_SOHO_SERVER 5
-#define PM_APPLIANCE_PC 6
-
-/*
- * ACPI Boot Arch Flags
- */
-#define BAF_LEGACY_DEVICES 0x0001
-#define BAF_8042_KEYBOARD_CONTROLLER 0x0002
-
-#define FADT2_REVISION_ID 3
-#define FADT2_MINUS_REVISION_ID 2
-
-
-#pragma pack(1)
-
-/*
- * ACPI 2.0 Root System Description Table (RSDT)
- */
-typedef struct rsdt_descriptor_rev2
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 TableOffsetEntry [1]; /* Array of pointers to */
- /* ACPI table headers */
-} RSDT_DESCRIPTOR_REV2;
-
-
-/*
- * ACPI 2.0 Extended System Description Table (XSDT)
- */
-typedef struct xsdt_descriptor_rev2
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT64 TableOffsetEntry [1]; /* Array of pointers to */
- /* ACPI table headers */
-} XSDT_DESCRIPTOR_REV2;
-
-
-/*
- * ACPI 2.0 Firmware ACPI Control Structure (FACS)
- */
-typedef struct facs_descriptor_rev2
-{
- char Signature[4]; /* ACPI signature */
- UINT32 Length; /* Length of structure, in bytes */
- UINT32 HardwareSignature; /* Hardware configuration signature */
- UINT32 FirmwareWakingVector; /* 32bit physical address of the Firmware Waking Vector. */
- UINT32 GlobalLock; /* Global Lock used to synchronize access to shared hardware resources */
- UINT32_BIT S4Bios_f : 1; /* S4Bios_f - Indicates if S4BIOS support is present */
- UINT32_BIT Reserved1 : 31; /* Must be 0 */
- UINT64 XFirmwareWakingVector; /* 64bit physical address of the Firmware Waking Vector. */
- UINT8 Version; /* Version of this table */
- UINT8 Reserved3 [31]; /* Reserved - must be zero */
-
-} FACS_DESCRIPTOR_REV2;
-
-
-/*
- * ACPI 2.0 Generic Address Structure (GAS)
- */
-typedef struct acpi_generic_address
-{
- UINT8 AddressSpaceId; /* Address space where struct or register exists. */
- UINT8 RegisterBitWidth; /* Size in bits of given register */
- UINT8 RegisterBitOffset; /* Bit offset within the register */
- UINT8 Reserved; /* Must be 0 */
- UINT64 Address; /* 64-bit address of struct or register */
-
-} ACPI_GENERIC_ADDRESS;
-
-
-#define FADT_REV2_COMMON \
- UINT32 V1_FirmwareCtrl; /* 32-bit physical address of FACS */ \
- UINT32 V1_Dsdt; /* 32-bit physical address of DSDT */ \
- UINT8 Reserved1; /* System Interrupt Model isn't used in ACPI 2.0*/ \
- UINT8 Prefer_PM_Profile; /* Conveys preferred power management profile to OSPM. */ \
- UINT16 SciInt; /* System vector of SCI interrupt */ \
- UINT32 SmiCmd; /* Port address of SMI command port */ \
- UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */ \
- UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */ \
- UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */ \
- UINT8 PstateCnt; /* Processor performance state control*/ \
- UINT32 V1_Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */ \
- UINT32 V1_Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */ \
- UINT32 V1_Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */ \
- UINT32 V1_Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */ \
- UINT32 V1_Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */ \
- UINT32 V1_PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */ \
- UINT32 V1_Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */ \
- UINT32 V1_Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */ \
- UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */ \
- UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */ \
- UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */ \
- UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */ \
- UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */ \
- UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */ \
- UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */ \
- UINT8 CstCnt; /* Support for the _CST object and C States change notification.*/ \
- UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */ \
- UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */ \
- UINT16 FlushSize; /* Number of flush strides that need to be read */ \
- UINT16 FlushStride; /* Processor's memory cache line width, in bytes */ \
- UINT8 DutyOffset; /* Processor's duty cycle index in processor's P_CNT reg*/ \
- UINT8 DutyWidth; /* Processor's duty cycle value bit width in P_CNT register.*/ \
- UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */ \
- UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */ \
- UINT8 Century; /* Index to century in RTC CMOS RAM */ \
- UINT16 IapcBootArch; /* IA-PC Boot Architecture Flags. See Table 5-10 for description*/
-
-/*
- * ACPI 2.0 Fixed ACPI Description Table (FADT)
- */
-typedef struct fadt_descriptor_rev2
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- FADT_REV2_COMMON
- UINT8 Reserved2; /* Reserved */
- UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
- UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
- UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
- UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
- UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
- UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
- UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
- UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- UINT32_BIT TmrValExt : 1; /* Indicates tmr_val is 32 bits 0=24-bits*/
- UINT32_BIT DockCap : 1; /* Supports Docking */
- UINT32_BIT ResetRegSup : 1; /* Indicates system supports system reset via the FADT RESET_REG*/
- UINT32_BIT SealedCase : 1; /* Indicates system has no internal expansion capabilities and case is sealed. */
- UINT32_BIT Headless : 1; /* Indicates system does not have local video capabilities or local input devices.*/
- UINT32_BIT CpuSwSleep : 1; /* Indicates to OSPM that a processor native instruction */
- /* Must be executed after writing the SLP_TYPx register. */
- UINT32_BIT Reserved6 : 18; /* Reserved - must be zero */
-
- ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
- UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */
- UINT8 Reserved7[3]; /* These three bytes must be zero */
- UINT64 XFirmwareCtrl; /* 64-bit physical address of FACS */
- UINT64 XDsdt; /* 64-bit physical address of DSDT */
- ACPI_GENERIC_ADDRESS XPm1aEvtBlk; /* Extended Power Mgt 1a AcpiEvent Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm1bEvtBlk; /* Extended Power Mgt 1b AcpiEvent Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm1aCntBlk; /* Extended Power Mgt 1a Control Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm1bCntBlk; /* Extended Power Mgt 1b Control Reg Blk address */
- ACPI_GENERIC_ADDRESS XPm2CntBlk; /* Extended Power Mgt 2 Control Reg Blk address */
- ACPI_GENERIC_ADDRESS XPmTmrBlk; /* Extended Power Mgt Timer Ctrl Reg Blk address */
- ACPI_GENERIC_ADDRESS XGpe0Blk; /* Extended General Purpose AcpiEvent 0 Reg Blk address */
- ACPI_GENERIC_ADDRESS XGpe1Blk; /* Extended General Purpose AcpiEvent 1 Reg Blk address */
-
-} FADT_DESCRIPTOR_REV2;
-
-
-/* "Downrevved" ACPI 2.0 FADT descriptor */
-
-typedef struct fadt_descriptor_rev2_minus
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- FADT_REV2_COMMON
- UINT8 Reserved2; /* Reserved */
- UINT32 Flags;
- ACPI_GENERIC_ADDRESS ResetRegister; /* Reset register address in GAS format */
- UINT8 ResetValue; /* Value to write to the ResetRegister port to reset the system. */
- UINT8 Reserved7[3]; /* These three bytes must be zero */
-
-} FADT_DESCRIPTOR_REV2_MINUS;
-
-
-
-/* Embedded Controller */
-
-typedef struct ec_boot_resources
-{
- ACPI_TABLE_HEADER_DEF
- ACPI_GENERIC_ADDRESS EcControl; /* Address of EC command/status register */
- ACPI_GENERIC_ADDRESS EcData; /* Address of EC data register */
- UINT32 Uid; /* Unique ID - must be same as the EC _UID method */
- UINT8 GpeBit; /* The GPE for the EC */
- UINT8 EcId[1]; /* Full namepath of the EC in the ACPI namespace */
-
-} EC_BOOT_RESOURCES;
-
-
-#pragma pack()
+/* Code moved to both actbl.h and actbl1.h */
#endif /* __ACTBL2_H__ */
Index: psscope.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/psscope.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/psscope.c -L sys/contrib/dev/acpica/psscope.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/psscope.c
+++ sys/contrib/dev/acpica/psscope.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psscope - Parser scope stack management routines
- * $Revision: 38 $
+ * $Revision: 1.47 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -138,6 +138,7 @@
AcpiPsGetParentScope (
ACPI_PARSE_STATE *ParserState)
{
+
return (ParserState->Scope->ParseScope.Op);
}
@@ -160,8 +161,10 @@
AcpiPsHasCompletedScope (
ACPI_PARSE_STATE *ParserState)
{
- return ((BOOLEAN) ((ParserState->Aml >= ParserState->Scope->ParseScope.ArgEnd ||
- !ParserState->Scope->ParseScope.ArgCount)));
+
+ return ((BOOLEAN)
+ ((ParserState->Aml >= ParserState->Scope->ParseScope.ArgEnd ||
+ !ParserState->Scope->ParseScope.ArgCount)));
}
@@ -186,7 +189,7 @@
ACPI_GENERIC_STATE *Scope;
- ACPI_FUNCTION_TRACE_PTR ("PsInitScope", RootOp);
+ ACPI_FUNCTION_TRACE_PTR (PsInitScope, RootOp);
Scope = AcpiUtCreateGenericState ();
@@ -195,14 +198,14 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Scope->Common.DataType = ACPI_DESC_TYPE_STATE_RPSCOPE;
- Scope->ParseScope.Op = RootOp;
- Scope->ParseScope.ArgCount = ACPI_VAR_ARGS;
- Scope->ParseScope.ArgEnd = ParserState->AmlEnd;
- Scope->ParseScope.PkgEnd = ParserState->AmlEnd;
+ Scope->Common.DescriptorType = ACPI_DESC_TYPE_STATE_RPSCOPE;
+ Scope->ParseScope.Op = RootOp;
+ Scope->ParseScope.ArgCount = ACPI_VAR_ARGS;
+ Scope->ParseScope.ArgEnd = ParserState->AmlEnd;
+ Scope->ParseScope.PkgEnd = ParserState->AmlEnd;
- ParserState->Scope = Scope;
- ParserState->StartOp = RootOp;
+ ParserState->Scope = Scope;
+ ParserState->StartOp = RootOp;
return_ACPI_STATUS (AE_OK);
}
@@ -233,7 +236,7 @@
ACPI_GENERIC_STATE *Scope;
- ACPI_FUNCTION_TRACE_PTR ("PsPushScope", Op);
+ ACPI_FUNCTION_TRACE_PTR (PsPushScope, Op);
Scope = AcpiUtCreateGenericState ();
@@ -242,11 +245,11 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
- Scope->Common.DataType = ACPI_DESC_TYPE_STATE_PSCOPE;
- Scope->ParseScope.Op = Op;
- Scope->ParseScope.ArgList = RemainingArgs;
- Scope->ParseScope.ArgCount = ArgCount;
- Scope->ParseScope.PkgEnd = ParserState->PkgEnd;
+ Scope->Common.DescriptorType = ACPI_DESC_TYPE_STATE_PSCOPE;
+ Scope->ParseScope.Op = Op;
+ Scope->ParseScope.ArgList = RemainingArgs;
+ Scope->ParseScope.ArgCount = ArgCount;
+ Scope->ParseScope.PkgEnd = ParserState->PkgEnd;
/* Push onto scope stack */
@@ -254,13 +257,13 @@
if (ArgCount == ACPI_VAR_ARGS)
{
- /* multiple arguments */
+ /* Multiple arguments */
Scope->ParseScope.ArgEnd = ParserState->PkgEnd;
}
else
{
- /* single argument */
+ /* Single argument */
Scope->ParseScope.ArgEnd = ACPI_TO_POINTER (ACPI_MAX_PTR);
}
@@ -295,22 +298,21 @@
ACPI_GENERIC_STATE *Scope = ParserState->Scope;
- ACPI_FUNCTION_TRACE ("PsPopScope");
+ ACPI_FUNCTION_TRACE (PsPopScope);
- /*
- * Only pop the scope if there is in fact a next scope
- */
+ /* Only pop the scope if there is in fact a next scope */
+
if (Scope->Common.Next)
{
Scope = AcpiUtPopGenericState (&ParserState->Scope);
- /* return to parsing previous op */
+ /* Return to parsing previous op */
- *Op = Scope->ParseScope.Op;
- *ArgList = Scope->ParseScope.ArgList;
- *ArgCount = Scope->ParseScope.ArgCount;
- ParserState->PkgEnd = Scope->ParseScope.PkgEnd;
+ *Op = Scope->ParseScope.Op;
+ *ArgList = Scope->ParseScope.ArgList;
+ *ArgCount = Scope->ParseScope.ArgCount;
+ ParserState->PkgEnd = Scope->ParseScope.PkgEnd;
/* All done with this scope state structure */
@@ -318,14 +320,15 @@
}
else
{
- /* empty parse stack, prepare to fetch next opcode */
+ /* Empty parse stack, prepare to fetch next opcode */
- *Op = NULL;
- *ArgList = 0;
- *ArgCount = 0;
+ *Op = NULL;
+ *ArgList = 0;
+ *ArgCount = 0;
}
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE, "Popped Op %p Args %X\n", *Op, *ArgCount));
+ ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
+ "Popped Op %p Args %X\n", *Op, *ArgCount));
return_VOID;
}
@@ -336,7 +339,7 @@
*
* PARAMETERS: ParserState - Current parser state object
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Destroy available list, remaining stack levels, and return
* root scope
@@ -350,7 +353,7 @@
ACPI_GENERIC_STATE *Scope;
- ACPI_FUNCTION_TRACE_PTR ("PsCleanupScope", ParserState);
+ ACPI_FUNCTION_TRACE_PTR (PsCleanupScope, ParserState);
if (!ParserState)
Index: psxface.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/psxface.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/psxface.c -L sys/contrib/dev/acpica/psxface.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/psxface.c
+++ sys/contrib/dev/acpica/psxface.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: psxface - Parser external interfaces
- * $Revision: 75 $
+ * $Revision: 1.93 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,136 +120,249 @@
#include <contrib/dev/acpica/acparser.h>
#include <contrib/dev/acpica/acdispat.h>
#include <contrib/dev/acpica/acinterp.h>
-#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_PARSER
ACPI_MODULE_NAME ("psxface")
+/* Local Prototypes */
+
+static void
+AcpiPsStartTrace (
+ ACPI_EVALUATE_INFO *Info);
+
+static void
+AcpiPsStopTrace (
+ ACPI_EVALUATE_INFO *Info);
+
+static void
+AcpiPsUpdateParameterList (
+ ACPI_EVALUATE_INFO *Info,
+ UINT16 Action);
+
/*******************************************************************************
*
- * FUNCTION: AcpiPsxExecute
+ * FUNCTION: AcpiDebugTrace
*
- * PARAMETERS: Info->Node - A method object containing both the AML
- * address and length.
- * **Params - List of parameters to pass to method,
- * terminated by NULL. Params itself may be
- * NULL if no parameters are being passed.
- * **ReturnObjDesc - Return object from execution of the
- * method.
+ * PARAMETERS: MethodName - Valid ACPI name string
+ * DebugLevel - Optional level mask. 0 to use default
+ * DebugLayer - Optional layer mask. 0 to use default
+ * Flags - bit 1: one shot(1) or persistent(0)
*
* RETURN: Status
*
- * DESCRIPTION: Execute a control method
+ * DESCRIPTION: External interface to enable debug tracing during control
+ * method execution
*
******************************************************************************/
ACPI_STATUS
-AcpiPsxExecute (
- ACPI_PARAMETER_INFO *Info)
+AcpiDebugTrace (
+ char *Name,
+ UINT32 DebugLevel,
+ UINT32 DebugLayer,
+ UINT32 Flags)
{
ACPI_STATUS Status;
- ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 i;
- ACPI_PARSE_OBJECT *Op;
- ACPI_WALK_STATE *WalkState;
- ACPI_FUNCTION_TRACE ("PsxExecute");
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ /* TBDs: Validate name, allow full path or just nameseg */
- /* Validate the Node and get the attached object */
+ AcpiGbl_TraceMethodName = *ACPI_CAST_PTR (UINT32, Name);
+ AcpiGbl_TraceFlags = Flags;
- if (!Info || !Info->Node)
+ if (DebugLevel)
{
- return_ACPI_STATUS (AE_NULL_ENTRY);
+ AcpiGbl_TraceDbgLevel = DebugLevel;
}
-
- ObjDesc = AcpiNsGetAttachedObject (Info->Node);
- if (!ObjDesc)
+ if (DebugLayer)
{
- return_ACPI_STATUS (AE_NULL_OBJECT);
+ AcpiGbl_TraceDbgLayer = DebugLayer;
}
- /* Init for new method, wait on concurrency semaphore */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return (AE_OK);
+}
+
- Status = AcpiDsBeginMethodExecution (Info->Node, ObjDesc, NULL);
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsStartTrace
+ *
+ * PARAMETERS: Info - Method info struct
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Start control method execution trace
+ *
+ ******************************************************************************/
+
+static void
+AcpiPsStartTrace (
+ ACPI_EVALUATE_INFO *Info)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ return;
}
- if ((Info->ParameterType == ACPI_PARAM_ARGS) &&
- (Info->Parameters))
+ if ((!AcpiGbl_TraceMethodName) ||
+ (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
{
- /*
- * The caller "owns" the parameters, so give each one an extra
- * reference
- */
- for (i = 0; Info->Parameters[i]; i++)
- {
- AcpiUtAddReference (Info->Parameters[i]);
- }
+ goto Exit;
}
- /*
- * 1) Perform the first pass parse of the method to enter any
- * named objects that it creates into the namespace
- */
- ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "**** Begin Method Parse **** Entry=%p obj=%p\n",
- Info->Node, ObjDesc));
+ AcpiGbl_OriginalDbgLevel = AcpiDbgLevel;
+ AcpiGbl_OriginalDbgLayer = AcpiDbgLayer;
- /* Create and init a Root Node */
+ AcpiDbgLevel = 0x00FFFFFF;
+ AcpiDbgLayer = ACPI_UINT32_MAX;
- Op = AcpiPsCreateScopeOp ();
- if (!Op)
+ if (AcpiGbl_TraceDbgLevel)
{
- Status = AE_NO_MEMORY;
- goto Cleanup1;
+ AcpiDbgLevel = AcpiGbl_TraceDbgLevel;
+ }
+ if (AcpiGbl_TraceDbgLayer)
+ {
+ AcpiDbgLayer = AcpiGbl_TraceDbgLayer;
}
- /*
- * Get a new OwnerId for objects created by this method. Namespace
- * objects (such as Operation Regions) can be created during the
- * first pass parse.
- */
- ObjDesc->Method.OwningId = AcpiUtAllocateOwnerId (ACPI_OWNER_TYPE_METHOD);
- /* Create and initialize a new walk state */
+Exit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+}
- WalkState = AcpiDsCreateWalkState (ObjDesc->Method.OwningId,
- NULL, NULL, NULL);
- if (!WalkState)
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsStopTrace
+ *
+ * PARAMETERS: Info - Method info struct
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Stop control method execution trace
+ *
+ ******************************************************************************/
+
+static void
+AcpiPsStopTrace (
+ ACPI_EVALUATE_INFO *Info)
+{
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
{
- Status = AE_NO_MEMORY;
- goto Cleanup2;
+ return;
}
- Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
- ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, NULL, 1);
- if (ACPI_FAILURE (Status))
+ if ((!AcpiGbl_TraceMethodName) ||
+ (AcpiGbl_TraceMethodName != Info->ResolvedNode->Name.Integer))
{
- goto Cleanup3;
+ goto Exit;
}
- /* Parse the AML */
+ /* Disable further tracing if type is one-shot */
- Status = AcpiPsParseAml (WalkState);
- AcpiPsDeleteParseTree (Op);
+ if (AcpiGbl_TraceFlags & 1)
+ {
+ AcpiGbl_TraceMethodName = 0;
+ AcpiGbl_TraceDbgLevel = 0;
+ AcpiGbl_TraceDbgLayer = 0;
+ }
+
+ AcpiDbgLevel = AcpiGbl_OriginalDbgLevel;
+ AcpiDbgLayer = AcpiGbl_OriginalDbgLayer;
+
+Exit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsExecuteMethod
+ *
+ * PARAMETERS: Info - Method info block, contains:
+ * Node - Method Node to execute
+ * ObjDesc - Method object
+ * Parameters - List of parameters to pass to the method,
+ * terminated by NULL. Params itself may be
+ * NULL if no parameters are being passed.
+ * ReturnObject - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * ParameterType - Type of Parameter list
+ * ReturnObject - Where to put method's return value (if
+ * any). If NULL, no value is returned.
+ * PassNumber - Parse or execute pass
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Execute a control method
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiPsExecuteMethod (
+ ACPI_EVALUATE_INFO *Info)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *Op;
+ ACPI_WALK_STATE *WalkState;
+
+
+ ACPI_FUNCTION_TRACE (PsExecuteMethod);
+
+
+ /* Validate the Info and method Node */
+
+ if (!Info || !Info->ResolvedNode)
+ {
+ return_ACPI_STATUS (AE_NULL_ENTRY);
+ }
+
+ /* Init for new method, wait on concurrency semaphore */
+
+ Status = AcpiDsBeginMethodExecution (Info->ResolvedNode, Info->ObjDesc, NULL);
if (ACPI_FAILURE (Status))
{
- goto Cleanup1; /* Walk state is already deleted */
+ return_ACPI_STATUS (Status);
}
/*
- * 2) Execute the method. Performs second pass parse simultaneously
+ * The caller "owns" the parameters, so give each one an extra reference
+ */
+ AcpiPsUpdateParameterList (Info, REF_INCREMENT);
+
+ /* Begin tracing if requested */
+
+ AcpiPsStartTrace (Info);
+
+ /*
+ * Execute the method. Performs parse simultaneously
*/
ACPI_DEBUG_PRINT ((ACPI_DB_PARSE,
- "**** Begin Method Execution **** Entry=%p obj=%p\n",
- Info->Node, ObjDesc));
+ "**** Begin Method Parse/Execute [%4.4s] **** Node=%p Obj=%p\n",
+ Info->ResolvedNode->Name.Ascii, Info->ResolvedNode, Info->ObjDesc));
/* Create and init a Root Node */
@@ -257,57 +370,47 @@
if (!Op)
{
Status = AE_NO_MEMORY;
- goto Cleanup1;
+ goto Cleanup;
}
- /* Init new op with the method name and pointer back to the NS node */
-
- AcpiPsSetName (Op, Info->Node->Name.Integer);
- Op->Common.Node = Info->Node;
-
/* Create and initialize a new walk state */
- WalkState = AcpiDsCreateWalkState (0, NULL, NULL, NULL);
+ Info->PassNumber = ACPI_IMODE_EXECUTE;
+ WalkState = AcpiDsCreateWalkState (
+ Info->ObjDesc->Method.OwnerId, NULL, NULL, NULL);
if (!WalkState)
{
Status = AE_NO_MEMORY;
- goto Cleanup2;
+ goto Cleanup;
}
- Status = AcpiDsInitAmlWalk (WalkState, Op, Info->Node,
- ObjDesc->Method.AmlStart,
- ObjDesc->Method.AmlLength, Info, 3);
+ Status = AcpiDsInitAmlWalk (WalkState, Op, Info->ResolvedNode,
+ Info->ObjDesc->Method.AmlStart,
+ Info->ObjDesc->Method.AmlLength, Info, Info->PassNumber);
if (ACPI_FAILURE (Status))
{
- goto Cleanup3;
+ AcpiDsDeleteWalkState (WalkState);
+ goto Cleanup;
}
- /*
- * The walk of the parse tree is where we actually execute the method
- */
- Status = AcpiPsParseAml (WalkState);
- goto Cleanup2; /* Walk state already deleted */
+ /* Parse the AML */
+ Status = AcpiPsParseAml (WalkState);
-Cleanup3:
- AcpiDsDeleteWalkState (WalkState);
+ /* WalkState was deleted by ParseAml */
-Cleanup2:
+Cleanup:
AcpiPsDeleteParseTree (Op);
-Cleanup1:
- if ((Info->ParameterType == ACPI_PARAM_ARGS) &&
- (Info->Parameters))
- {
- /* Take away the extra reference that we gave the parameters above */
+ /* End optional tracing */
- for (i = 0; Info->Parameters[i]; i++)
- {
- /* Ignore errors, just do them all */
+ AcpiPsStopTrace (Info);
- (void) AcpiUtUpdateObjectReference (Info->Parameters[i], REF_DECREMENT);
- }
- }
+ /* Take away the extra reference that we gave the parameters above */
+
+ AcpiPsUpdateParameterList (Info, REF_DECREMENT);
+
+ /* Exit now if error above */
if (ACPI_FAILURE (Status))
{
@@ -331,3 +434,40 @@
}
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiPsUpdateParameterList
+ *
+ * PARAMETERS: Info - See ACPI_EVALUATE_INFO
+ * (Used: ParameterType and Parameters)
+ * Action - Add or Remove reference
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Update reference count on all method parameter objects
+ *
+ ******************************************************************************/
+
+static void
+AcpiPsUpdateParameterList (
+ ACPI_EVALUATE_INFO *Info,
+ UINT16 Action)
+{
+ ACPI_NATIVE_UINT i;
+
+
+ if ((Info->ParameterType == ACPI_PARAM_ARGS) &&
+ (Info->Parameters))
+ {
+ /* Update reference count for each parameter */
+
+ for (i = 0; Info->Parameters[i]; i++)
+ {
+ /* Ignore errors, just do them all */
+
+ (void) AcpiUtUpdateObjectReference (Info->Parameters[i], Action);
+ }
+ }
+}
+
+
Index: hwregs.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/hwregs.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/hwregs.c -L sys/contrib/dev/acpica/hwregs.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/hwregs.c
+++ sys/contrib/dev/acpica/hwregs.c
@@ -3,7 +3,7 @@
*
* Module Name: hwregs - Read/write access functions for the various ACPI
* control and status registers.
- * $Revision: 162 $
+ * $Revision: 1.187 $
*
******************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,9 +130,9 @@
*
* FUNCTION: AcpiHwClearAcpiStatus
*
- * PARAMETERS: Flags - Lock the hardware or not
+ * PARAMETERS: None
*
- * RETURN: none
+ * RETURN: None
*
* DESCRIPTION: Clears all fixed and general purpose status bits
* THIS FUNCTION MUST BE CALLED WITH INTERRUPTS DISABLED
@@ -141,29 +141,24 @@
ACPI_STATUS
AcpiHwClearAcpiStatus (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags = 0;
- ACPI_FUNCTION_TRACE ("HwClearAcpiStatus");
+ ACPI_FUNCTION_TRACE (HwClearAcpiStatus);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %04X to %04X\n",
ACPI_BITMASK_ALL_FIXED_STATUS,
- (UINT16) ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm1aEvtBlk.Address)));
+ (UINT16) AcpiGbl_FADT.XPm1aEventBlock.Address));
- if (Flags & ACPI_MTX_LOCK)
- {
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
- Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK, ACPI_REGISTER_PM1_STATUS,
- ACPI_BITMASK_ALL_FIXED_STATUS);
+ Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_STATUS,
+ ACPI_BITMASK_ALL_FIXED_STATUS);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -171,10 +166,10 @@
/* Clear the fixed events */
- if (ACPI_VALID_ADDRESS (AcpiGbl_FADT->XPm1bEvtBlk.Address))
+ if (AcpiGbl_FADT.XPm1bEventBlock.Address)
{
Status = AcpiHwLowLevelWrite (16, ACPI_BITMASK_ALL_FIXED_STATUS,
- &AcpiGbl_FADT->XPm1bEvtBlk);
+ &AcpiGbl_FADT.XPm1bEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -183,13 +178,10 @@
/* Clear the GPE Bits in all GPE registers in all GPE blocks */
- Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, ACPI_ISR);
+ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
UnlockAndExit:
- if (Flags & ACPI_MTX_LOCK)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
- }
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
return_ACPI_STATUS (Status);
}
@@ -216,90 +208,113 @@
UINT8 *SleepTypeB)
{
ACPI_STATUS Status = AE_OK;
- ACPI_PARAMETER_INFO Info;
+ ACPI_EVALUATE_INFO *Info;
- ACPI_FUNCTION_TRACE ("AcpiGetSleepTypeData");
+ ACPI_FUNCTION_TRACE (AcpiGetSleepTypeData);
- /*
- * Validate parameters
- */
+ /* Validate parameters */
+
if ((SleepState > ACPI_S_STATES_MAX) ||
!SleepTypeA || !SleepTypeB)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /*
- * Evaluate the namespace object containing the values for this state
- */
- Info.Parameters = NULL;
- Status = AcpiNsEvaluateByName ((char *) (uintptr_t) AcpiGbl_SleepStateNames[SleepState],
- &Info);
+ /* Allocate the evaluation information block */
+
+ Info = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_EVALUATE_INFO));
+ if (!Info)
+ {
+ return_ACPI_STATUS (AE_NO_MEMORY);
+ }
+
+ Info->Pathname = ACPI_CAST_PTR (char, AcpiGbl_SleepStateNames[SleepState]);
+
+ /* Evaluate the namespace object containing the values for this state */
+
+ Status = AcpiNsEvaluate (Info);
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "%s while evaluating SleepState [%s]\n",
- AcpiFormatException (Status), AcpiGbl_SleepStateNames[SleepState]));
+ ACPI_DEBUG_PRINT ((ACPI_DB_EXEC,
+ "%s while evaluating SleepState [%s]\n",
+ AcpiFormatException (Status), Info->Pathname));
- return_ACPI_STATUS (Status);
+ goto Cleanup;
}
/* Must have a return object */
- if (!Info.ReturnObject)
+ if (!Info->ReturnObject)
{
- ACPI_REPORT_ERROR (("Missing Sleep State object\n"));
+ ACPI_ERROR ((AE_INFO, "No Sleep State object returned from [%s]",
+ Info->Pathname));
Status = AE_NOT_EXIST;
}
/* It must be of type Package */
- else if (ACPI_GET_OBJECT_TYPE (Info.ReturnObject) != ACPI_TYPE_PACKAGE)
+ else if (ACPI_GET_OBJECT_TYPE (Info->ReturnObject) != ACPI_TYPE_PACKAGE)
{
- ACPI_REPORT_ERROR (("Sleep State object not a Package\n"));
+ ACPI_ERROR ((AE_INFO, "Sleep State return object is not a Package"));
Status = AE_AML_OPERAND_TYPE;
}
- /* The package must have at least two elements */
-
- else if (Info.ReturnObject->Package.Count < 2)
+ /*
+ * The package must have at least two elements. NOTE (March 2005): This
+ * goes against the current ACPI spec which defines this object as a
+ * package with one encoded DWORD element. However, existing practice
+ * by BIOS vendors seems to be to have 2 or more elements, at least
+ * one per sleep type (A/B).
+ */
+ else if (Info->ReturnObject->Package.Count < 2)
{
- ACPI_REPORT_ERROR (("Sleep State package does not have at least two elements\n"));
+ ACPI_ERROR ((AE_INFO,
+ "Sleep State return package does not have at least two elements"));
Status = AE_AML_NO_OPERAND;
}
/* The first two elements must both be of type Integer */
- else if ((ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[0]) != ACPI_TYPE_INTEGER) ||
- (ACPI_GET_OBJECT_TYPE (Info.ReturnObject->Package.Elements[1]) != ACPI_TYPE_INTEGER))
- {
- ACPI_REPORT_ERROR (("Sleep State package elements are not both Integers (%s, %s)\n",
- AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[0]),
- AcpiUtGetObjectTypeName (Info.ReturnObject->Package.Elements[1])));
+ else if ((ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[0])
+ != ACPI_TYPE_INTEGER) ||
+ (ACPI_GET_OBJECT_TYPE (Info->ReturnObject->Package.Elements[1])
+ != ACPI_TYPE_INTEGER))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Sleep State return package elements are not both Integers (%s, %s)",
+ AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[0]),
+ AcpiUtGetObjectTypeName (Info->ReturnObject->Package.Elements[1])));
Status = AE_AML_OPERAND_TYPE;
}
else
{
- /*
- * Valid _Sx_ package size, type, and value
- */
- *SleepTypeA = (UINT8) (Info.ReturnObject->Package.Elements[0])->Integer.Value;
- *SleepTypeB = (UINT8) (Info.ReturnObject->Package.Elements[1])->Integer.Value;
+ /* Valid _Sx_ package size, type, and value */
+
+ *SleepTypeA = (UINT8)
+ (Info->ReturnObject->Package.Elements[0])->Integer.Value;
+ *SleepTypeB = (UINT8)
+ (Info->ReturnObject->Package.Elements[1])->Integer.Value;
}
if (ACPI_FAILURE (Status))
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "While evaluating SleepState [%s], bad Sleep object %p type %s\n",
- AcpiGbl_SleepStateNames[SleepState], Info.ReturnObject,
- AcpiUtGetObjectTypeName (Info.ReturnObject)));
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While evaluating SleepState [%s], bad Sleep object %p type %s",
+ Info->Pathname, Info->ReturnObject,
+ AcpiUtGetObjectTypeName (Info->ReturnObject)));
}
- AcpiUtRemoveReference (Info.ReturnObject);
+ AcpiUtRemoveReference (Info->ReturnObject);
+
+Cleanup:
+ ACPI_FREE (Info);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetSleepTypeData)
+
/*******************************************************************************
*
@@ -307,9 +322,9 @@
*
* PARAMETERS: RegisterId - Index of ACPI Register to access
*
- * RETURN: The bit mask to be used when accessing the register
+ * RETURN: The bitmask to be used when accessing the register
*
- * DESCRIPTION: Map RegisterId into a register bit mask.
+ * DESCRIPTION: Map RegisterId into a register bitmask.
*
******************************************************************************/
@@ -317,12 +332,12 @@
AcpiHwGetBitRegisterInfo (
UINT32 RegisterId)
{
- ACPI_FUNCTION_NAME ("HwGetBitRegisterInfo");
+ ACPI_FUNCTION_ENTRY ();
if (RegisterId > ACPI_BITREG_MAX)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid BitRegister ID: %X\n", RegisterId));
+ ACPI_ERROR ((AE_INFO, "Invalid BitRegister ID: %X", RegisterId));
return (NULL);
}
@@ -336,9 +351,8 @@
*
* PARAMETERS: RegisterId - ID of ACPI BitRegister to access
* ReturnValue - Value that was read from the register
- * Flags - Lock the hardware or not
*
- * RETURN: Status and the value read from specified Register. Value
+ * RETURN: Status and the value read from specified Register. Value
* returned is normalized to bit0 (is shifted all the way right)
*
* DESCRIPTION: ACPI BitRegister read function.
@@ -348,15 +362,14 @@
ACPI_STATUS
AcpiGetRegister (
UINT32 RegisterId,
- UINT32 *ReturnValue,
- UINT32 Flags)
+ UINT32 *ReturnValue)
{
UINT32 RegisterValue = 0;
ACPI_BIT_REGISTER_INFO *BitRegInfo;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiGetRegister");
+ ACPI_FUNCTION_TRACE (AcpiGetRegister);
/* Get the info structure corresponding to the requested ACPI Register */
@@ -367,24 +380,10 @@
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (Flags & ACPI_MTX_LOCK)
- {
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
-
/* Read from the register */
- Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
- BitRegInfo->ParentRegister, &RegisterValue);
-
- if (Flags & ACPI_MTX_LOCK)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
- }
+ Status = AcpiHwRegisterRead (ACPI_MTX_LOCK,
+ BitRegInfo->ParentRegister, &RegisterValue);
if (ACPI_SUCCESS (Status))
{
@@ -396,12 +395,14 @@
*ReturnValue = RegisterValue;
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read value %8.8X register %X\n",
- RegisterValue, BitRegInfo->ParentRegister));
+ RegisterValue, BitRegInfo->ParentRegister));
}
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiGetRegister)
+
/*******************************************************************************
*
@@ -410,7 +411,6 @@
* PARAMETERS: RegisterId - ID of ACPI BitRegister to access
* Value - (only used on write) value to write to the
* Register, NOT pre-normalized to the bit pos
- * Flags - Lock the hardware or not
*
* RETURN: Status
*
@@ -421,15 +421,15 @@
ACPI_STATUS
AcpiSetRegister (
UINT32 RegisterId,
- UINT32 Value,
- UINT32 Flags)
+ UINT32 Value)
{
UINT32 RegisterValue = 0;
ACPI_BIT_REGISTER_INFO *BitRegInfo;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags;
- ACPI_FUNCTION_TRACE_U32 ("AcpiSetRegister", RegisterId);
+ ACPI_FUNCTION_TRACE_U32 (AcpiSetRegister, RegisterId);
/* Get the info structure corresponding to the requested ACPI Register */
@@ -437,23 +437,16 @@
BitRegInfo = AcpiHwGetBitRegisterInfo (RegisterId);
if (!BitRegInfo)
{
- ACPI_REPORT_ERROR (("Bad ACPI HW RegisterId: %X\n", RegisterId));
+ ACPI_ERROR ((AE_INFO, "Bad ACPI HW RegisterId: %X", RegisterId));
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- if (Flags & ACPI_MTX_LOCK)
- {
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
/* Always do a register read first so we can insert the new bits */
Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
- BitRegInfo->ParentRegister, &RegisterValue);
+ BitRegInfo->ParentRegister, &RegisterValue);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -471,8 +464,8 @@
case ACPI_REGISTER_PM1_STATUS:
/*
- * Status Registers are different from the rest. Clear by
- * writing 1, and writing 0 has no effect. So, the only relevant
+ * Status Registers are different from the rest. Clear by
+ * writing 1, and writing 0 has no effect. So, the only relevant
* information is the single bit we're interested in, all others should
* be written as 0 so they will be left unchanged.
*/
@@ -490,10 +483,10 @@
case ACPI_REGISTER_PM1_ENABLE:
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
- BitRegInfo->AccessBitMask, Value);
+ BitRegInfo->AccessBitMask, Value);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
+ ACPI_REGISTER_PM1_ENABLE, (UINT16) RegisterValue);
break;
@@ -504,13 +497,14 @@
* Note that at this level, the fact that there are actually TWO
* registers (A and B - and B may not exist) is abstracted.
*/
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n", RegisterValue));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM1 control: Read %X\n",
+ RegisterValue));
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
- BitRegInfo->AccessBitMask, Value);
+ BitRegInfo->AccessBitMask, Value);
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
+ ACPI_REGISTER_PM1_CONTROL, (UINT16) RegisterValue);
break;
@@ -525,17 +519,17 @@
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "PM2 control: Read %X from %8.8X%8.8X\n",
RegisterValue,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))));
+ ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address)));
ACPI_REGISTER_INSERT_VALUE (RegisterValue, BitRegInfo->BitPosition,
BitRegInfo->AccessBitMask, Value);
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "About to write %4.4X to %8.8X%8.8X\n",
RegisterValue,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (AcpiGbl_FADT->XPm2CntBlk.Address))));
+ ACPI_FORMAT_UINT64 (AcpiGbl_FADT.XPm2ControlBlock.Address)));
Status = AcpiHwRegisterWrite (ACPI_MTX_DO_NOT_LOCK,
- ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
+ ACPI_REGISTER_PM2_CONTROL, (UINT8) (RegisterValue));
break;
@@ -546,33 +540,33 @@
UnlockAndExit:
- if (Flags & ACPI_MTX_LOCK)
- {
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
- }
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
/* Normalize the value that was read */
- ACPI_DEBUG_EXEC (RegisterValue = ((RegisterValue & BitRegInfo->AccessBitMask) >> BitRegInfo->BitPosition));
+ ACPI_DEBUG_EXEC (RegisterValue =
+ ((RegisterValue & BitRegInfo->AccessBitMask) >>
+ BitRegInfo->BitPosition));
ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Set bits: %8.8X actual %8.8X register %X\n",
- Value, RegisterValue, BitRegInfo->ParentRegister));
+ Value, RegisterValue, BitRegInfo->ParentRegister));
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiSetRegister)
+
/******************************************************************************
*
* FUNCTION: AcpiHwRegisterRead
*
- * PARAMETERS: UseLock - Mutex hw access
- * RegisterId - RegisterID + Offset
- * ReturnValue - Value that was read from the register
+ * PARAMETERS: UseLock - Lock hardware? True/False
+ * RegisterId - ACPI Register ID
+ * ReturnValue - Where the register value is returned
*
* RETURN: Status and the value read.
*
- * DESCRIPTION: Acpi register read function. Registers are read at the
- * given offset.
+ * DESCRIPTION: Read from the specified ACPI register
*
******************************************************************************/
@@ -585,25 +579,22 @@
UINT32 Value1 = 0;
UINT32 Value2 = 0;
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags = 0;
- ACPI_FUNCTION_TRACE ("HwRegisterRead");
+ ACPI_FUNCTION_TRACE (HwRegisterRead);
if (ACPI_MTX_LOCK == UseLock)
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
}
switch (RegisterId)
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
- Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aEvtBlk);
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -611,7 +602,7 @@
/* PM1B is optional */
- Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bEvtBlk);
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bEventBlock);
Value1 |= Value2;
break;
@@ -633,35 +624,36 @@
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT->XPm1aCntBlk);
+ Status = AcpiHwLowLevelRead (16, &Value1, &AcpiGbl_FADT.XPm1aControlBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT->XPm1bCntBlk);
+ Status = AcpiHwLowLevelRead (16, &Value2, &AcpiGbl_FADT.XPm1bControlBlock);
Value1 |= Value2;
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT->XPm2CntBlk);
+ Status = AcpiHwLowLevelRead (8, &Value1, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT->XPmTmrBlk);
+ Status = AcpiHwLowLevelRead (32, &Value1, &AcpiGbl_FADT.XPmTimerBlock);
break;
case ACPI_REGISTER_SMI_COMMAND_BLOCK: /* 8-bit access */
- Status = AcpiOsReadPort (AcpiGbl_FADT->SmiCmd, &Value1, 8);
+ Status = AcpiOsReadPort (AcpiGbl_FADT.SmiCommand, &Value1, 8);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unknown Register ID: %X\n", RegisterId));
+ ACPI_ERROR ((AE_INFO, "Unknown Register ID: %X",
+ RegisterId));
Status = AE_BAD_PARAMETER;
break;
}
@@ -669,7 +661,7 @@
UnlockAndExit:
if (ACPI_MTX_LOCK == UseLock)
{
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
}
if (ACPI_SUCCESS (Status))
@@ -685,14 +677,26 @@
*
* FUNCTION: AcpiHwRegisterWrite
*
- * PARAMETERS: UseLock - Mutex hw access
- * RegisterId - RegisterID + Offset
+ * PARAMETERS: UseLock - Lock hardware? True/False
+ * RegisterId - ACPI Register ID
* Value - The value to write
*
* RETURN: Status
*
- * DESCRIPTION: Acpi register Write function. Registers are written at the
- * given offset.
+ * DESCRIPTION: Write to the specified ACPI register
+ *
+ * NOTE: In accordance with the ACPI specification, this function automatically
+ * preserves the value of the following bits, meaning that these bits cannot be
+ * changed via this interface:
+ *
+ * PM1_CONTROL[0] = SCI_EN
+ * PM1_CONTROL[9]
+ * PM1_STATUS[11]
+ *
+ * ACPI References:
+ * 1) Hardware Ignored Bits: When software writes to a register with ignored
+ * bit fields, it preserves the ignored bit fields
+ * 2) SCI_EN: OSPM always preserves this bit position
*
******************************************************************************/
@@ -703,25 +707,38 @@
UINT32 Value)
{
ACPI_STATUS Status;
+ ACPI_CPU_FLAGS LockFlags = 0;
+ UINT32 ReadValue;
- ACPI_FUNCTION_TRACE ("HwRegisterWrite");
+ ACPI_FUNCTION_TRACE (HwRegisterWrite);
if (ACPI_MTX_LOCK == UseLock)
{
- Status = AcpiUtAcquireMutex (ACPI_MTX_HARDWARE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
+ LockFlags = AcpiOsAcquireLock (AcpiGbl_HardwareLock);
}
switch (RegisterId)
{
case ACPI_REGISTER_PM1_STATUS: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aEvtBlk);
+ /* Perform a read first to preserve certain bits (per ACPI spec) */
+
+ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_STATUS, &ReadValue);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Insert the bits to be preserved */
+
+ ACPI_INSERT_BITS (Value, ACPI_PM1_STATUS_PRESERVED_BITS, ReadValue);
+
+ /* Now we can write the data */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aEventBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
@@ -729,11 +746,11 @@
/* PM1B is optional */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bEvtBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bEventBlock);
break;
- case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access*/
+ case ACPI_REGISTER_PM1_ENABLE: /* 16-bit access */
Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_XPm1aEnable);
if (ACPI_FAILURE (Status))
@@ -749,37 +766,55 @@
case ACPI_REGISTER_PM1_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
+ /*
+ * Perform a read first to preserve certain bits (per ACPI spec)
+ *
+ * Note: This includes SCI_EN, we never want to change this bit
+ */
+ Status = AcpiHwRegisterRead (ACPI_MTX_DO_NOT_LOCK,
+ ACPI_REGISTER_PM1_CONTROL, &ReadValue);
+ if (ACPI_FAILURE (Status))
+ {
+ goto UnlockAndExit;
+ }
+
+ /* Insert the bits to be preserved */
+
+ ACPI_INSERT_BITS (Value, ACPI_PM1_CONTROL_PRESERVED_BITS, ReadValue);
+
+ /* Now we can write the data */
+
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock);
if (ACPI_FAILURE (Status))
{
goto UnlockAndExit;
}
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
break;
case ACPI_REGISTER_PM1A_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1aCntBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1aControlBlock);
break;
case ACPI_REGISTER_PM1B_CONTROL: /* 16-bit access */
- Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT->XPm1bCntBlk);
+ Status = AcpiHwLowLevelWrite (16, Value, &AcpiGbl_FADT.XPm1bControlBlock);
break;
case ACPI_REGISTER_PM2_CONTROL: /* 8-bit access */
- Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT->XPm2CntBlk);
+ Status = AcpiHwLowLevelWrite (8, Value, &AcpiGbl_FADT.XPm2ControlBlock);
break;
case ACPI_REGISTER_PM_TIMER: /* 32-bit access */
- Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT->XPmTmrBlk);
+ Status = AcpiHwLowLevelWrite (32, Value, &AcpiGbl_FADT.XPmTimerBlock);
break;
@@ -787,7 +822,7 @@
/* SMI_CMD is currently always in IO space */
- Status = AcpiOsWritePort (AcpiGbl_FADT->SmiCmd, Value, 8);
+ Status = AcpiOsWritePort (AcpiGbl_FADT.SmiCommand, Value, 8);
break;
@@ -799,7 +834,7 @@
UnlockAndExit:
if (ACPI_MTX_LOCK == UseLock)
{
- (void) AcpiUtReleaseMutex (ACPI_MTX_HARDWARE);
+ AcpiOsReleaseLock (AcpiGbl_HardwareLock, LockFlags);
}
return_ACPI_STATUS (Status);
@@ -830,7 +865,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("HwLowLevelRead");
+ ACPI_FUNCTION_NAME (HwLowLevelRead);
/*
@@ -843,10 +878,10 @@
return (AE_OK);
}
- /* Get a local copy of the address. Handles possible alignment issues */
+ /* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
- if (!ACPI_VALID_ADDRESS (Address))
+ if (!Address)
{
return (AE_OK);
}
@@ -856,33 +891,31 @@
* Two address spaces supported: Memory or IO.
* PCI_Config is not supported here because the GAS struct is insufficient
*/
- switch (Reg->AddressSpaceId)
+ switch (Reg->SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Status = AcpiOsReadMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, Value, Width);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ ACPI_ERROR ((AE_INFO,
+ "Unsupported address space: %X", Reg->SpaceId));
return (AE_BAD_PARAMETER);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
- *Value, Width,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)),
- AcpiUtGetRegionName (Reg->AddressSpaceId)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO,
+ "Read: %8.8X width %2d from %8.8X%8.8X (%s)\n",
+ *Value, Width, ACPI_FORMAT_UINT64 (Address),
+ AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
}
@@ -912,7 +945,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_NAME ("HwLowLevelWrite");
+ ACPI_FUNCTION_NAME (HwLowLevelWrite);
/*
@@ -925,10 +958,10 @@
return (AE_OK);
}
- /* Get a local copy of the address. Handles possible alignment issues */
+ /* Get a local copy of the address. Handles possible alignment issues */
ACPI_MOVE_64_TO_64 (&Address, &Reg->Address);
- if (!ACPI_VALID_ADDRESS (Address))
+ if (!Address)
{
return (AE_OK);
}
@@ -937,33 +970,32 @@
* Two address spaces supported: Memory or IO.
* PCI_Config is not supported here because the GAS struct is insufficient
*/
- switch (Reg->AddressSpaceId)
+ switch (Reg->SpaceId)
{
case ACPI_ADR_SPACE_SYSTEM_MEMORY:
Status = AcpiOsWriteMemory (
- (ACPI_PHYSICAL_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ (ACPI_PHYSICAL_ADDRESS) Address, Value, Width);
break;
case ACPI_ADR_SPACE_SYSTEM_IO:
- Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) ACPI_GET_ADDRESS (Address),
- Value, Width);
+ Status = AcpiOsWritePort (
+ (ACPI_IO_ADDRESS) Address, Value, Width);
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "Unsupported address space: %X\n", Reg->AddressSpaceId));
+ ACPI_ERROR ((AE_INFO,
+ "Unsupported address space: %X", Reg->SpaceId));
return (AE_BAD_PARAMETER);
}
- ACPI_DEBUG_PRINT ((ACPI_DB_IO, "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
- Value, Width,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (Address)),
- AcpiUtGetRegionName (Reg->AddressSpaceId)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_IO,
+ "Wrote: %8.8X width %2d to %8.8X%8.8X (%s)\n",
+ Value, Width, ACPI_FORMAT_UINT64 (Address),
+ AcpiUtGetRegionName (Reg->SpaceId)));
return (Status);
}
Index: acmacros.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acmacros.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acmacros.h -L sys/contrib/dev/acpica/acmacros.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acmacros.h
+++ sys/contrib/dev/acpica/acmacros.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acmacros.h - C macros for the entire subsystem.
- * $Revision: 154 $
+ * $Revision: 1.195 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -128,46 +128,20 @@
#define ACPI_SET_BIT(target,bit) ((target) |= (bit))
#define ACPI_CLEAR_BIT(target,bit) ((target) &= ~(bit))
+#define ACPI_MIN(a,b) (((a)<(b))?(a):(b))
+#define ACPI_MAX(a,b) (((a)>(b))?(a):(b))
+/* Size calculation */
-#if ACPI_MACHINE_WIDTH == 16
+#define ACPI_ARRAY_LENGTH(x) (sizeof(x) / sizeof((x)[0]))
-/*
- * For 16-bit addresses, we have to assume that the upper 32 bits
- * are zero.
- */
-#define ACPI_LODWORD(l) ((UINT32)(l))
-#define ACPI_HIDWORD(l) ((UINT32)(0))
-
-#define ACPI_GET_ADDRESS(a) ((a).Lo)
-#define ACPI_STORE_ADDRESS(a,b) {(a).Hi=0;(a).Lo=(UINT32)(b);}
-#define ACPI_VALID_ADDRESS(a) ((a).Hi | (a).Lo)
-#else
-#ifdef ACPI_NO_INTEGER64_SUPPORT
/*
- * ACPI_INTEGER is 32-bits, no 64-bit support on this platform
- */
-#define ACPI_LODWORD(l) ((UINT32)(l))
-#define ACPI_HIDWORD(l) ((UINT32)(0))
-
-#define ACPI_GET_ADDRESS(a) (a)
-#define ACPI_STORE_ADDRESS(a,b) ((a)=(b))
-#define ACPI_VALID_ADDRESS(a) (a)
-
-#else
-
-/*
- * Full 64-bit address/integer on both 32-bit and 64-bit platforms
+ * Full 64-bit integer must be available on both 32-bit and 64-bit platforms
*/
#define ACPI_LODWORD(l) ((UINT32)(UINT64)(l))
#define ACPI_HIDWORD(l) ((UINT32)(((*(UINT64_STRUCT *)(void *)(&l))).Hi))
-#define ACPI_GET_ADDRESS(a) (a)
-#define ACPI_STORE_ADDRESS(a,b) ((a)=(ACPI_PHYSICAL_ADDRESS)(b))
-#define ACPI_VALID_ADDRESS(a) (a)
-#endif
-#endif
/*
* printf() format helpers
@@ -178,33 +152,39 @@
#define ACPI_FORMAT_UINT64(i) ACPI_HIDWORD(i),ACPI_LODWORD(i)
/*
- * Extract a byte of data using a pointer. Any more than a byte and we
- * get into potential aligment issues -- see the STORE macros below
- */
-#define ACPI_GET8(addr) (*(UINT8*)(addr))
-
-/* Pointer arithmetic */
-
-#define ACPI_PTR_ADD(t,a,b) (t *) (void *)((char *)(a) + (ACPI_NATIVE_UINT)(b))
-#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) ((char *)(a) - (char *)(b))
+ * Extract data using a pointer. Any more than a byte and we
+ * get into potential aligment issues -- see the STORE macros below.
+ * Use with care.
+ */
+#define ACPI_GET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
+#define ACPI_GET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
+#define ACPI_GET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
+#define ACPI_GET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
+#define ACPI_SET8(ptr) *ACPI_CAST_PTR (UINT8, ptr)
+#define ACPI_SET16(ptr) *ACPI_CAST_PTR (UINT16, ptr)
+#define ACPI_SET32(ptr) *ACPI_CAST_PTR (UINT32, ptr)
+#define ACPI_SET64(ptr) *ACPI_CAST_PTR (UINT64, ptr)
+
+/*
+ * Pointer manipulation
+ */
+#define ACPI_CAST_PTR(t, p) ((t *) (ACPI_UINTPTR_T) (p))
+#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **) (ACPI_UINTPTR_T) (p))
+#define ACPI_ADD_PTR(t,a,b) ACPI_CAST_PTR (t, (ACPI_CAST_PTR (UINT8,(a)) + (ACPI_NATIVE_UINT)(b)))
+#define ACPI_PTR_DIFF(a,b) (ACPI_NATIVE_UINT) (ACPI_CAST_PTR (UINT8,(a)) - ACPI_CAST_PTR (UINT8,(b)))
/* Pointer/Integer type conversions */
-#define ACPI_TO_POINTER(i) ACPI_PTR_ADD (void, (void *) NULL,(ACPI_NATIVE_UINT)i)
+#define ACPI_TO_POINTER(i) ACPI_ADD_PTR (void,(void *) NULL,(ACPI_NATIVE_UINT) i)
#define ACPI_TO_INTEGER(p) ACPI_PTR_DIFF (p,(void *) NULL)
#define ACPI_OFFSET(d,f) (ACPI_SIZE) ACPI_PTR_DIFF (&(((d *)0)->f),(void *) NULL)
-#define ACPI_FADT_OFFSET(f) ACPI_OFFSET (FADT_DESCRIPTOR, f)
-
-#define ACPI_CAST_PTR(t, p) ((t *)(void *)(p))
-#define ACPI_CAST_INDIRECT_PTR(t, p) ((t **)(void *)(p))
-
-#if ACPI_MACHINE_WIDTH == 16
-#define ACPI_STORE_POINTER(d,s) ACPI_MOVE_32_TO_32(d,s)
-#define ACPI_PHYSADDR_TO_PTR(i) (void *)(i)
-#define ACPI_PTR_TO_PHYSADDR(i) (UINT32) (char *)(i)
-#else
#define ACPI_PHYSADDR_TO_PTR(i) ACPI_TO_POINTER(i)
#define ACPI_PTR_TO_PHYSADDR(i) ACPI_TO_INTEGER(i)
+
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#define ACPI_COMPARE_NAME(a,b) (*ACPI_CAST_PTR (UINT32,(a)) == *ACPI_CAST_PTR (UINT32,(b)))
+#else
+#define ACPI_COMPARE_NAME(a,b) (!ACPI_STRNCMP (ACPI_CAST_PTR (char,(a)), ACPI_CAST_PTR (char,(b)), ACPI_NAME_SIZE))
#endif
/*
@@ -276,32 +256,10 @@
#define ACPI_BUFFER_INDEX(BufLen,BufOffset,ByteGran) (BufOffset)
-#ifdef ACPI_MISALIGNED_TRANSFERS
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
/* The hardware supports unaligned transfers, just do the little-endian move */
-#if ACPI_MACHINE_WIDTH == 16
-
-/* No 64-bit integers */
-/* 16-bit source, 16/32/64 destination */
-
-#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
-#define ACPI_MOVE_16_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT16 *)(void *)(s)
-#define ACPI_MOVE_16_TO_64(d,s) ACPI_MOVE_16_TO_32(d,s)
-
-/* 32-bit source, 16/32/64 destination */
-
-#define ACPI_MOVE_32_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
-#define ACPI_MOVE_32_TO_32(d,s) *(UINT32 *)(void *)(d) = *(UINT32 *)(void *)(s)
-#define ACPI_MOVE_32_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
-
-/* 64-bit source, 16/32/64 destination */
-
-#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
-#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
-#define ACPI_MOVE_64_TO_64(d,s) ACPI_MOVE_32_TO_32(d,s)
-
-#else
/* 16-bit source, 16/32/64 destination */
#define ACPI_MOVE_16_TO_16(d,s) *(UINT16 *)(void *)(d) = *(UINT16 *)(void *)(s)
@@ -319,7 +277,6 @@
#define ACPI_MOVE_64_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s) /* Truncate to 16 */
#define ACPI_MOVE_64_TO_32(d,s) ACPI_MOVE_32_TO_32(d,s) /* Truncate to 32 */
#define ACPI_MOVE_64_TO_64(d,s) *(UINT64 *)(void *)(d) = *(UINT64 *)(void *)(s)
-#endif
#else
/*
@@ -364,10 +321,7 @@
/* Macros based on machine integer width */
-#if ACPI_MACHINE_WIDTH == 16
-#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_16_TO_16(d,s)
-
-#elif ACPI_MACHINE_WIDTH == 32
+#if ACPI_MACHINE_WIDTH == 32
#define ACPI_MOVE_SIZE_TO_16(d,s) ACPI_MOVE_32_TO_16(d,s)
#elif ACPI_MACHINE_WIDTH == 64
@@ -401,30 +355,40 @@
#define ACPI_MUL_16(a) _ACPI_MUL(a,4)
#define ACPI_MOD_16(a) _ACPI_MOD(a,16)
+#define ACPI_DIV_32(a) _ACPI_DIV(a,5)
+#define ACPI_MUL_32(a) _ACPI_MUL(a,5)
+#define ACPI_MOD_32(a) _ACPI_MOD(a,32)
/*
* Rounding macros (Power of two boundaries only)
*/
-#define ACPI_ROUND_DOWN(value,boundary) (((ACPI_NATIVE_UINT)(value)) & (~(((ACPI_NATIVE_UINT) boundary)-1)))
-#define ACPI_ROUND_UP(value,boundary) ((((ACPI_NATIVE_UINT)(value)) + (((ACPI_NATIVE_UINT) boundary)-1)) & (~(((ACPI_NATIVE_UINT) boundary)-1)))
+#define ACPI_ROUND_DOWN(value,boundary) (((ACPI_NATIVE_UINT)(value)) & \
+ (~(((ACPI_NATIVE_UINT) boundary)-1)))
+
+#define ACPI_ROUND_UP(value,boundary) ((((ACPI_NATIVE_UINT)(value)) + \
+ (((ACPI_NATIVE_UINT) boundary)-1)) & \
+ (~(((ACPI_NATIVE_UINT) boundary)-1)))
-#define ACPI_ROUND_DOWN_TO_32_BITS(a) ACPI_ROUND_DOWN(a,4)
-#define ACPI_ROUND_DOWN_TO_64_BITS(a) ACPI_ROUND_DOWN(a,8)
-#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,ALIGNED_ADDRESS_BOUNDARY)
+/* Note: sizeof(ACPI_NATIVE_UINT) evaluates to either 2, 4, or 8 */
-#define ACPI_ROUND_UP_TO_32BITS(a) ACPI_ROUND_UP(a,4)
-#define ACPI_ROUND_UP_TO_64BITS(a) ACPI_ROUND_UP(a,8)
-#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,ALIGNED_ADDRESS_BOUNDARY)
+#define ACPI_ROUND_DOWN_TO_32BIT(a) ACPI_ROUND_DOWN(a,4)
+#define ACPI_ROUND_DOWN_TO_64BIT(a) ACPI_ROUND_DOWN(a,8)
+#define ACPI_ROUND_DOWN_TO_NATIVE_WORD(a) ACPI_ROUND_DOWN(a,sizeof(ACPI_NATIVE_UINT))
+#define ACPI_ROUND_UP_TO_32BIT(a) ACPI_ROUND_UP(a,4)
+#define ACPI_ROUND_UP_TO_64BIT(a) ACPI_ROUND_UP(a,8)
+#define ACPI_ROUND_UP_TO_NATIVE_WORD(a) ACPI_ROUND_UP(a,sizeof(ACPI_NATIVE_UINT))
-#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
-#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
+#define ACPI_ROUND_BITS_UP_TO_BYTES(a) ACPI_DIV_8((a) + 7)
+#define ACPI_ROUND_BITS_DOWN_TO_BYTES(a) ACPI_DIV_8((a))
-#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
+#define ACPI_ROUND_UP_TO_1K(a) (((a) + 1023) >> 10)
/* Generic (non-power-of-two) rounding */
-#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
+#define ACPI_ROUND_UP_TO(value,boundary) (((value) + ((boundary)-1)) / (boundary))
+
+#define ACPI_IS_MISALIGNED(value) (((ACPI_NATIVE_UINT)value) & (sizeof(ACPI_NATIVE_UINT)-1))
/*
* Bitmask creation
@@ -432,10 +396,10 @@
* MASK_BITS_ABOVE creates a mask starting AT the position and above
* MASK_BITS_BELOW creates a mask starting one bit BELOW the position
*/
-#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position))))
-#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position)))
+#define ACPI_MASK_BITS_ABOVE(position) (~((ACPI_INTEGER_MAX) << ((UINT32) (position))))
+#define ACPI_MASK_BITS_BELOW(position) ((ACPI_INTEGER_MAX) << ((UINT32) (position)))
-#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
+#define ACPI_IS_OCTAL_DIGIT(d) (((char)(d) >= '0') && ((char)(d) <= '7'))
/* Bitfields within ACPI registers */
@@ -443,6 +407,16 @@
#define ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask) ((Val << Pos) & Mask)
#define ACPI_REGISTER_INSERT_VALUE(Reg, Pos, Mask, Val) Reg = (Reg & (~(Mask))) | ACPI_REGISTER_PREPARE_BITS(Val, Pos, Mask)
+#define ACPI_INSERT_BITS(Target, Mask, Source) Target = ((Target & (~(Mask))) | (Source & Mask))
+
+/* Generate a UUID */
+
+#define ACPI_INIT_UUID(a,b,c,d0,d1,d2,d3,d4,d5,d6,d7) \
+ (a) & 0xFF, ((a) >> 8) & 0xFF, ((a) >> 16) & 0xFF, ((a) >> 24) & 0xFF, \
+ (b) & 0xFF, ((b) >> 8) & 0xFF, \
+ (c) & 0xFF, ((c) >> 8) & 0xFF, \
+ (d0), (d1), (d2), (d3), (d4), (d5), (d6), (d7)
+
/*
* An ACPI_NAMESPACE_NODE * can appear in some contexts,
* where a pointer to an ACPI_OPERAND_OBJECT can also
@@ -450,8 +424,8 @@
*
* The "Descriptor" field is the first field in both structures.
*/
-#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId)
-#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->DescriptorId = t)
+#define ACPI_GET_DESCRIPTOR_TYPE(d) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType)
+#define ACPI_SET_DESCRIPTOR_TYPE(d,t) (((ACPI_DESCRIPTOR *)(void *)(d))->Common.DescriptorType = t)
/* Macro to test the object type */
@@ -503,85 +477,105 @@
#define INCREMENT_ARG_LIST(List) (List >>= ((UINT32) ARG_TYPE_WIDTH))
+#if defined (ACPI_DEBUG_OUTPUT) || !defined (ACPI_NO_ERROR_MESSAGES)
/*
- * Reporting macros that are never compiled out
+ * Module name is include in both debug and non-debug versions primarily for
+ * error messages. The __FILE__ macro is not very useful for this, because it
+ * often includes the entire pathname to the module
*/
-#define ACPI_PARAM_LIST(pl) pl
+#define ACPI_MODULE_NAME(Name) static char ACPI_UNUSED_VAR *_AcpiModuleName = Name;
+#else
+#define ACPI_MODULE_NAME(Name)
+#endif
/*
- * Error reporting. These versions add callers module and line#. Since
- * _THIS_MODULE gets compiled out when ACPI_DEBUG_OUTPUT isn't defined, only
- * use it in debug mode.
+ * Ascii error messages can be configured out
*/
-#ifdef ACPI_DEBUG_OUTPUT
-
-#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo(_THIS_MODULE,__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError(_THIS_MODULE,__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning(_THIS_MODULE,__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError(_THIS_MODULE,__LINE__,_COMPONENT, s, e);
+#ifndef ACPI_NO_ERROR_MESSAGES
+#define AE_INFO _AcpiModuleName, __LINE__
-#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError(_THIS_MODULE,__LINE__,_COMPONENT, s, n, p, e);
+/*
+ * Error reporting. Callers module and line number are inserted by AE_INFO,
+ * the plist contains a set of parens to allow variable-length lists.
+ * These macros are used for both the debug and non-debug versions of the code.
+ */
+#define ACPI_INFO(plist) AcpiUtInfo plist
+#define ACPI_WARNING(plist) AcpiUtWarning plist
+#define ACPI_EXCEPTION(plist) AcpiUtException plist
+#define ACPI_ERROR(plist) AcpiUtError plist
+#define ACPI_ERROR_NAMESPACE(s,e) AcpiNsReportError (AE_INFO, s, e);
+#define ACPI_ERROR_METHOD(s,n,p,e) AcpiNsReportMethodError (AE_INFO, s, n, p, e);
#else
-#define ACPI_REPORT_INFO(fp) {AcpiUtReportInfo("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_ERROR(fp) {AcpiUtReportError("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_WARNING(fp) {AcpiUtReportWarning("ACPI",__LINE__,_COMPONENT); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define ACPI_REPORT_NSERROR(s,e) AcpiNsReportError("ACPI",__LINE__,_COMPONENT, s, e);
-
-#define ACPI_REPORT_METHOD_ERROR(s,n,p,e) AcpiNsReportMethodError("ACPI",__LINE__,_COMPONENT, s, n, p, e);
+/* No error messages */
+#define ACPI_INFO(plist)
+#define ACPI_WARNING(plist)
+#define ACPI_EXCEPTION(plist)
+#define ACPI_ERROR(plist)
+#define ACPI_ERROR_NAMESPACE(s,e)
+#define ACPI_ERROR_METHOD(s,n,p,e)
#endif
-/* Error reporting. These versions pass thru the module and line# */
-
-#define _ACPI_REPORT_INFO(a,b,c,fp) {AcpiUtReportInfo(a,b,c); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define _ACPI_REPORT_ERROR(a,b,c,fp) {AcpiUtReportError(a,b,c); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-#define _ACPI_REPORT_WARNING(a,b,c,fp) {AcpiUtReportWarning(a,b,c); \
- AcpiOsPrintf ACPI_PARAM_LIST(fp);}
-
/*
* Debug macros that are conditionally compiled
*/
#ifdef ACPI_DEBUG_OUTPUT
-#define ACPI_MODULE_NAME(name) static char ACPI_UNUSED_VAR *_THIS_MODULE = name;
+/*
+ * Common parameters used for debug output functions:
+ * line number, function name, module(file) name, component ID
+ */
+#define ACPI_DEBUG_PARAMETERS __LINE__, ACPI_GET_FUNCTION_NAME, _AcpiModuleName, _COMPONENT
+
+/*
+ * Function entry tracing
+ */
/*
- * Function entry tracing.
- * The first parameter should be the procedure name as a quoted string. This is declared
- * as a local string ("_ProcName) so that it can be also used by the function exit macros below.
- */
-#define ACPI_FUNCTION_NAME(a) ACPI_DEBUG_PRINT_INFO _DebugInfo; \
- _DebugInfo.ComponentId = _COMPONENT; \
- _DebugInfo.ProcName = a; \
- _DebugInfo.ModuleName = _THIS_MODULE;
-
-#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
- AcpiUtTrace(__LINE__,&_DebugInfo)
-#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
- AcpiUtTracePtr(__LINE__,&_DebugInfo,(void *)b)
-#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
- AcpiUtTraceU32(__LINE__,&_DebugInfo,(UINT32)b)
-#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
- AcpiUtTraceStr(__LINE__,&_DebugInfo,(char *)b)
+ * If ACPI_GET_FUNCTION_NAME was not defined in the compiler-dependent header,
+ * define it now. This is the case where there the compiler does not support
+ * a __FUNCTION__ macro or equivalent. We save the function name on the
+ * local stack.
+ */
+#ifndef ACPI_GET_FUNCTION_NAME
+#define ACPI_GET_FUNCTION_NAME _AcpiFunctionName
+/*
+ * The Name parameter should be the procedure name as a quoted string.
+ * This is declared as a local string ("MyFunctionName") so that it can
+ * be also used by the function exit macros below.
+ * Note: (const char) is used to be compatible with the debug interfaces
+ * and macros such as __FUNCTION__.
+ */
+#define ACPI_FUNCTION_NAME(Name) const char *_AcpiFunctionName = #Name;
-#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
+#else
+/* Compiler supports __FUNCTION__ (or equivalent) -- Ignore this macro */
+
+#define ACPI_FUNCTION_NAME(Name)
+#endif
+
+#define ACPI_FUNCTION_TRACE(a) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTrace(ACPI_DEBUG_PARAMETERS)
+#define ACPI_FUNCTION_TRACE_PTR(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTracePtr(ACPI_DEBUG_PARAMETERS,(void *)b)
+#define ACPI_FUNCTION_TRACE_U32(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceU32(ACPI_DEBUG_PARAMETERS,(UINT32)b)
+#define ACPI_FUNCTION_TRACE_STR(a,b) ACPI_FUNCTION_NAME(a) \
+ AcpiUtTraceStr(ACPI_DEBUG_PARAMETERS,(char *)b)
+
+#define ACPI_FUNCTION_ENTRY() AcpiUtTrackStackPtr()
/*
* Function exit tracing.
* WARNING: These macros include a return statement. This is usually considered
* bad form, but having a separate exit macro is very ugly and difficult to maintain.
* One of the FUNCTION_TRACE macros above must be used in conjunction with these macros
- * so that "_ProcName" is defined.
+ * so that "_AcpiFunctionName" is defined.
+ *
+ * Note: the DO_WHILE0 macro is used to prevent some compilers from complaining
+ * about these constructs.
*/
#ifdef ACPI_USE_DO_WHILE_0
#define ACPI_DO_WHILE0(a) do a while(0)
@@ -589,10 +583,56 @@
#define ACPI_DO_WHILE0(a) a
#endif
-#define return_VOID ACPI_DO_WHILE0 ({AcpiUtExit(__LINE__,&_DebugInfo);return;})
-#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({AcpiUtStatusExit(__LINE__,&_DebugInfo,(s));return((s));})
-#define return_VALUE(s) ACPI_DO_WHILE0 ({AcpiUtValueExit(__LINE__,&_DebugInfo,(ACPI_INTEGER)(s));return((s));})
-#define return_PTR(s) ACPI_DO_WHILE0 ({AcpiUtPtrExit(__LINE__,&_DebugInfo,(UINT8 *)(s));return((s));})
+#define return_VOID ACPI_DO_WHILE0 ({ \
+ AcpiUtExit (ACPI_DEBUG_PARAMETERS); \
+ return;})
+/*
+ * There are two versions of most of the return macros. The default version is
+ * safer, since it avoids side-effects by guaranteeing that the argument will
+ * not be evaluated twice.
+ *
+ * A less-safe version of the macros is provided for optional use if the
+ * compiler uses excessive CPU stack (for example, this may happen in the
+ * debug case if code optimzation is disabled.)
+ */
+#ifndef ACPI_SIMPLE_RETURN_MACROS
+
+#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
+ register ACPI_STATUS _s = (s); \
+ AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, _s); \
+ return (_s); })
+#define return_PTR(s) ACPI_DO_WHILE0 ({ \
+ register void *_s = (void *) (s); \
+ AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) _s); \
+ return (_s); })
+#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
+ register ACPI_INTEGER _s = (s); \
+ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, _s); \
+ return (_s); })
+#define return_UINT8(s) ACPI_DO_WHILE0 ({ \
+ register UINT8 _s = (UINT8) (s); \
+ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \
+ return (_s); })
+#define return_UINT32(s) ACPI_DO_WHILE0 ({ \
+ register UINT32 _s = (UINT32) (s); \
+ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) _s); \
+ return (_s); })
+#else /* Use original less-safe macros */
+
+#define return_ACPI_STATUS(s) ACPI_DO_WHILE0 ({ \
+ AcpiUtStatusExit (ACPI_DEBUG_PARAMETERS, (s)); \
+ return((s)); })
+#define return_PTR(s) ACPI_DO_WHILE0 ({ \
+ AcpiUtPtrExit (ACPI_DEBUG_PARAMETERS, (UINT8 *) (s)); \
+ return((s)); })
+#define return_VALUE(s) ACPI_DO_WHILE0 ({ \
+ AcpiUtValueExit (ACPI_DEBUG_PARAMETERS, (ACPI_INTEGER) (s)); \
+ return((s)); })
+#define return_UINT8(s) return_VALUE(s)
+#define return_UINT32(s) return_VALUE(s)
+
+#endif /* ACPI_SIMPLE_RETURN_MACROS */
+
/* Conditional execution */
@@ -607,27 +647,13 @@
/* Stack and buffer dumping */
#define ACPI_DUMP_STACK_ENTRY(a) AcpiExDumpOperand((a),0)
-#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_THIS_MODULE,__LINE__)
+#define ACPI_DUMP_OPERANDS(a,b,c,d,e) AcpiExDumpOperands(a,b,c,d,e,_AcpiModuleName,__LINE__)
#define ACPI_DUMP_ENTRY(a,b) AcpiNsDumpEntry (a,b)
-#define ACPI_DUMP_TABLES(a,b) AcpiNsDumpTables(a,b)
#define ACPI_DUMP_PATHNAME(a,b,c,d) AcpiNsDumpPathname(a,b,c,d)
#define ACPI_DUMP_RESOURCE_LIST(a) AcpiRsDumpResourceList(a)
#define ACPI_DUMP_BUFFER(a,b) AcpiUtDumpBuffer((UINT8 *)a,b,DB_BYTE_DISPLAY,_COMPONENT)
-#define ACPI_BREAK_MSG(a) AcpiOsSignal (ACPI_SIGNAL_BREAKPOINT,(a))
-
-
-/*
- * Generate INT3 on ACPI_ERROR (Debug only!)
- */
-#define ACPI_ERROR_BREAK
-#ifdef ACPI_ERROR_BREAK
-#define ACPI_BREAK_ON_ERROR(lvl) if ((lvl)&ACPI_ERROR) \
- AcpiOsSignal(ACPI_SIGNAL_BREAKPOINT,"Fatal error encountered\n")
-#else
-#define ACPI_BREAK_ON_ERROR(lvl)
-#endif
/*
* Master debug print macros
@@ -635,8 +661,8 @@
* 1) Debug print for the current component is enabled
* 2) Debug error level or trace level for the print statement is enabled
*/
-#define ACPI_DEBUG_PRINT(pl) AcpiUtDebugPrint ACPI_PARAM_LIST(pl)
-#define ACPI_DEBUG_PRINT_RAW(pl) AcpiUtDebugPrintRaw ACPI_PARAM_LIST(pl)
+#define ACPI_DEBUG_PRINT(plist) AcpiUtDebugPrint plist
+#define ACPI_DEBUG_PRINT_RAW(plist) AcpiUtDebugPrintRaw plist
#else
@@ -644,9 +670,6 @@
* This is the non-debug case -- make everything go away,
* leaving no executable debug code!
*/
-#define ACPI_MODULE_NAME(name)
-#define _THIS_MODULE ""
-
#define ACPI_DEBUG_EXEC(a)
#define ACPI_NORMAL_EXEC(a) a;
@@ -670,11 +693,12 @@
#define ACPI_DUMP_BUFFER(a,b)
#define ACPI_DEBUG_PRINT(pl)
#define ACPI_DEBUG_PRINT_RAW(pl)
-#define ACPI_BREAK_MSG(a)
#define return_VOID return
#define return_ACPI_STATUS(s) return(s)
#define return_VALUE(s) return(s)
+#define return_UINT8(s) return(s)
+#define return_UINT32(s) return(s)
#define return_PTR(s) return(s)
#endif
@@ -691,17 +715,6 @@
#endif
-/*
- * For 16-bit code, we want to shrink some things even though
- * we are using ACPI_DEBUG_OUTPUT to get the debug output
- */
-#if ACPI_MACHINE_WIDTH == 16
-#undef ACPI_DEBUG_ONLY_MEMBERS
-#undef _VERBOSE_STRUCTURES
-#define ACPI_DEBUG_ONLY_MEMBERS(a)
-#endif
-
-
#ifdef ACPI_DEBUG_OUTPUT
/*
* 1) Set name to blanks
@@ -722,20 +735,19 @@
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocate((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_FREE(a) AcpiOsFree(a)
+#define ACPI_ALLOCATE(a) AcpiUtAllocate((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroed((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_FREE(a) AcpiOsFree(a)
#define ACPI_MEM_TRACKING(a)
-
#else
/* Memory allocation */
-#define ACPI_MEM_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_CALLOCATE(a) AcpiUtCallocateAndTrack((ACPI_SIZE)(a), _COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_THIS_MODULE,__LINE__)
-#define ACPI_MEM_TRACKING(a) a
+#define ACPI_ALLOCATE(a) AcpiUtAllocateAndTrack((ACPI_SIZE)(a),_COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_ALLOCATE_ZEROED(a) AcpiUtAllocateZeroedAndTrack((ACPI_SIZE)(a), _COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_FREE(a) AcpiUtFreeAndTrack(a,_COMPONENT,_AcpiModuleName,__LINE__)
+#define ACPI_MEM_TRACKING(a) a
#endif /* ACPI_DBG_TRACK_ALLOCATIONS */
Index: hwgpe.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/hwgpe.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/hwgpe.c -L sys/contrib/dev/acpica/hwgpe.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/hwgpe.c
+++ sys/contrib/dev/acpica/hwgpe.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: hwgpe - Low level GPE enable/disable/clear functions
- * $Revision: 65 $
+ * $Revision: 1.75 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,6 +121,13 @@
#define _COMPONENT ACPI_HARDWARE
ACPI_MODULE_NAME ("hwgpe")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiHwEnableWakeupGpeBlock (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock);
+
/******************************************************************************
*
@@ -181,16 +188,20 @@
ACPI_GPE_EVENT_INFO *GpeEventInfo)
{
ACPI_STATUS Status;
+ UINT8 RegisterBit;
ACPI_FUNCTION_ENTRY ();
+ RegisterBit = (UINT8)
+ (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
+
/*
* Write a one to the appropriate bit in the status register to
* clear this GPE.
*/
- Status = AcpiHwLowLevelWrite (8, GpeEventInfo->RegisterBit,
+ Status = AcpiHwLowLevelWrite (8, RegisterBit,
&GpeEventInfo->RegisterInfo->StatusAddress);
return (Status);
@@ -236,7 +247,8 @@
/* Get the register bitmask for this GPE */
- RegisterBit = GpeEventInfo->RegisterBit;
+ RegisterBit = (UINT8)
+ (1 << (GpeEventInfo->GpeNumber - GpeEventInfo->RegisterInfo->BaseGpeNumber));
/* GPE currently enabled? (enabled for runtime?) */
@@ -284,7 +296,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Disable all GPEs within a GPE block
+ * DESCRIPTION: Disable all GPEs within a single GPE block
*
******************************************************************************/
@@ -324,7 +336,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Clear status bits for all GPEs within a GPE block
+ * DESCRIPTION: Clear status bits for all GPEs within a single GPE block
*
******************************************************************************/
@@ -364,8 +376,8 @@
*
* RETURN: Status
*
- * DESCRIPTION: Enable all "runtime" GPEs within a GPE block. (Includes
- * combination wake/run GPEs.)
+ * DESCRIPTION: Enable all "runtime" GPEs within a single GPE block. Includes
+ * combination wake/run GPEs.
*
******************************************************************************/
@@ -412,12 +424,12 @@
*
* RETURN: Status
*
- * DESCRIPTION: Enable all "wake" GPEs within a GPE block. (Includes
- * combination wake/run GPEs.)
+ * DESCRIPTION: Enable all "wake" GPEs within a single GPE block. Includes
+ * combination wake/run GPEs.
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiHwEnableWakeupGpeBlock (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
ACPI_GPE_BLOCK_INFO *GpeBlock)
@@ -437,7 +449,8 @@
/* Enable all "wake" GPEs in this register */
- Status = AcpiHwLowLevelWrite (8, GpeBlock->RegisterInfo[i].EnableForWake,
+ Status = AcpiHwLowLevelWrite (8,
+ GpeBlock->RegisterInfo[i].EnableForWake,
&GpeBlock->RegisterInfo[i].EnableAddress);
if (ACPI_FAILURE (Status))
{
@@ -453,26 +466,26 @@
*
* FUNCTION: AcpiHwDisableAllGpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Disable and clear all GPEs
+ * DESCRIPTION: Disable and clear all GPEs in all GPE blocks
*
******************************************************************************/
ACPI_STATUS
AcpiHwDisableAllGpes (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("HwDisableAllGpes");
+ ACPI_FUNCTION_TRACE (HwDisableAllGpes);
- Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock, Flags);
- Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock, Flags);
+ Status = AcpiEvWalkGpeList (AcpiHwDisableGpeBlock);
+ Status = AcpiEvWalkGpeList (AcpiHwClearGpeBlock);
return_ACPI_STATUS (Status);
}
@@ -481,25 +494,25 @@
*
* FUNCTION: AcpiHwEnableAllRuntimeGpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Enable all GPEs of the given type
+ * DESCRIPTION: Enable all "runtime" GPEs, in all GPE blocks
*
******************************************************************************/
ACPI_STATUS
AcpiHwEnableAllRuntimeGpes (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("HwEnableAllRuntimeGpes");
+ ACPI_FUNCTION_TRACE (HwEnableAllRuntimeGpes);
- Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock, Flags);
+ Status = AcpiEvWalkGpeList (AcpiHwEnableRuntimeGpeBlock);
return_ACPI_STATUS (Status);
}
@@ -508,25 +521,25 @@
*
* FUNCTION: AcpiHwEnableAllWakeupGpes
*
- * PARAMETERS: Flags - ACPI_NOT_ISR or ACPI_ISR
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Enable all GPEs of the given type
+ * DESCRIPTION: Enable all "wakeup" GPEs, in all GPE blocks
*
******************************************************************************/
ACPI_STATUS
AcpiHwEnableAllWakeupGpes (
- UINT32 Flags)
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("HwEnableAllWakeupGpes");
+ ACPI_FUNCTION_TRACE (HwEnableAllWakeupGpes);
- Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock, Flags);
+ Status = AcpiEvWalkGpeList (AcpiHwEnableWakeupGpeBlock);
return_ACPI_STATUS (Status);
}
Index: dmbuffer.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmbuffer.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmbuffer.c -L sys/contrib/dev/acpica/dmbuffer.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmbuffer.c
+++ sys/contrib/dev/acpica/dmbuffer.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmbuffer - AML disassembler, buffer and string support
- * $Revision: 13 $
+ * $Revision: 1.25 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -126,6 +126,12 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dmbuffer")
+/* Local prototypes */
+
+static void
+AcpiDmUnicode (
+ ACPI_PARSE_OBJECT *Op);
+
/*******************************************************************************
*
@@ -137,7 +143,8 @@
*
* RETURN: None
*
- * DESCRIPTION: Dump a list of bytes in Hex format
+ * DESCRIPTION: Dump an AML "ByteList" in Hex format. 8 bytes per line, prefixed
+ * with the hex buffer offset.
*
******************************************************************************/
@@ -150,12 +157,31 @@
UINT32 i;
- AcpiDmIndent (Level);
+ if (!ByteCount)
+ {
+ return;
+ }
/* Dump the byte list */
for (i = 0; i < ByteCount; i++)
{
+ /* New line every 8 bytes */
+
+ if (((i % 8) == 0) && (i < ByteCount))
+ {
+ if (i > 0)
+ {
+ AcpiOsPrintf ("\n");
+ }
+
+ AcpiDmIndent (Level);
+ if (ByteCount > 7)
+ {
+ AcpiOsPrintf ("/* %04X */ ", i);
+ }
+ }
+
AcpiOsPrintf ("0x%2.2X", (UINT32) ByteData[i]);
/* Add comma if there are more bytes to display */
@@ -164,14 +190,6 @@
{
AcpiOsPrintf (", ");
}
-
- /* New line every 8 bytes */
-
- if ((((i+1) % 8) == 0) && ((i+1) < ByteCount))
- {
- AcpiOsPrintf ("\n");
- AcpiDmIndent (Level);
- }
}
if (Level)
@@ -215,7 +233,7 @@
{
case ACPI_DASM_RESOURCE:
- AcpiDmResourceDescriptor (Info, ByteData, ByteCount);
+ AcpiDmResourceTemplate (Info, Op->Common.Parent, ByteData, ByteCount);
break;
case ACPI_DASM_STRING:
@@ -321,7 +339,7 @@
*
* PARAMETERS: Op - Buffer Object to be examined
*
- * RETURN: TRUE if buffer contains a ASCII string
+ * RETURN: TRUE if buffer contains a ASCII string, FALSE otherwise
*
* DESCRIPTION: Determine if a buffer Op contains a ASCII string
*
@@ -393,7 +411,7 @@
*
******************************************************************************/
-void
+static void
AcpiDmUnicode (
ACPI_PARSE_OBJECT *Op)
{
@@ -423,7 +441,7 @@
/*******************************************************************************
*
- * FUNCTION: AcpiIsEisaId
+ * FUNCTION: AcpiDmIsEisaId
*
* PARAMETERS: Op - Op to be examined
*
@@ -434,7 +452,7 @@
******************************************************************************/
void
-AcpiIsEisaId (
+AcpiDmIsEisaId (
ACPI_PARSE_OBJECT *Op)
{
UINT32 Name;
@@ -454,7 +472,7 @@
/* We are looking for _HID */
- if (ACPI_STRNCMP ((char *) &Name, METHOD_NAME__HID, 4))
+ if (!ACPI_COMPARE_NAME (&Name, METHOD_NAME__HID))
{
return;
}
Index: actbl1.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/actbl1.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/actbl1.h -L sys/contrib/dev/acpica/actbl1.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/actbl1.h
+++ sys/contrib/dev/acpica/actbl1.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Name: actbl1.h - ACPI 1.0 tables
- * $Revision: 28 $
+ * Name: actbl1.h - Additional ACPI table definitions
+ * $Revision: 1.47 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,95 +117,801 @@
#ifndef __ACTBL1_H__
#define __ACTBL1_H__
+
+/*******************************************************************************
+ *
+ * Additional ACPI Tables
+ *
+ * These tables are not consumed directly by the ACPICA subsystem, but are
+ * included here to support device drivers and the AML disassembler.
+ *
+ ******************************************************************************/
+
+
+/*
+ * Values for description table header signatures. Useful because they make
+ * it more difficult to inadvertently type in the wrong signature.
+ */
+#define ACPI_SIG_ASF "ASF!" /* Alert Standard Format table */
+#define ACPI_SIG_BOOT "BOOT" /* Simple Boot Flag Table */
+#define ACPI_SIG_CPEP "CPEP" /* Corrected Platform Error Polling table */
+#define ACPI_SIG_DBGP "DBGP" /* Debug Port table */
+#define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */
+#define ACPI_SIG_ECDT "ECDT" /* Embedded Controller Boot Resources Table */
+#define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */
+#define ACPI_SIG_MADT "APIC" /* Multiple APIC Description Table */
+#define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */
+#define ACPI_SIG_SBST "SBST" /* Smart Battery Specification Table */
+#define ACPI_SIG_SLIT "SLIT" /* System Locality Distance Information Table */
+#define ACPI_SIG_SPCR "SPCR" /* Serial Port Console Redirection table */
+#define ACPI_SIG_SPMI "SPMI" /* Server Platform Management Interface table */
+#define ACPI_SIG_SRAT "SRAT" /* System Resource Affinity Table */
+#define ACPI_SIG_TCPA "TCPA" /* Trusted Computing Platform Alliance table */
+#define ACPI_SIG_WDRT "WDRT" /* Watchdog Resource Table */
+
+
+/*
+ * All tables must be byte-packed to match the ACPI specification, since
+ * the tables are provided by the system BIOS.
+ */
#pragma pack(1)
/*
- * ACPI 1.0 Root System Description Table (RSDT)
+ * Note about bitfields: The UINT8 type is used for bitfields in ACPI tables.
+ * This is the only type that is even remotely portable. Anything else is not
+ * portable, so do not use any other bitfield types.
*/
-typedef struct rsdt_descriptor_rev1
+
+
+/* Common Sub-table header (used in MADT, SRAT, etc.) */
+
+typedef struct acpi_subtable_header
{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 TableOffsetEntry [1]; /* Array of pointers to other */
- /* ACPI tables */
-} RSDT_DESCRIPTOR_REV1;
-
-
-/*
- * ACPI 1.0 Firmware ACPI Control Structure (FACS)
- */
-typedef struct facs_descriptor_rev1
-{
- char Signature[4]; /* ACPI Signature */
- UINT32 Length; /* Length of structure, in bytes */
- UINT32 HardwareSignature; /* Hardware configuration signature */
- UINT32 FirmwareWakingVector; /* ACPI OS waking vector */
- UINT32 GlobalLock; /* Global Lock */
- UINT32_BIT S4Bios_f : 1; /* Indicates if S4BIOS support is present */
- UINT32_BIT Reserved1 : 31; /* Must be 0 */
- UINT8 Resverved3 [40]; /* Reserved - must be zero */
-
-} FACS_DESCRIPTOR_REV1;
-
-
-/*
- * ACPI 1.0 Fixed ACPI Description Table (FADT)
- */
-typedef struct fadt_descriptor_rev1
-{
- ACPI_TABLE_HEADER_DEF /* ACPI common table header */
- UINT32 FirmwareCtrl; /* Physical address of FACS */
- UINT32 Dsdt; /* Physical address of DSDT */
- UINT8 Model; /* System Interrupt Model */
- UINT8 Reserved1; /* Reserved */
- UINT16 SciInt; /* System vector of SCI interrupt */
- UINT32 SmiCmd; /* Port address of SMI command port */
- UINT8 AcpiEnable; /* Value to write to smi_cmd to enable ACPI */
- UINT8 AcpiDisable; /* Value to write to smi_cmd to disable ACPI */
- UINT8 S4BiosReq; /* Value to write to SMI CMD to enter S4BIOS state */
- UINT8 Reserved2; /* Reserved - must be zero */
- UINT32 Pm1aEvtBlk; /* Port address of Power Mgt 1a AcpiEvent Reg Blk */
- UINT32 Pm1bEvtBlk; /* Port address of Power Mgt 1b AcpiEvent Reg Blk */
- UINT32 Pm1aCntBlk; /* Port address of Power Mgt 1a Control Reg Blk */
- UINT32 Pm1bCntBlk; /* Port address of Power Mgt 1b Control Reg Blk */
- UINT32 Pm2CntBlk; /* Port address of Power Mgt 2 Control Reg Blk */
- UINT32 PmTmrBlk; /* Port address of Power Mgt Timer Ctrl Reg Blk */
- UINT32 Gpe0Blk; /* Port addr of General Purpose AcpiEvent 0 Reg Blk */
- UINT32 Gpe1Blk; /* Port addr of General Purpose AcpiEvent 1 Reg Blk */
- UINT8 Pm1EvtLen; /* Byte Length of ports at pm1X_evt_blk */
- UINT8 Pm1CntLen; /* Byte Length of ports at pm1X_cnt_blk */
- UINT8 Pm2CntLen; /* Byte Length of ports at pm2_cnt_blk */
- UINT8 PmTmLen; /* Byte Length of ports at pm_tm_blk */
- UINT8 Gpe0BlkLen; /* Byte Length of ports at gpe0_blk */
- UINT8 Gpe1BlkLen; /* Byte Length of ports at gpe1_blk */
- UINT8 Gpe1Base; /* Offset in gpe model where gpe1 events start */
- UINT8 Reserved3; /* Reserved */
- UINT16 Plvl2Lat; /* Worst case HW latency to enter/exit C2 state */
- UINT16 Plvl3Lat; /* Worst case HW latency to enter/exit C3 state */
- UINT16 FlushSize; /* Size of area read to flush caches */
- UINT16 FlushStride; /* Stride used in flushing caches */
- UINT8 DutyOffset; /* Bit location of duty cycle field in p_cnt reg */
- UINT8 DutyWidth; /* Bit width of duty cycle field in p_cnt reg */
- UINT8 DayAlrm; /* Index to day-of-month alarm in RTC CMOS RAM */
- UINT8 MonAlrm; /* Index to month-of-year alarm in RTC CMOS RAM */
- UINT8 Century; /* Index to century in RTC CMOS RAM */
- UINT8 Reserved4; /* Reserved */
- UINT8 Reserved4a; /* Reserved */
- UINT8 Reserved4b; /* Reserved */
- UINT32_BIT WbInvd : 1; /* The wbinvd instruction works properly */
- UINT32_BIT WbInvdFlush : 1; /* The wbinvd flushes but does not invalidate */
- UINT32_BIT ProcC1 : 1; /* All processors support C1 state */
- UINT32_BIT Plvl2Up : 1; /* C2 state works on MP system */
- UINT32_BIT PwrButton : 1; /* Power button is handled as a generic feature */
- UINT32_BIT SleepButton : 1; /* Sleep button is handled as a generic feature, or not present */
- UINT32_BIT FixedRTC : 1; /* RTC wakeup stat not in fixed register space */
- UINT32_BIT Rtcs4 : 1; /* RTC wakeup stat not possible from S4 */
- UINT32_BIT TmrValExt : 1; /* The tmr_val width is 32 bits (0 = 24 bits) */
- UINT32_BIT Reserved5 : 23; /* Reserved - must be zero */
+ UINT8 Type;
+ UINT8 Length;
-} FADT_DESCRIPTOR_REV1;
+} ACPI_SUBTABLE_HEADER;
-#pragma pack()
-#endif /* __ACTBL1_H__ */
+/*******************************************************************************
+ *
+ * ASF - Alert Standard Format table (Signature "ASF!")
+ *
+ * Conforms to the Alert Standard Format Specification V2.0, 23 April 2003
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_asf
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+
+} ACPI_TABLE_ASF;
+
+
+/* ASF subtable header */
+
+typedef struct acpi_asf_header
+{
+ UINT8 Type;
+ UINT8 Reserved;
+ UINT16 Length;
+
+} ACPI_ASF_HEADER;
+
+
+/* Values for Type field above */
+
+enum AcpiAsfType
+{
+ ACPI_ASF_TYPE_INFO = 0,
+ ACPI_ASF_TYPE_ALERT = 1,
+ ACPI_ASF_TYPE_CONTROL = 2,
+ ACPI_ASF_TYPE_BOOT = 3,
+ ACPI_ASF_TYPE_ADDRESS = 4,
+ ACPI_ASF_TYPE_RESERVED = 5
+};
+
+/*
+ * ASF subtables
+ */
+
+/* 0: ASF Information */
+
+typedef struct acpi_asf_info
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 MinResetValue;
+ UINT8 MinPollInterval;
+ UINT16 SystemId;
+ UINT32 MfgId;
+ UINT8 Flags;
+ UINT8 Reserved2[3];
+
+} ACPI_ASF_INFO;
+
+/* 1: ASF Alerts */
+
+typedef struct acpi_asf_alert
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 AssertMask;
+ UINT8 DeassertMask;
+ UINT8 Alerts;
+ UINT8 DataLength;
+
+} ACPI_ASF_ALERT;
+
+typedef struct acpi_asf_alert_data
+{
+ UINT8 Address;
+ UINT8 Command;
+ UINT8 Mask;
+ UINT8 Value;
+ UINT8 SensorType;
+ UINT8 Type;
+ UINT8 Offset;
+ UINT8 SourceType;
+ UINT8 Severity;
+ UINT8 SensorNumber;
+ UINT8 Entity;
+ UINT8 Instance;
+
+} ACPI_ASF_ALERT_DATA;
+
+/* 2: ASF Remote Control */
+
+typedef struct acpi_asf_remote
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 Controls;
+ UINT8 DataLength;
+ UINT16 Reserved2;
+
+} ACPI_ASF_REMOTE;
+
+typedef struct acpi_asf_control_data
+{
+ UINT8 Function;
+ UINT8 Address;
+ UINT8 Command;
+ UINT8 Value;
+
+} ACPI_ASF_CONTROL_DATA;
+
+/* 3: ASF RMCP Boot Options */
+
+typedef struct acpi_asf_rmcp
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 Capabilities[7];
+ UINT8 CompletionCode;
+ UINT32 EnterpriseId;
+ UINT8 Command;
+ UINT16 Parameter;
+ UINT16 BootOptions;
+ UINT16 OemParameters;
+
+} ACPI_ASF_RMCP;
+
+/* 4: ASF Address */
+
+typedef struct acpi_asf_address
+{
+ ACPI_ASF_HEADER Header;
+ UINT8 EpromAddress;
+ UINT8 Devices;
+
+} ACPI_ASF_ADDRESS;
+
+
+/*******************************************************************************
+ *
+ * BOOT - Simple Boot Flag Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_boot
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 CmosIndex; /* Index in CMOS RAM for the boot register */
+ UINT8 Reserved[3];
+
+} ACPI_TABLE_BOOT;
+
+
+/*******************************************************************************
+ *
+ * CPEP - Corrected Platform Error Polling table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_cpep
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 Reserved;
+
+} ACPI_TABLE_CPEP;
+
+
+/* Subtable */
+
+typedef struct acpi_cpep_polling
+{
+ UINT8 Type;
+ UINT8 Length;
+ UINT8 Id; /* Processor ID */
+ UINT8 Eid; /* Processor EID */
+ UINT32 Interval; /* Polling interval (msec) */
+
+} ACPI_CPEP_POLLING;
+
+
+/*******************************************************************************
+ *
+ * DBGP - Debug Port table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_dbgp
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Type; /* 0=full 16550, 1=subset of 16550 */
+ UINT8 Reserved[3];
+ ACPI_GENERIC_ADDRESS DebugPort;
+
+} ACPI_TABLE_DBGP;
+
+
+/*******************************************************************************
+ *
+ * DMAR - DMA Remapping table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_dmar
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Width; /* Host Address Width */
+ UINT8 Reserved[11];
+
+} ACPI_TABLE_DMAR;
+
+/* DMAR subtable header */
+
+typedef struct acpi_dmar_header
+{
+ UINT16 Type;
+ UINT16 Length;
+ UINT8 Flags;
+ UINT8 Reserved[3];
+
+} ACPI_DMAR_HEADER;
+
+/* Values for subtable type in ACPI_DMAR_HEADER */
+
+enum AcpiDmarType
+{
+ ACPI_DMAR_TYPE_HARDWARE_UNIT = 0,
+ ACPI_DMAR_TYPE_RESERVED_MEMORY = 1,
+ ACPI_DMAR_TYPE_RESERVED = 2 /* 2 and greater are reserved */
+};
+
+typedef struct acpi_dmar_device_scope
+{
+ UINT8 EntryType;
+ UINT8 Length;
+ UINT8 Segment;
+ UINT8 Bus;
+
+} ACPI_DMAR_DEVICE_SCOPE;
+
+/* Values for EntryType in ACPI_DMAR_DEVICE_SCOPE */
+
+enum AcpiDmarScopeType
+{
+ ACPI_DMAR_SCOPE_TYPE_NOT_USED = 0,
+ ACPI_DMAR_SCOPE_TYPE_ENDPOINT = 1,
+ ACPI_DMAR_SCOPE_TYPE_BRIDGE = 2,
+ ACPI_DMAR_SCOPE_TYPE_RESERVED = 3 /* 3 and greater are reserved */
+};
+
+
+/*
+ * DMAR Sub-tables, correspond to Type in ACPI_DMAR_HEADER
+ */
+
+/* 0: Hardware Unit Definition */
+
+typedef struct acpi_dmar_hardware_unit
+{
+ ACPI_DMAR_HEADER Header;
+ UINT64 Address; /* Register Base Address */
+
+} ACPI_DMAR_HARDWARE_UNIT;
+
+/* Flags */
+
+#define ACPI_DMAR_INCLUDE_ALL (1)
+
+/* 1: Reserved Memory Defininition */
+
+typedef struct acpi_dmar_reserved_memory
+{
+ ACPI_DMAR_HEADER Header;
+ UINT64 Address; /* 4K aligned base address */
+ UINT64 EndAddress; /* 4K aligned limit address */
+
+} ACPI_DMAR_RESERVED_MEMORY;
+
+/* Flags */
+
+#define ACPI_DMAR_ALLOW_ALL (1)
+
+
+/*******************************************************************************
+ *
+ * ECDT - Embedded Controller Boot Resources Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_ecdt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ ACPI_GENERIC_ADDRESS Control; /* Address of EC command/status register */
+ ACPI_GENERIC_ADDRESS Data; /* Address of EC data register */
+ UINT32 Uid; /* Unique ID - must be same as the EC _UID method */
+ UINT8 Gpe; /* The GPE for the EC */
+ UINT8 Id[1]; /* Full namepath of the EC in the ACPI namespace */
+
+} ACPI_TABLE_ECDT;
+
+
+/*******************************************************************************
+ *
+ * HPET - High Precision Event Timer table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_hpet
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Id; /* Hardware ID of event timer block */
+ ACPI_GENERIC_ADDRESS Address; /* Address of event timer block */
+ UINT8 Sequence; /* HPET sequence number */
+ UINT16 MinimumTick; /* Main counter min tick, periodic mode */
+ UINT8 Flags;
+
+} ACPI_TABLE_HPET;
+
+/*! Flags */
+
+#define ACPI_HPET_PAGE_PROTECT (1) /* 00: No page protection */
+#define ACPI_HPET_PAGE_PROTECT_4 (1<<1) /* 01: 4KB page protected */
+#define ACPI_HPET_PAGE_PROTECT_64 (1<<2) /* 02: 64KB page protected */
+
+/*! [End] no source code translation !*/
+
+
+/*******************************************************************************
+ *
+ * MADT - Multiple APIC Description Table
+ *
+ ******************************************************************************/
+typedef struct acpi_table_madt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 Address; /* Physical address of local APIC */
+ UINT32 Flags;
+
+} ACPI_TABLE_MADT;
+
+/* Flags */
+
+#define ACPI_MADT_PCAT_COMPAT (1) /* 00: System also has dual 8259s */
+
+/* Values for PCATCompat flag */
+
+#define ACPI_MADT_DUAL_PIC 0
+#define ACPI_MADT_MULTIPLE_APIC 1
+
+
+/* Values for subtable type in ACPI_SUBTABLE_HEADER */
+
+enum AcpiMadtType
+{
+ ACPI_MADT_TYPE_LOCAL_APIC = 0,
+ ACPI_MADT_TYPE_IO_APIC = 1,
+ ACPI_MADT_TYPE_INTERRUPT_OVERRIDE = 2,
+ ACPI_MADT_TYPE_NMI_SOURCE = 3,
+ ACPI_MADT_TYPE_LOCAL_APIC_NMI = 4,
+ ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE = 5,
+ ACPI_MADT_TYPE_IO_SAPIC = 6,
+ ACPI_MADT_TYPE_LOCAL_SAPIC = 7,
+ ACPI_MADT_TYPE_INTERRUPT_SOURCE = 8,
+ ACPI_MADT_TYPE_RESERVED = 9 /* 9 and greater are reserved */
+};
+
+
+/*
+ * MADT Sub-tables, correspond to Type in ACPI_SUBTABLE_HEADER
+ */
+
+/* 0: Processor Local APIC */
+
+typedef struct acpi_madt_local_apic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProcessorId; /* ACPI processor id */
+ UINT8 Id; /* Processor's local APIC id */
+ UINT32 LapicFlags;
+
+} ACPI_MADT_LOCAL_APIC;
+
+/* 1: IO APIC */
+
+typedef struct acpi_madt_io_apic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 Id; /* I/O APIC ID */
+ UINT8 Reserved; /* Reserved - must be zero */
+ UINT32 Address; /* APIC physical address */
+ UINT32 GlobalIrqBase; /* Global system interrupt where INTI lines start */
+
+} ACPI_MADT_IO_APIC;
+
+/* 2: Interrupt Override */
+
+typedef struct acpi_madt_interrupt_override
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 Bus; /* 0 - ISA */
+ UINT8 SourceIrq; /* Interrupt source (IRQ) */
+ UINT32 GlobalIrq; /* Global system interrupt */
+ UINT16 IntiFlags;
+
+} ACPI_MADT_INTERRUPT_OVERRIDE;
+
+/* 3: NMI Source */
+
+typedef struct acpi_madt_nmi_source
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 IntiFlags;
+ UINT32 GlobalIrq; /* Global system interrupt */
+
+} ACPI_MADT_NMI_SOURCE;
+
+/* 4: Local APIC NMI */
+
+typedef struct acpi_madt_local_apic_nmi
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProcessorId; /* ACPI processor id */
+ UINT16 IntiFlags;
+ UINT8 Lint; /* LINTn to which NMI is connected */
+
+} ACPI_MADT_LOCAL_APIC_NMI;
+
+/* 5: Address Override */
+
+typedef struct acpi_madt_local_apic_override
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 Reserved; /* Reserved, must be zero */
+ UINT64 Address; /* APIC physical address */
+
+} ACPI_MADT_LOCAL_APIC_OVERRIDE;
+
+/* 6: I/O Sapic */
+
+typedef struct acpi_madt_io_sapic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 Id; /* I/O SAPIC ID */
+ UINT8 Reserved; /* Reserved, must be zero */
+ UINT32 GlobalIrqBase; /* Global interrupt for SAPIC start */
+ UINT64 Address; /* SAPIC physical address */
+
+} ACPI_MADT_IO_SAPIC;
+
+/* 7: Local Sapic */
+
+typedef struct acpi_madt_local_sapic
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProcessorId; /* ACPI processor id */
+ UINT8 Id; /* SAPIC ID */
+ UINT8 Eid; /* SAPIC EID */
+ UINT8 Reserved[3]; /* Reserved, must be zero */
+ UINT32 LapicFlags;
+ UINT32 Uid; /* Numeric UID - ACPI 3.0 */
+ char UidString[1]; /* String UID - ACPI 3.0 */
+
+} ACPI_MADT_LOCAL_SAPIC;
+
+/* 8: Platform Interrupt Source */
+
+typedef struct acpi_madt_interrupt_source
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT16 IntiFlags;
+ UINT8 Type; /* 1=PMI, 2=INIT, 3=corrected */
+ UINT8 Id; /* Processor ID */
+ UINT8 Eid; /* Processor EID */
+ UINT8 IoSapicVector; /* Vector value for PMI interrupts */
+ UINT32 GlobalIrq; /* Global system interrupt */
+ UINT32 Flags; /* Interrupt Source Flags */
+
+} ACPI_MADT_INTERRUPT_SOURCE;
+
+/* Flags field above */
+
+#define ACPI_MADT_CPEI_OVERRIDE (1)
+
+
+/*
+ * Common flags fields for MADT subtables
+ */
+
+/* MADT Local APIC flags (LapicFlags) */
+
+#define ACPI_MADT_ENABLED (1) /* 00: Processor is usable if set */
+
+/* MADT MPS INTI flags (IntiFlags) */
+
+#define ACPI_MADT_POLARITY_MASK (3) /* 00-01: Polarity of APIC I/O input signals */
+#define ACPI_MADT_TRIGGER_MASK (3<<2) /* 02-03: Trigger mode of APIC input signals */
+
+/* Values for MPS INTI flags */
+
+#define ACPI_MADT_POLARITY_CONFORMS 0
+#define ACPI_MADT_POLARITY_ACTIVE_HIGH 1
+#define ACPI_MADT_POLARITY_RESERVED 2
+#define ACPI_MADT_POLARITY_ACTIVE_LOW 3
+
+#define ACPI_MADT_TRIGGER_CONFORMS (0)
+#define ACPI_MADT_TRIGGER_EDGE (1<<2)
+#define ACPI_MADT_TRIGGER_RESERVED (2<<2)
+#define ACPI_MADT_TRIGGER_LEVEL (3<<2)
+
+
+/*******************************************************************************
+ *
+ * MCFG - PCI Memory Mapped Configuration table and sub-table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_mcfg
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Reserved[8];
+
+} ACPI_TABLE_MCFG;
+
+
+/* Subtable */
+typedef struct acpi_mcfg_allocation
+{
+ UINT64 Address; /* Base address, processor-relative */
+ UINT16 PciSegment; /* PCI segment group number */
+ UINT8 StartBusNumber; /* Starting PCI Bus number */
+ UINT8 EndBusNumber; /* Final PCI Bus number */
+ UINT32 Reserved;
+
+} ACPI_MCFG_ALLOCATION;
+
+
+/*******************************************************************************
+ *
+ * SBST - Smart Battery Specification Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_sbst
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 WarningLevel;
+ UINT32 LowLevel;
+ UINT32 CriticalLevel;
+
+} ACPI_TABLE_SBST;
+
+
+/*******************************************************************************
+ *
+ * SLIT - System Locality Distance Information Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_slit
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT64 LocalityCount;
+ UINT8 Entry[1]; /* Real size = localities^2 */
+
+} ACPI_TABLE_SLIT;
+
+
+/*******************************************************************************
+ *
+ * SPCR - Serial Port Console Redirection table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_spcr
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 InterfaceType; /* 0=full 16550, 1=subset of 16550 */
+ UINT8 Reserved[3];
+ ACPI_GENERIC_ADDRESS SerialPort;
+ UINT8 InterruptType;
+ UINT8 PcInterrupt;
+ UINT32 Interrupt;
+ UINT8 BaudRate;
+ UINT8 Parity;
+ UINT8 StopBits;
+ UINT8 FlowControl;
+ UINT8 TerminalType;
+ UINT8 Reserved1;
+ UINT16 PciDeviceId;
+ UINT16 PciVendorId;
+ UINT8 PciBus;
+ UINT8 PciDevice;
+ UINT8 PciFunction;
+ UINT32 PciFlags;
+ UINT8 PciSegment;
+ UINT32 Reserved2;
+
+} ACPI_TABLE_SPCR;
+
+
+/*******************************************************************************
+ *
+ * SPMI - Server Platform Management Interface table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_spmi
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT8 Reserved;
+ UINT8 InterfaceType;
+ UINT16 SpecRevision; /* Version of IPMI */
+ UINT8 InterruptType;
+ UINT8 GpeNumber; /* GPE assigned */
+ UINT8 Reserved1;
+ UINT8 PciDeviceFlag;
+ UINT32 Interrupt;
+ ACPI_GENERIC_ADDRESS IpmiRegister;
+ UINT8 PciSegment;
+ UINT8 PciBus;
+ UINT8 PciDevice;
+ UINT8 PciFunction;
+
+} ACPI_TABLE_SPMI;
+
+
+/*******************************************************************************
+ *
+ * SRAT - System Resource Affinity Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_srat
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 TableRevision; /* Must be value '1' */
+ UINT64 Reserved; /* Reserved, must be zero */
+
+} ACPI_TABLE_SRAT;
+
+/* Values for subtable type in ACPI_SUBTABLE_HEADER */
+
+enum AcpiSratType
+{
+ ACPI_SRAT_TYPE_CPU_AFFINITY = 0,
+ ACPI_SRAT_TYPE_MEMORY_AFFINITY = 1,
+ ACPI_SRAT_TYPE_RESERVED = 2
+};
+
+/* SRAT sub-tables */
+
+typedef struct acpi_srat_cpu_affinity
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT8 ProximityDomainLo;
+ UINT8 ApicId;
+ UINT32 Flags;
+ UINT8 LocalSapicEid;
+ UINT8 ProximityDomainHi[3];
+ UINT32 Reserved; /* Reserved, must be zero */
+
+} ACPI_SRAT_CPU_AFFINITY;
+
+/* Flags */
+
+#define ACPI_SRAT_CPU_ENABLED (1) /* 00: Use affinity structure */
+
+
+typedef struct acpi_srat_mem_affinity
+{
+ ACPI_SUBTABLE_HEADER Header;
+ UINT32 ProximityDomain;
+ UINT16 Reserved; /* Reserved, must be zero */
+ UINT64 BaseAddress;
+ UINT64 Length;
+ UINT32 MemoryType; /* See acpi_address_range_id */
+ UINT32 Flags;
+ UINT64 Reserved1; /* Reserved, must be zero */
+
+} ACPI_SRAT_MEM_AFFINITY;
+
+/* Flags */
+
+#define ACPI_SRAT_MEM_ENABLED (1) /* 00: Use affinity structure */
+#define ACPI_SRAT_MEM_HOT_PLUGGABLE (1<<1) /* 01: Memory region is hot pluggable */
+#define ACPI_SRAT_MEM_NON_VOLATILE (1<<2) /* 02: Memory region is non-volatile */
+
+/* Memory types */
+
+enum acpi_address_range_id
+{
+ ACPI_ADDRESS_RANGE_MEMORY = 1,
+ ACPI_ADDRESS_RANGE_RESERVED = 2,
+ ACPI_ADDRESS_RANGE_ACPI = 3,
+ ACPI_ADDRESS_RANGE_NVS = 4,
+ ACPI_ADDRESS_RANGE_COUNT = 5
+};
+
+
+/*******************************************************************************
+ *
+ * TCPA - Trusted Computing Platform Alliance table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_tcpa
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT16 Reserved;
+ UINT32 MaxLogLength; /* Maximum length for the event log area */
+ UINT64 LogAddress; /* Address of the event log area */
+
+} ACPI_TABLE_TCPA;
+
+
+/*******************************************************************************
+ *
+ * WDRT - Watchdog Resource Table
+ *
+ ******************************************************************************/
+
+typedef struct acpi_table_wdrt
+{
+ ACPI_TABLE_HEADER Header; /* Common ACPI table header */
+ UINT32 HeaderLength; /* Watchdog Header Length */
+ UINT8 PciSegment; /* PCI Segment number */
+ UINT8 PciBus; /* PCI Bus number */
+ UINT8 PciDevice; /* PCI Device number */
+ UINT8 PciFunction; /* PCI Function number */
+ UINT32 TimerPeriod; /* Period of one timer count (msec) */
+ UINT32 MaxCount; /* Maximum counter value supported */
+ UINT32 MinCount; /* Minimum counter value */
+ UINT8 Flags;
+ UINT8 Reserved[3];
+ UINT32 Entries; /* Number of watchdog entries that follow */
+
+} ACPI_TABLE_WDRT;
+
+/* Flags */
+
+#define ACPI_WDRT_TIMER_ENABLED (1) /* 00: Timer enabled */
+
+
+/* Reset to default packing */
+
+#pragma pack()
+
+#endif /* __ACTBL1_H__ */
Index: evsci.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/evsci.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/evsci.c -L sys/contrib/dev/acpica/evsci.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/evsci.c
+++ sys/contrib/dev/acpica/evsci.c
@@ -2,7 +2,7 @@
*
* Module Name: evsci - System Control Interrupt configuration and
* legacy to ACPI mode state transition functions
- * $Revision: 94 $
+ * $Revision: 1.102 $
*
******************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -123,6 +123,12 @@
#define _COMPONENT ACPI_EVENTS
ACPI_MODULE_NAME ("evsci")
+/* Local prototypes */
+
+static UINT32 ACPI_SYSTEM_XFACE
+AcpiEvSciXruptHandler (
+ void *Context);
+
/*******************************************************************************
*
@@ -145,7 +151,7 @@
UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
- ACPI_FUNCTION_TRACE("EvSciXruptHandler");
+ ACPI_FUNCTION_TRACE (EvSciXruptHandler);
/*
@@ -165,7 +171,7 @@
*/
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
- return_VALUE (InterruptHandled);
+ return_UINT32 (InterruptHandled);
}
@@ -189,7 +195,7 @@
UINT32 InterruptHandled = ACPI_INTERRUPT_NOT_HANDLED;
- ACPI_FUNCTION_TRACE("EvGpeXruptHandler");
+ ACPI_FUNCTION_TRACE (EvGpeXruptHandler);
/*
@@ -203,7 +209,7 @@
*/
InterruptHandled |= AcpiEvGpeDetect (GpeXruptList);
- return_VALUE (InterruptHandled);
+ return_UINT32 (InterruptHandled);
}
@@ -220,16 +226,17 @@
******************************************************************************/
UINT32
-AcpiEvInstallSciHandler (void)
+AcpiEvInstallSciHandler (
+ void)
{
UINT32 Status = AE_OK;
- ACPI_FUNCTION_TRACE ("EvInstallSciHandler");
+ ACPI_FUNCTION_TRACE (EvInstallSciHandler);
- Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
- AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
+ Status = AcpiOsInstallInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
+ AcpiEvSciXruptHandler, AcpiGbl_GpeXruptListHead);
return_ACPI_STATUS (Status);
}
@@ -254,18 +261,19 @@
******************************************************************************/
ACPI_STATUS
-AcpiEvRemoveSciHandler (void)
+AcpiEvRemoveSciHandler (
+ void)
{
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("EvRemoveSciHandler");
+ ACPI_FUNCTION_TRACE (EvRemoveSciHandler);
/* Just let the OS remove the handler and disable the level */
- Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT->SciInt,
- AcpiEvSciXruptHandler);
+ Status = AcpiOsRemoveInterruptHandler ((UINT32) AcpiGbl_FADT.SciInterrupt,
+ AcpiEvSciXruptHandler);
return_ACPI_STATUS (Status);
}
Index: acresrc.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acresrc.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acresrc.h -L sys/contrib/dev/acpica/acresrc.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acresrc.h
+++ sys/contrib/dev/acpica/acresrc.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acresrc.h - Resource Manager function prototypes
- * $Revision: 38 $
+ * $Revision: 1.60 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,45 +118,131 @@
#ifndef __ACRESRC_H__
#define __ACRESRC_H__
+/* Need the AML resource descriptor structs */
-/*
- * Function prototypes called from Acpi* APIs
- */
-
-ACPI_STATUS
-AcpiRsGetPrtMethodData (
- ACPI_HANDLE Handle,
- ACPI_BUFFER *RetBuffer);
+#include <contrib/dev/acpica/amlresrc.h>
-ACPI_STATUS
-AcpiRsGetCrsMethodData (
- ACPI_HANDLE Handle,
- ACPI_BUFFER *RetBuffer);
+/*
+ * If possible, pack the following structures to byte alignment, since we
+ * don't care about performance for debug output. Two cases where we cannot
+ * pack the structures:
+ *
+ * 1) Hardware does not support misaligned memory transfers
+ * 2) Compiler does not support pointers within packed structures
+ */
+#if (!defined(ACPI_MISALIGNMENT_NOT_SUPPORTED) && !defined(ACPI_PACKED_POINTERS_NOT_SUPPORTED))
+#pragma pack(1)
+#endif
-ACPI_STATUS
-AcpiRsGetPrsMethodData (
- ACPI_HANDLE Handle,
- ACPI_BUFFER *RetBuffer);
+/*
+ * Individual entry for the resource conversion tables
+ */
+typedef const struct acpi_rsconvert_info
+{
+ UINT8 Opcode;
+ UINT8 ResourceOffset;
+ UINT8 AmlOffset;
+ UINT8 Value;
+
+} ACPI_RSCONVERT_INFO;
+
+/* Resource conversion opcodes */
+
+#define ACPI_RSC_INITGET 0
+#define ACPI_RSC_INITSET 1
+#define ACPI_RSC_FLAGINIT 2
+#define ACPI_RSC_1BITFLAG 3
+#define ACPI_RSC_2BITFLAG 4
+#define ACPI_RSC_COUNT 5
+#define ACPI_RSC_COUNT16 6
+#define ACPI_RSC_LENGTH 7
+#define ACPI_RSC_MOVE8 8
+#define ACPI_RSC_MOVE16 9
+#define ACPI_RSC_MOVE32 10
+#define ACPI_RSC_MOVE64 11
+#define ACPI_RSC_SET8 12
+#define ACPI_RSC_DATA8 13
+#define ACPI_RSC_ADDRESS 14
+#define ACPI_RSC_SOURCE 15
+#define ACPI_RSC_SOURCEX 16
+#define ACPI_RSC_BITMASK 17
+#define ACPI_RSC_BITMASK16 18
+#define ACPI_RSC_EXIT_NE 19
+#define ACPI_RSC_EXIT_LE 20
+
+/* Resource Conversion sub-opcodes */
+
+#define ACPI_RSC_COMPARE_AML_LENGTH 0
+#define ACPI_RSC_COMPARE_VALUE 1
+
+#define ACPI_RSC_TABLE_SIZE(d) (sizeof (d) / sizeof (ACPI_RSCONVERT_INFO))
+
+#define ACPI_RS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_RESOURCE,f)
+#define AML_OFFSET(f) (UINT8) ACPI_OFFSET (AML_RESOURCE,f)
+
+
+typedef const struct acpi_rsdump_info
+{
+ UINT8 Opcode;
+ UINT8 Offset;
+ char *Name;
+ const char **Pointer;
+
+} ACPI_RSDUMP_INFO;
+
+/* Values for the Opcode field above */
+
+#define ACPI_RSD_TITLE 0
+#define ACPI_RSD_LITERAL 1
+#define ACPI_RSD_STRING 2
+#define ACPI_RSD_UINT8 3
+#define ACPI_RSD_UINT16 4
+#define ACPI_RSD_UINT32 5
+#define ACPI_RSD_UINT64 6
+#define ACPI_RSD_1BITFLAG 7
+#define ACPI_RSD_2BITFLAG 8
+#define ACPI_RSD_SHORTLIST 9
+#define ACPI_RSD_LONGLIST 10
+#define ACPI_RSD_DWORDLIST 11
+#define ACPI_RSD_ADDRESS 12
+#define ACPI_RSD_SOURCE 13
+
+/* restore default alignment */
+
+#pragma pack()
+
+
+/* Resource tables indexed by internal resource type */
+
+extern const UINT8 AcpiGbl_AmlResourceSizes[];
+extern ACPI_RSCONVERT_INFO *AcpiGbl_SetResourceDispatch[];
+
+/* Resource tables indexed by raw AML resource descriptor type */
+
+extern const UINT8 AcpiGbl_ResourceStructSizes[];
+extern ACPI_RSCONVERT_INFO *AcpiGbl_GetResourceDispatch[];
+
+
+typedef struct acpi_vendor_walk_info
+{
+ ACPI_VENDOR_UUID *Uuid;
+ ACPI_BUFFER *Buffer;
+ ACPI_STATUS Status;
-ACPI_STATUS
-AcpiRsGetMethodData (
- ACPI_HANDLE Handle,
- char *Path,
- ACPI_BUFFER *RetBuffer);
+} ACPI_VENDOR_WALK_INFO;
-ACPI_STATUS
-AcpiRsSetSrsMethodData (
- ACPI_HANDLE Handle,
- ACPI_BUFFER *RetBuffer);
+/*
+ * rscreate
+ */
ACPI_STATUS
AcpiRsCreateResourceList (
- ACPI_OPERAND_OBJECT *ByteStreamBuffer,
+ ACPI_OPERAND_OBJECT *AmlBuffer,
ACPI_BUFFER *OutputBuffer);
ACPI_STATUS
-AcpiRsCreateByteStream (
+AcpiRsCreateAmlResources (
ACPI_RESOURCE *LinkedListBuffer,
ACPI_BUFFER *OutputBuffer);
@@ -167,82 +253,46 @@
/*
- * Function prototypes called from AcpiRsCreate*
+ * rsutils
*/
-void
-AcpiRsDumpIrq (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpAddress16 (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpAddress32 (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpAddress64 (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpDma (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpIo (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpExtendedIrq (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpFixedIo (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpFixedMemory32 (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpMemory24 (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpMemory32 (
- ACPI_RESOURCE_DATA *Data);
-
-void
-AcpiRsDumpStartDependFns (
- ACPI_RESOURCE_DATA *Data);
+ACPI_STATUS
+AcpiRsGetPrtMethodData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_BUFFER *RetBuffer);
-void
-AcpiRsDumpVendorSpecific (
- ACPI_RESOURCE_DATA *Data);
+ACPI_STATUS
+AcpiRsGetCrsMethodData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_BUFFER *RetBuffer);
-void
-AcpiRsDumpResourceList (
- ACPI_RESOURCE *Resource);
+ACPI_STATUS
+AcpiRsGetPrsMethodData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_BUFFER *RetBuffer);
-void
-AcpiRsDumpIrqList (
- UINT8 *RouteTable);
+ACPI_STATUS
+AcpiRsGetMethodData (
+ ACPI_HANDLE Handle,
+ char *Path,
+ ACPI_BUFFER *RetBuffer);
ACPI_STATUS
-AcpiRsGetByteStreamStart (
- UINT8 *ByteStreamBuffer,
- UINT8 **ByteStreamStart,
- UINT32 *Size);
+AcpiRsSetSrsMethodData (
+ ACPI_NAMESPACE_NODE *Node,
+ ACPI_BUFFER *RetBuffer);
+
+/*
+ * rscalc
+ */
ACPI_STATUS
AcpiRsGetListLength (
- UINT8 *ByteStreamBuffer,
- UINT32 ByteStreamBufferLength,
+ UINT8 *AmlBuffer,
+ UINT32 AmlBufferLength,
ACPI_SIZE *SizeNeeded);
ACPI_STATUS
-AcpiRsGetByteStreamLength (
+AcpiRsGetAmlLength (
ACPI_RESOURCE *LinkedListBuffer,
ACPI_SIZE *SizeNeeded);
@@ -252,214 +302,164 @@
ACPI_SIZE *BufferSizeNeeded);
ACPI_STATUS
-AcpiRsByteStreamToList (
- UINT8 *ByteStreamBuffer,
- UINT32 ByteStreamBufferLength,
- UINT8 *OutputBuffer);
+AcpiRsConvertAmlToResources (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context);
ACPI_STATUS
-AcpiRsListToByteStream (
- ACPI_RESOURCE *LinkedList,
- ACPI_SIZE ByteStreamSizeNeeded,
+AcpiRsConvertResourcesToAml (
+ ACPI_RESOURCE *Resource,
+ ACPI_SIZE AmlSizeNeeded,
UINT8 *OutputBuffer);
-ACPI_STATUS
-AcpiRsIoResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-
-ACPI_STATUS
-AcpiRsFixedIoResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-ACPI_STATUS
-AcpiRsIoStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-
-ACPI_STATUS
-AcpiRsFixedIoStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-
-ACPI_STATUS
-AcpiRsIrqResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-
-ACPI_STATUS
-AcpiRsIrqStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-
-ACPI_STATUS
-AcpiRsDmaResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-
-ACPI_STATUS
-AcpiRsDmaStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-
-ACPI_STATUS
-AcpiRsAddress16Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-
-ACPI_STATUS
-AcpiRsAddress16Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-
-ACPI_STATUS
-AcpiRsAddress32Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-
-ACPI_STATUS
-AcpiRsAddress32Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-
-ACPI_STATUS
-AcpiRsAddress64Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-
-ACPI_STATUS
-AcpiRsAddress64Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-
-ACPI_STATUS
-AcpiRsStartDependFnsResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-
-ACPI_STATUS
-AcpiRsEndDependFnsResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
+/*
+ * rsaddr
+ */
+void
+AcpiRsSetAddressCommon (
+ AML_RESOURCE *Aml,
+ ACPI_RESOURCE *Resource);
-ACPI_STATUS
-AcpiRsStartDependFnsStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
+BOOLEAN
+AcpiRsGetAddressCommon (
+ ACPI_RESOURCE *Resource,
+ AML_RESOURCE *Aml);
-ACPI_STATUS
-AcpiRsEndDependFnsStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
+/*
+ * rsmisc
+ */
ACPI_STATUS
-AcpiRsMemory24Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
+AcpiRsConvertAmlToResource (
+ ACPI_RESOURCE *Resource,
+ AML_RESOURCE *Aml,
+ ACPI_RSCONVERT_INFO *Info);
ACPI_STATUS
-AcpiRsMemory24Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
+AcpiRsConvertResourceToAml (
+ ACPI_RESOURCE *Resource,
+ AML_RESOURCE *Aml,
+ ACPI_RSCONVERT_INFO *Info);
-ACPI_STATUS
-AcpiRsMemory32RangeResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-ACPI_STATUS
-AcpiRsFixedMemory32Resource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
+/*
+ * rsutils
+ */
+void
+AcpiRsMoveData (
+ void *Destination,
+ void *Source,
+ UINT16 ItemCount,
+ UINT8 MoveType);
-ACPI_STATUS
-AcpiRsMemory32RangeStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
+UINT8
+AcpiRsDecodeBitmask (
+ UINT16 Mask,
+ UINT8 *List);
+
+UINT16
+AcpiRsEncodeBitmask (
+ UINT8 *List,
+ UINT8 Count);
+
+ACPI_RS_LENGTH
+AcpiRsGetResourceSource (
+ ACPI_RS_LENGTH ResourceLength,
+ ACPI_RS_LENGTH MinimumLength,
+ ACPI_RESOURCE_SOURCE *ResourceSource,
+ AML_RESOURCE *Aml,
+ char *StringPtr);
+
+ACPI_RSDESC_SIZE
+AcpiRsSetResourceSource (
+ AML_RESOURCE *Aml,
+ ACPI_RS_LENGTH MinimumLength,
+ ACPI_RESOURCE_SOURCE *ResourceSource);
+
+void
+AcpiRsSetResourceHeader (
+ UINT8 DescriptorType,
+ ACPI_RSDESC_SIZE TotalLength,
+ AML_RESOURCE *Aml);
+
+void
+AcpiRsSetResourceLength (
+ ACPI_RSDESC_SIZE TotalLength,
+ AML_RESOURCE *Aml);
-ACPI_STATUS
-AcpiRsFixedMemory32Stream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
-ACPI_STATUS
-AcpiRsExtendedIrqResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
+/*
+ * rsdump
+ */
+void
+AcpiRsDumpResourceList (
+ ACPI_RESOURCE *Resource);
-ACPI_STATUS
-AcpiRsExtendedIrqStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
+void
+AcpiRsDumpIrqList (
+ UINT8 *RouteTable);
-ACPI_STATUS
-AcpiRsEndTagResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-ACPI_STATUS
-AcpiRsEndTagStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
+/*
+ * Resource conversion tables
+ */
+extern ACPI_RSCONVERT_INFO AcpiRsConvertDma[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertEndDpf[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertIo[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedIo[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertEndTag[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory24[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertGenericReg[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertMemory32[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertFixedMemory32[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress32[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress16[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertExtIrq[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertAddress64[];
+extern ACPI_RSCONVERT_INFO AcpiRsConvertExtAddress64[];
+
+/* These resources require separate get/set tables */
+
+extern ACPI_RSCONVERT_INFO AcpiRsGetIrq[];
+extern ACPI_RSCONVERT_INFO AcpiRsGetStartDpf[];
+extern ACPI_RSCONVERT_INFO AcpiRsGetVendorSmall[];
+extern ACPI_RSCONVERT_INFO AcpiRsGetVendorLarge[];
+
+extern ACPI_RSCONVERT_INFO AcpiRsSetIrq[];
+extern ACPI_RSCONVERT_INFO AcpiRsSetStartDpf[];
+extern ACPI_RSCONVERT_INFO AcpiRsSetVendor[];
-ACPI_STATUS
-AcpiRsVendorResource (
- UINT8 *ByteStreamBuffer,
- ACPI_SIZE *BytesConsumed,
- UINT8 **OutputBuffer,
- ACPI_SIZE *StructureSize);
-ACPI_STATUS
-AcpiRsVendorStream (
- ACPI_RESOURCE *LinkedList,
- UINT8 **OutputBuffer,
- ACPI_SIZE *BytesConsumed);
+#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
+/*
+ * rsinfo
+ */
+extern ACPI_RSDUMP_INFO *AcpiGbl_DumpResourceDispatch[];
-UINT8
-AcpiRsGetResourceType (
- UINT8 ResourceStartByte);
+/*
+ * rsdump
+ */
+extern ACPI_RSDUMP_INFO AcpiRsDumpIrq[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpDma[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpStartDpf[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpEndDpf[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpIo[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpFixedIo[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpVendor[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpEndTag[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpMemory24[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpMemory32[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpFixedMemory32[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpAddress16[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpAddress32[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpAddress64[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpExtAddress64[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpExtIrq[];
+extern ACPI_RSDUMP_INFO AcpiRsDumpGenericReg[];
+#endif
#endif /* __ACRESRC_H__ */
Index: tbxface.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/tbxface.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/tbxface.c -L sys/contrib/dev/acpica/tbxface.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/tbxface.c
+++ sys/contrib/dev/acpica/tbxface.c
@@ -2,7 +2,7 @@
*
* Module Name: tbxface - Public interfaces to the ACPI subsystem
* ACPI table oriented interfaces
- * $Revision: 64 $
+ * $Revision: 1.86 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -121,421 +121,554 @@
#include <contrib/dev/acpica/acnamesp.h>
#include <contrib/dev/acpica/actables.h>
-
#define _COMPONENT ACPI_TABLES
ACPI_MODULE_NAME ("tbxface")
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiTbLoadNamespace (
+ void);
+
/*******************************************************************************
*
- * FUNCTION: AcpiLoadTables
+ * FUNCTION: AcpiAllocateRootTable
*
- * PARAMETERS: None
+ * PARAMETERS: InitialTableCount - Size of InitialTableArray, in number of
+ * ACPI_TABLE_DESC structures
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to load the ACPI tables from the
- * provided RSDT
+ * DESCRIPTION: Allocate a root table array. Used by iASL compiler and
+ * AcpiInitializeTables.
*
******************************************************************************/
ACPI_STATUS
-AcpiLoadTables (void)
+AcpiAllocateRootTable (
+ UINT32 InitialTableCount)
{
- ACPI_POINTER RsdpAddress;
- ACPI_STATUS Status;
+ AcpiGbl_RootTableList.Size = InitialTableCount;
+ AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE;
- ACPI_FUNCTION_TRACE ("AcpiLoadTables");
-
+ return (AcpiTbResizeRootTableList ());
+}
- /* Get the RSDP */
- Status = AcpiOsGetRootPointer (ACPI_LOGICAL_ADDRESSING,
- &RsdpAddress);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not get RSDP, %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
- }
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiInitializeTables
+ *
+ * PARAMETERS: InitialTableArray - Pointer to an array of pre-allocated
+ * ACPI_TABLE_DESC structures. If NULL, the
+ * array is dynamically allocated.
+ * InitialTableCount - Size of InitialTableArray, in number of
+ * ACPI_TABLE_DESC structures
+ * AllowRealloc - Flag to tell Table Manager if resize of
+ * pre-allocated array is allowed. Ignored
+ * if InitialTableArray is NULL.
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize the table manager, get the RSDP and RSDT/XSDT.
+ *
+ * NOTE: Allows static allocation of the initial table array in order
+ * to avoid the use of dynamic memory in confined environments
+ * such as the kernel boot sequence where it may not be available.
+ *
+ * If the host OS memory managers are initialized, use NULL for
+ * InitialTableArray, and the table will be dynamically allocated.
+ *
+ ******************************************************************************/
- /* Map and validate the RSDP */
+ACPI_STATUS
+AcpiInitializeTables (
+ ACPI_TABLE_DESC *InitialTableArray,
+ UINT32 InitialTableCount,
+ BOOLEAN AllowResize)
+{
+ ACPI_PHYSICAL_ADDRESS RsdpAddress;
+ ACPI_STATUS Status;
- AcpiGbl_TableFlags = RsdpAddress.PointerType;
- Status = AcpiTbVerifyRsdp (&RsdpAddress);
- if (ACPI_FAILURE (Status))
- {
- ACPI_REPORT_ERROR (("AcpiLoadTables: RSDP Failed validation: %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
- }
+ ACPI_FUNCTION_TRACE (AcpiInitializeTables);
- /* Get the RSDT via the RSDP */
- Status = AcpiTbGetTableRsdt ();
- if (ACPI_FAILURE (Status))
+ /*
+ * Set up the Root Table Array
+ * Allocate the table array if requested
+ */
+ if (!InitialTableArray)
{
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load RSDT: %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
+ Status = AcpiAllocateRootTable (InitialTableCount);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
}
-
- /* Now get the tables needed by this subsystem (FADT, DSDT, etc.) */
-
- Status = AcpiTbGetRequiredTables ();
- if (ACPI_FAILURE (Status))
+ else
{
- ACPI_REPORT_ERROR (("AcpiLoadTables: Error getting required tables (DSDT/FADT/FACS): %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
- }
+ /* Root Table Array has been statically allocated by the host */
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
+ ACPI_MEMSET (InitialTableArray, 0,
+ InitialTableCount * sizeof (ACPI_TABLE_DESC));
+ AcpiGbl_RootTableList.Tables = InitialTableArray;
+ AcpiGbl_RootTableList.Size = InitialTableCount;
+ AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN;
+ if (AllowResize)
+ {
+ AcpiGbl_RootTableList.Flags |= ACPI_ROOT_ALLOW_RESIZE;
+ }
+ }
- /* Load the namespace from the tables */
+ /* Get the address of the RSDP */
- Status = AcpiNsLoadNamespace ();
- if (ACPI_FAILURE (Status))
+ RsdpAddress = AcpiOsGetRootPointer ();
+ if (!RsdpAddress)
{
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load namespace: %s\n",
- AcpiFormatException (Status)));
- goto ErrorExit;
+ return_ACPI_STATUS (AE_NOT_FOUND);
}
- return_ACPI_STATUS (AE_OK);
-
-
-ErrorExit:
- ACPI_REPORT_ERROR (("AcpiLoadTables: Could not load tables: %s\n",
- AcpiFormatException (Status)));
-
+ /*
+ * Get the root table (RSDT or XSDT) and extract all entries to the local
+ * Root Table Array. This array contains the information of the RSDT/XSDT
+ * in a common, more useable format.
+ */
+ Status = AcpiTbParseRootTable (RsdpAddress, ACPI_TABLE_ORIGIN_MAPPED);
return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiInitializeTables)
+
/*******************************************************************************
*
- * FUNCTION: AcpiLoadTable
+ * FUNCTION: AcpiReallocateRootTable
*
- * PARAMETERS: TablePtr - pointer to a buffer containing the entire
- * table to be loaded
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to load a table from the caller's
- * buffer. The buffer must contain an entire ACPI Table including
- * a valid header. The header fields will be verified, and if it
- * is determined that the table is invalid, the call will fail.
+ * DESCRIPTION: Reallocate Root Table List into dynamic memory. Copies the
+ * root list from the previously provided scratch area. Should
+ * be called once dynamic memory allocation is available in the
+ * kernel
*
******************************************************************************/
ACPI_STATUS
-AcpiLoadTable (
- ACPI_TABLE_HEADER *TablePtr)
+AcpiReallocateRootTable (
+ void)
{
- ACPI_STATUS Status;
- ACPI_TABLE_DESC TableInfo;
- ACPI_POINTER Address;
+ ACPI_TABLE_DESC *Tables;
+ ACPI_SIZE NewSize;
- ACPI_FUNCTION_TRACE ("AcpiLoadTable");
+ ACPI_FUNCTION_TRACE (AcpiReallocateRootTable);
- if (!TablePtr)
+ /*
+ * Only reallocate the root table if the host provided a static buffer
+ * for the table array in the call to AcpiInitializeTables.
+ */
+ if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return_ACPI_STATUS (AE_SUPPORT);
}
- /* Copy the table to a local buffer */
+ NewSize = (AcpiGbl_RootTableList.Count + ACPI_ROOT_TABLE_SIZE_INCREMENT) *
+ sizeof (ACPI_TABLE_DESC);
- Address.PointerType = ACPI_LOGICAL_POINTER | ACPI_LOGICAL_ADDRESSING;
- Address.Pointer.Logical = TablePtr;
+ /* Create new array and copy the old array */
- Status = AcpiTbGetTableBody (&Address, TablePtr, &TableInfo);
- if (ACPI_FAILURE (Status))
+ Tables = ACPI_ALLOCATE_ZEROED (NewSize);
+ if (!Tables)
{
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
- /* Install the new table into the local data structures */
+ ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables, NewSize);
- Status = AcpiTbInstallTable (&TableInfo);
- if (ACPI_FAILURE (Status))
- {
- /* Free table allocated by AcpiTbGetTableBody */
+ AcpiGbl_RootTableList.Size = AcpiGbl_RootTableList.Count;
+ AcpiGbl_RootTableList.Tables = Tables;
+ AcpiGbl_RootTableList.Flags =
+ ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
- AcpiTbDeleteSingleTable (&TableInfo);
- return_ACPI_STATUS (Status);
- }
+ return_ACPI_STATUS (AE_OK);
+}
- /* Convert the table to common format if necessary */
+ACPI_EXPORT_SYMBOL (AcpiReallocateRootTable)
- switch (TableInfo.Type)
- {
- case ACPI_TABLE_FADT:
- Status = AcpiTbConvertTableFadt ();
- break;
+/******************************************************************************
+ *
+ * FUNCTION: AcpiGetTableHeader
+ *
+ * PARAMETERS: Signature - ACPI signature of needed table
+ * Instance - Which instance (for SSDTs)
+ * OutTableHeader - The pointer to the table header to fill
+ *
+ * RETURN: Status and pointer to mapped table header
+ *
+ * DESCRIPTION: Finds an ACPI table header.
+ *
+ * NOTE: Caller is responsible in unmapping the header with
+ * AcpiOsUnmapMemory
+ *
+ *****************************************************************************/
- case ACPI_TABLE_FACS:
+ACPI_STATUS
+AcpiGetTableHeader (
+ char *Signature,
+ ACPI_NATIVE_UINT Instance,
+ ACPI_TABLE_HEADER *OutTableHeader)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+ ACPI_TABLE_HEADER *Header;
- Status = AcpiTbBuildCommonFacs (&TableInfo);
- break;
- default:
- /* Load table into namespace if it contains executable AML */
+ /* Parameter validation */
- Status = AcpiNsLoadTable (TableInfo.InstalledDesc, AcpiGbl_RootNode);
- break;
+ if (!Signature || !OutTableHeader)
+ {
+ return (AE_BAD_PARAMETER);
}
- if (ACPI_FAILURE (Status))
+ /*
+ * Walk the root table list
+ */
+ for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
{
- /* Uninstall table and free the buffer */
+ if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ Signature))
+ {
+ continue;
+ }
+
+ if (++j < Instance)
+ {
+ continue;
+ }
+
+ if (!AcpiGbl_RootTableList.Tables[i].Pointer)
+ {
+ if ((AcpiGbl_RootTableList.Tables[i].Flags & ACPI_TABLE_ORIGIN_MASK) ==
+ ACPI_TABLE_ORIGIN_MAPPED)
+ {
+ Header = AcpiOsMapMemory (AcpiGbl_RootTableList.Tables[i].Address,
+ sizeof (ACPI_TABLE_HEADER));
+ if (!Header)
+ {
+ return AE_NO_MEMORY;
+ }
+
+ ACPI_MEMCPY (OutTableHeader, Header, sizeof(ACPI_TABLE_HEADER));
+ AcpiOsUnmapMemory (Header, sizeof(ACPI_TABLE_HEADER));
+ }
+
+ else
+ {
+ return AE_NOT_FOUND;
+ }
+ }
+
+ else
+ {
+ ACPI_MEMCPY (OutTableHeader, AcpiGbl_RootTableList.Tables[i].Pointer,
+ sizeof(ACPI_TABLE_HEADER));
+ }
- (void) AcpiTbUninstallTable (TableInfo.InstalledDesc);
+ return (AE_OK);
}
- return_ACPI_STATUS (Status);
+ return (AE_NOT_FOUND);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTableHeader)
-/*******************************************************************************
+
+/******************************************************************************
*
- * FUNCTION: AcpiUnloadTable
+ * FUNCTION: AcpiGetTable
*
- * PARAMETERS: TableType - Type of table to be unloaded
+ * PARAMETERS: Signature - ACPI signature of needed table
+ * Instance - Which instance (for SSDTs)
+ * OutTable - Where the pointer to the table is returned
*
- * RETURN: Status
+ * RETURN: Status and pointer to table
*
- * DESCRIPTION: This routine is used to force the unload of a table
+ * DESCRIPTION: Finds and verifies an ACPI table.
*
- ******************************************************************************/
+ *****************************************************************************/
ACPI_STATUS
-AcpiUnloadTable (
- ACPI_TABLE_TYPE TableType)
+AcpiGetTable (
+ char *Signature,
+ ACPI_NATIVE_UINT Instance,
+ ACPI_TABLE_HEADER **OutTable)
{
- ACPI_TABLE_DESC *TableDesc;
-
-
- ACPI_FUNCTION_TRACE ("AcpiUnloadTable");
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+ ACPI_STATUS Status;
/* Parameter validation */
- if (TableType > ACPI_TABLE_MAX)
+ if (!Signature || !OutTable)
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ return (AE_BAD_PARAMETER);
}
+ /*
+ * Walk the root table list
+ */
+ for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
+ {
+ if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ Signature))
+ {
+ continue;
+ }
- /* Find all tables of the requested type */
+ if (++j < Instance)
+ {
+ continue;
+ }
- TableDesc = AcpiGbl_TableLists[TableType].Next;
- while (TableDesc)
- {
- /*
- * Delete all namespace entries owned by this table. Note that these
- * entries can appear anywhere in the namespace by virtue of the AML
- * "Scope" operator. Thus, we need to track ownership by an ID, not
- * simply a position within the hierarchy
- */
- AcpiNsDeleteNamespaceByOwner (TableDesc->TableId);
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i]);
+ if (ACPI_SUCCESS (Status))
+ {
+ *OutTable = AcpiGbl_RootTableList.Tables[i].Pointer;
+ }
- TableDesc = TableDesc->Next;
+ return (Status);
}
- /* Delete (or unmap) all tables of this type */
-
- AcpiTbDeleteTablesByType (TableType);
- return_ACPI_STATUS (AE_OK);
+ return (AE_NOT_FOUND);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTable)
+
/*******************************************************************************
*
- * FUNCTION: AcpiGetTableHeader
+ * FUNCTION: AcpiGetTableByIndex
*
- * PARAMETERS: TableType - one of the defined table types
- * Instance - the non zero instance of the table, allows
- * support for multiple tables of the same type
- * see AcpiGbl_AcpiTableFlag
- * OutTableHeader - pointer to the ACPI_TABLE_HEADER if successful
- *
- * DESCRIPTION: This function is called to get an ACPI table header. The caller
- * supplies an pointer to a data area sufficient to contain an ACPI
- * ACPI_TABLE_HEADER structure.
- *
- * The header contains a length field that can be used to determine
- * the size of the buffer needed to contain the entire table. This
- * function is not valid for the RSD PTR table since it does not
- * have a standard header and is fixed length.
+ * PARAMETERS: TableIndex - Table index
+ * Table - Where the pointer to the table is returned
+ *
+ * RETURN: Status and pointer to the table
+ *
+ * DESCRIPTION: Obtain a table by an index into the global table list.
*
******************************************************************************/
ACPI_STATUS
-AcpiGetTableHeader (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_TABLE_HEADER *OutTableHeader)
+AcpiGetTableByIndex (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_TABLE_HEADER **Table)
{
- ACPI_TABLE_HEADER *TblPtr;
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE ("AcpiGetTableHeader");
+ ACPI_FUNCTION_TRACE (AcpiGetTableByIndex);
- if ((Instance == 0) ||
- (TableType == ACPI_TABLE_RSDP) ||
- (!OutTableHeader))
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- /* Check the table type and instance */
+ /* Parameter validation */
- if ((TableType > ACPI_TABLE_MAX) ||
- (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
- Instance > 1))
+ if (!Table)
{
return_ACPI_STATUS (AE_BAD_PARAMETER);
}
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- /* Get a pointer to the entire table */
+ /* Validate index */
- Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr);
- if (ACPI_FAILURE (Status))
+ if (TableIndex >= AcpiGbl_RootTableList.Count)
{
- return_ACPI_STATUS (Status);
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (AE_BAD_PARAMETER);
}
- /*
- * The function will return a NULL pointer if the table is not loaded
- */
- if (TblPtr == NULL)
+ if (!AcpiGbl_RootTableList.Tables[TableIndex].Pointer)
{
- return_ACPI_STATUS (AE_NOT_EXIST);
- }
+ /* Table is not mapped, map it */
- /*
- * Copy the header to the caller's buffer
- */
- ACPI_MEMCPY ((void *) OutTableHeader, (void *) TblPtr,
- sizeof (ACPI_TABLE_HEADER));
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[TableIndex]);
+ if (ACPI_FAILURE (Status))
+ {
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+ }
+ }
- return_ACPI_STATUS (Status);
+ *Table = AcpiGbl_RootTableList.Tables[TableIndex].Pointer;
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (AE_OK);
}
+ACPI_EXPORT_SYMBOL (AcpiGetTableByIndex)
+
/*******************************************************************************
*
- * FUNCTION: AcpiGetTable
+ * FUNCTION: AcpiTbLoadNamespace
*
- * PARAMETERS: TableType - one of the defined table types
- * Instance - the non zero instance of the table, allows
- * support for multiple tables of the same type
- * see AcpiGbl_AcpiTableFlag
- * RetBuffer - pointer to a structure containing a buffer to
- * receive the table
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: This function is called to get an ACPI table. The caller
- * supplies an OutBuffer large enough to contain the entire ACPI
- * table. The caller should call the AcpiGetTableHeader function
- * first to determine the buffer size needed. Upon completion
- * the OutBuffer->Length field will indicate the number of bytes
- * copied into the OutBuffer->BufPtr buffer. This table will be
- * a complete table including the header.
+ * DESCRIPTION: Load the namespace from the DSDT and all SSDTs/PSDTs found in
+ * the RSDT/XSDT.
*
******************************************************************************/
-ACPI_STATUS
-AcpiGetTable (
- ACPI_TABLE_TYPE TableType,
- UINT32 Instance,
- ACPI_BUFFER *RetBuffer)
+static ACPI_STATUS
+AcpiTbLoadNamespace (
+ void)
{
- ACPI_TABLE_HEADER *TblPtr;
ACPI_STATUS Status;
- ACPI_SIZE TableLength;
+ ACPI_TABLE_HEADER *Table;
+ ACPI_NATIVE_UINT i;
+ BOOLEAN DsdtOverriden;
- ACPI_FUNCTION_TRACE ("AcpiGetTable");
+ ACPI_FUNCTION_TRACE (TbLoadNamespace);
- /* Parameter validation */
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (Instance == 0)
+ /*
+ * Load the namespace. The DSDT is required, but any SSDT and PSDT tables
+ * are optional.
+ */
+ if (!AcpiGbl_RootTableList.Count ||
+ !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
+ ACPI_SIG_DSDT) ||
+ ACPI_FAILURE (AcpiTbVerifyTable(&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT])))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
+ Status = AE_NO_ACPI_TABLES;
+ goto UnlockAndExit;
}
- Status = AcpiUtValidateBuffer (RetBuffer);
- if (ACPI_FAILURE (Status))
+ /*
+ * Find DSDT table
+ */
+ DsdtOverriden = FALSE;
+ Status = AcpiOsTableOverride (
+ AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer, &Table);
+ if (ACPI_SUCCESS (Status) && Table)
{
- return_ACPI_STATUS (Status);
- }
+ /*
+ * DSDT table has been found
+ */
+ AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]);
+ AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Pointer = Table;
+ AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Length = Table->Length;
+ AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Flags = ACPI_TABLE_ORIGIN_UNKNOWN;
+ DsdtOverriden = TRUE;
- /* Check the table type and instance */
+ ACPI_INFO ((AE_INFO, "Table DSDT replaced by host OS"));
+ AcpiTbPrintTableHeader (0, Table);
+ }
- if ((TableType > ACPI_TABLE_MAX) ||
- (ACPI_IS_SINGLE_TABLE (AcpiGbl_TableData[TableType].Flags) &&
- Instance > 1))
+ Status = AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT]);
+ if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
+ /* A valid DSDT is required */
+ Status = AE_NO_ACPI_TABLES;
+ goto UnlockAndExit;
+ }
- /* Get a pointer to the entire table */
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
- Status = AcpiTbGetTablePtr (TableType, Instance, &TblPtr);
+ /*
+ * Load and parse tables.
+ */
+ Status = AcpiNsLoadTable (ACPI_TABLE_INDEX_DSDT, AcpiGbl_RootNode);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
}
/*
- * AcpiTbGetTablePtr will return a NULL pointer if the
- * table is not loaded.
+ * Load any SSDT or PSDT tables. Note: Loop leaves tables locked
*/
- if (TblPtr == NULL)
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
+ for (i = 2; i < AcpiGbl_RootTableList.Count; ++i)
{
- return_ACPI_STATUS (AE_NOT_EXIST);
+ if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ ACPI_SIG_SSDT) &&
+ !ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ ACPI_SIG_PSDT)) ||
+ ACPI_FAILURE (AcpiTbVerifyTable (&AcpiGbl_RootTableList.Tables[i])))
+ {
+ continue;
+ }
+
+ /* Delete SSDT when DSDT is overriden */
+
+ if (ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
+ ACPI_SIG_SSDT) && DsdtOverriden)
+ {
+ AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
+ continue;
+ }
+
+ /* Ignore errors while loading tables, get as many as possible */
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ (void) AcpiNsLoadTable (i, AcpiGbl_RootNode);
+ (void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
}
- /* Get the table length */
+ ACPI_DEBUG_PRINT ((ACPI_DB_INIT, "ACPI Tables successfully acquired\n"));
+
+UnlockAndExit:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
+ return_ACPI_STATUS (Status);
+}
- if (TableType == ACPI_TABLE_RSDP)
- {
- /*
- * RSD PTR is the only "table" without a header
- */
- TableLength = sizeof (RSDP_DESCRIPTOR);
- }
- else
- {
- TableLength = (ACPI_SIZE) TblPtr->Length;
- }
- /* Validate/Allocate/Clear caller buffer */
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiLoadTables
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Load the ACPI tables from the RSDT/XSDT
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiLoadTables (
+ void)
+{
+ ACPI_STATUS Status;
+
- Status = AcpiUtInitializeBuffer (RetBuffer, TableLength);
+ ACPI_FUNCTION_TRACE (AcpiLoadTables);
+
+
+ /*
+ * Load the namespace from the tables
+ */
+ Status = AcpiTbLoadNamespace ();
if (ACPI_FAILURE (Status))
{
- return_ACPI_STATUS (Status);
+ ACPI_EXCEPTION ((AE_INFO, Status, "While loading namespace from ACPI tables"));
}
- /* Copy the table to the buffer */
-
- ACPI_MEMCPY ((void *) RetBuffer->Pointer, (void *) TblPtr, TableLength);
- return_ACPI_STATUS (AE_OK);
+ return_ACPI_STATUS (Status);
}
+ACPI_EXPORT_SYMBOL (AcpiLoadTables)
Index: acdebug.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acdebug.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acdebug.h -L sys/contrib/dev/acpica/acdebug.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acdebug.h
+++ sys/contrib/dev/acpica/acdebug.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdebug.h - ACPI/AML debugger
- * $Revision: 75 $
+ * $Revision: 1.84 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -136,9 +136,7 @@
#define PARAM_LIST(pl) pl
-
#define DBTEST_OUTPUT_LEVEL(lvl) if (AcpiGbl_DbOpt_verbose)
-
#define VERBOSE_PRINT(fp) DBTEST_OUTPUT_LEVEL(lvl) {\
AcpiOsPrintf PARAM_LIST(fp);}
@@ -146,13 +144,9 @@
#define EX_SINGLE_STEP 2
-/* Prototypes */
-
-
/*
* dbxface - external debugger interfaces
*/
-
ACPI_STATUS
AcpiDbInitialize (
void);
@@ -167,20 +161,10 @@
ACPI_PARSE_OBJECT *Op,
UINT32 OpType);
-ACPI_STATUS
-AcpiDbStartCommand (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op);
-
-void
-AcpiDbMethodEnd (
- ACPI_WALK_STATE *WalkState);
-
/*
* dbcmds - debug commands and output routines
*/
-
ACPI_STATUS
AcpiDbDisassembleMethod (
char *Name);
@@ -205,6 +189,10 @@
ACPI_PARSE_OBJECT *Op);
void
+AcpiDbGetBusInfo (
+ void);
+
+void
AcpiDbDisassembleAml (
char *Statements,
ACPI_PARSE_OBJECT *Op);
@@ -252,57 +240,30 @@
char *ObjectArg);
void
-AcpiDbDisplayLocks (void);
-
+AcpiDbDisplayLocks (
+ void);
void
AcpiDbDisplayResources (
char *ObjectArg);
void
-AcpiDbDisplayGpes (void);
+AcpiDbDisplayGpes (
+ void);
void
AcpiDbCheckIntegrity (
void);
-ACPI_STATUS
-AcpiDbIntegrityWalk (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-ACPI_STATUS
-AcpiDbWalkAndMatchName (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-ACPI_STATUS
-AcpiDbWalkForReferences (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-ACPI_STATUS
-AcpiDbWalkForSpecificObjects (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
void
AcpiDbGenerateGpe (
char *GpeArg,
char *BlockArg);
+
/*
* dbdisply - debug display commands
*/
-
void
AcpiDbDisplayMethodInfo (
ACPI_PARSE_OBJECT *Op);
@@ -346,19 +307,10 @@
ACPI_OPERAND_OBJECT *ObjDesc,
ACPI_WALK_STATE *WalkState);
-void
-AcpiDbDumpParserDescriptor (
- ACPI_PARSE_OBJECT *Op);
-
-void *
-AcpiDbGetPointer (
- void *Target);
-
/*
* dbexec - debugger control method execution
*/
-
void
AcpiDbExecute (
char *Name,
@@ -371,44 +323,21 @@
char *NumLoopsArg,
char *MethodNameArg);
-ACPI_STATUS
-AcpiDbExecuteMethod (
- ACPI_DB_METHOD_INFO *Info,
- ACPI_BUFFER *ReturnObj);
-
-void
-AcpiDbExecuteSetup (
- ACPI_DB_METHOD_INFO *Info);
-
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
UINT32
-AcpiDbGetOutstandingAllocations (
- void);
-
-void ACPI_SYSTEM_XFACE
-AcpiDbMethodThread (
- void *Context);
-
-ACPI_STATUS
-AcpiDbExecutionWalk (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
+AcpiDbGetCacheInfo (
+ ACPI_MEMORY_LIST *Cache);
+#endif
/*
* dbfileio - Debugger file I/O commands
*/
-
ACPI_OBJECT_TYPE
AcpiDbMatchArgument (
char *UserArgument,
ARGUMENT_INFO *Arguments);
-ACPI_STATUS
-AeLocalLoadTable (
- ACPI_TABLE_HEADER *TablePtr);
-
void
AcpiDbCloseDebugFile (
void);
@@ -431,16 +360,17 @@
char *Filename,
ACPI_TABLE_HEADER **Table);
+
/*
* dbhistry - debugger HISTORY command
*/
-
void
AcpiDbAddToHistory (
char *CommandLine);
void
-AcpiDbDisplayHistory (void);
+AcpiDbDisplayHistory (
+ void);
char *
AcpiDbGetFromHistory (
@@ -450,7 +380,6 @@
/*
* dbinput - user front-end to the AML debugger
*/
-
ACPI_STATUS
AcpiDbCommandDispatch (
char *InputBuffer,
@@ -466,72 +395,29 @@
char Prompt,
ACPI_PARSE_OBJECT *Op);
-void
-AcpiDbDisplayHelp (
- char *HelpType);
-
-char *
-AcpiDbGetNextToken (
- char *String,
- char **Next);
-
-UINT32
-AcpiDbGetLine (
- char *InputBuffer);
-
-UINT32
-AcpiDbMatchCommand (
- char *UserCommand);
-
-void
-AcpiDbSingleThread (
- void);
-
/*
* dbstats - Generation and display of ACPI table statistics
*/
-
void
AcpiDbGenerateStatistics (
ACPI_PARSE_OBJECT *Root,
BOOLEAN IsMethod);
-
ACPI_STATUS
AcpiDbDisplayStatistics (
char *TypeArg);
-ACPI_STATUS
-AcpiDbClassifyOneObject (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
-
-void
-AcpiDbCountNamespaceObjects (
- void);
-
-void
-AcpiDbEnumerateObject (
- ACPI_OPERAND_OBJECT *ObjDesc);
-
/*
* dbutils - AML debugger utilities
*/
-
void
AcpiDbSetOutputDestination (
UINT32 Where);
void
-AcpiDbDumpBuffer (
- UINT32 Address);
-
-void
-AcpiDbDumpObject (
+AcpiDbDumpExternalObject (
ACPI_OBJECT *ObjDesc,
UINT32 Level);
@@ -539,14 +425,13 @@
AcpiDbPrepNamestring (
char *Name);
-
-ACPI_STATUS
-AcpiDbSecondPassParse (
- ACPI_PARSE_OBJECT *Root);
-
ACPI_NAMESPACE_NODE *
AcpiDbLocalNsLookup (
char *Name);
+void
+AcpiDbUInt32ToHexString (
+ UINT32 Value,
+ char *Buffer);
#endif /* __ACDEBUG_H__ */
Index: exstorob.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exstorob.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exstorob.c -L sys/contrib/dev/acpica/exstorob.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exstorob.c
+++ sys/contrib/dev/acpica/exstorob.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exstorob - AML Interpreter object store support, store to object
- * $Revision: 51 $
+ * $Revision: 1.62 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -147,13 +147,12 @@
UINT8 *Buffer;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreBufferToBuffer", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreBufferToBuffer, SourceDesc);
- /*
- * We know that SourceDesc is a buffer by now
- */
- Buffer = (UINT8 *) SourceDesc->Buffer.Pointer;
+ /* We know that SourceDesc is a buffer by now */
+
+ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->Buffer.Pointer);
Length = SourceDesc->Buffer.Length;
/*
@@ -163,42 +162,63 @@
if ((TargetDesc->Buffer.Length == 0) ||
(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER))
{
- TargetDesc->Buffer.Pointer = ACPI_MEM_ALLOCATE (Length);
+ TargetDesc->Buffer.Pointer = ACPI_ALLOCATE (Length);
if (!TargetDesc->Buffer.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
}
- TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
TargetDesc->Buffer.Length = Length;
}
- /*
- * Buffer is a static allocation,
- * only place what will fit in the buffer.
- */
+ /* Copy source buffer to target buffer */
+
if (Length <= TargetDesc->Buffer.Length)
{
/* Clear existing buffer and copy in the new one */
ACPI_MEMSET (TargetDesc->Buffer.Pointer, 0, TargetDesc->Buffer.Length);
ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, Length);
+
+#ifdef ACPI_OBSOLETE_BEHAVIOR
+ /*
+ * NOTE: ACPI versions up to 3.0 specified that the buffer must be
+ * truncated if the string is smaller than the buffer. However, "other"
+ * implementations of ACPI never did this and thus became the defacto
+ * standard. ACPI 3.0A changes this behavior such that the buffer
+ * is no longer truncated.
+ */
+
+ /*
+ * OBSOLETE BEHAVIOR:
+ * If the original source was a string, we must truncate the buffer,
+ * according to the ACPI spec. Integer-to-Buffer and Buffer-to-Buffer
+ * copy must not truncate the original buffer.
+ */
+ if (OriginalSrcType == ACPI_TYPE_STRING)
+ {
+ /* Set the new length of the target */
+
+ TargetDesc->Buffer.Length = Length;
+ }
+#endif
}
else
{
- /*
- * Truncate the source, copy only what will fit
- */
- ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer, TargetDesc->Buffer.Length);
+ /* Truncate the source, copy only what will fit */
+
+ ACPI_MEMCPY (TargetDesc->Buffer.Pointer, Buffer,
+ TargetDesc->Buffer.Length);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "Truncating src buffer from %X to %X\n",
+ "Truncating source buffer from %X to %X\n",
Length, TargetDesc->Buffer.Length));
}
/* Copy flags */
TargetDesc->Buffer.Flags = SourceDesc->Buffer.Flags;
+ TargetDesc->Common.Flags &= ~AOPOBJ_STATIC_POINTER;
return_ACPI_STATUS (AE_OK);
}
@@ -225,13 +245,12 @@
UINT8 *Buffer;
- ACPI_FUNCTION_TRACE_PTR ("ExStoreStringToString", SourceDesc);
+ ACPI_FUNCTION_TRACE_PTR (ExStoreStringToString, SourceDesc);
- /*
- * We know that SourceDesc is a string by now.
- */
- Buffer = (UINT8 *) SourceDesc->String.Pointer;
+ /* We know that SourceDesc is a string by now */
+
+ Buffer = ACPI_CAST_PTR (UINT8, SourceDesc->String.Pointer);
Length = SourceDesc->String.Length;
/*
@@ -245,7 +264,8 @@
* String will fit in existing non-static buffer.
* Clear old string and copy in the new one
*/
- ACPI_MEMSET (TargetDesc->String.Pointer, 0, (ACPI_SIZE) TargetDesc->String.Length + 1);
+ ACPI_MEMSET (TargetDesc->String.Pointer, 0,
+ (ACPI_SIZE) TargetDesc->String.Length + 1);
ACPI_MEMCPY (TargetDesc->String.Pointer, Buffer, Length);
}
else
@@ -257,13 +277,13 @@
if (TargetDesc->String.Pointer &&
(!(TargetDesc->Common.Flags & AOPOBJ_STATIC_POINTER)))
{
- /*
- * Only free if not a pointer into the DSDT
- */
- ACPI_MEM_FREE (TargetDesc->String.Pointer);
+ /* Only free if not a pointer into the DSDT */
+
+ ACPI_FREE (TargetDesc->String.Pointer);
}
- TargetDesc->String.Pointer = ACPI_MEM_CALLOCATE ((ACPI_SIZE) Length + 1);
+ TargetDesc->String.Pointer = ACPI_ALLOCATE_ZEROED (
+ (ACPI_SIZE) Length + 1);
if (!TargetDesc->String.Pointer)
{
return_ACPI_STATUS (AE_NO_MEMORY);
Index: utalloc.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/utalloc.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/utalloc.c -L sys/contrib/dev/acpica/utalloc.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/utalloc.c
+++ sys/contrib/dev/acpica/utalloc.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: utalloc - local cache and memory allocation routines
- * $Revision: 138 $
+ * Module Name: utalloc - local memory allocation routines
+ * $Revision: 1.164 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,183 +117,150 @@
#define __UTALLOC_C__
#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdebug.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utalloc")
-/******************************************************************************
+/*******************************************************************************
*
- * FUNCTION: AcpiUtReleaseToCache
+ * FUNCTION: AcpiUtCreateCaches
*
- * PARAMETERS: ListId - Memory list/cache ID
- * Object - The object to be released
+ * PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
- * DESCRIPTION: Release an object to the specified cache. If cache is full,
- * the object is deleted.
+ * DESCRIPTION: Create all local caches
*
******************************************************************************/
-void
-AcpiUtReleaseToCache (
- UINT32 ListId,
- void *Object)
+ACPI_STATUS
+AcpiUtCreateCaches (
+ void)
{
- ACPI_MEMORY_LIST *CacheInfo;
+ ACPI_STATUS Status;
- ACPI_FUNCTION_ENTRY ();
+ /* Object Caches, for frequently used objects */
+ Status = AcpiOsCreateCache ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE),
+ ACPI_MAX_NAMESPACE_CACHE_DEPTH, &AcpiGbl_NamespaceCache);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- /* If walk cache is full, just free this wallkstate object */
+ Status = AcpiOsCreateCache ("Acpi-State", sizeof (ACPI_GENERIC_STATE),
+ ACPI_MAX_STATE_CACHE_DEPTH, &AcpiGbl_StateCache);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- CacheInfo = &AcpiGbl_MemoryLists[ListId];
- if (CacheInfo->CacheDepth >= CacheInfo->MaxCacheDepth)
+ Status = AcpiOsCreateCache ("Acpi-Parse", sizeof (ACPI_PARSE_OBJ_COMMON),
+ ACPI_MAX_PARSE_CACHE_DEPTH, &AcpiGbl_PsNodeCache);
+ if (ACPI_FAILURE (Status))
{
- ACPI_MEM_FREE (Object);
- ACPI_MEM_TRACKING (CacheInfo->TotalFreed++);
+ return (Status);
}
- /* Otherwise put this object back into the cache */
+ Status = AcpiOsCreateCache ("Acpi-ParseExt", sizeof (ACPI_PARSE_OBJ_NAMED),
+ ACPI_MAX_EXTPARSE_CACHE_DEPTH, &AcpiGbl_PsNodeExtCache);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- else
+ Status = AcpiOsCreateCache ("Acpi-Operand", sizeof (ACPI_OPERAND_OBJECT),
+ ACPI_MAX_OBJECT_CACHE_DEPTH, &AcpiGbl_OperandCache);
+ if (ACPI_FAILURE (Status))
{
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
- {
- return;
- }
+ return (Status);
+ }
- /* Mark the object as cached */
- ACPI_MEMSET (Object, 0xCA, CacheInfo->ObjectSize);
- ACPI_SET_DESCRIPTOR_TYPE (Object, ACPI_DESC_TYPE_CACHED);
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- /* Put the object at the head of the cache list */
+ /* Memory allocation lists */
- * (ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset]))) = CacheInfo->ListHead;
- CacheInfo->ListHead = Object;
- CacheInfo->CacheDepth++;
+ Status = AcpiUtCreateList ("Acpi-Global", 0,
+ &AcpiGbl_GlobalList);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
- (void) AcpiUtReleaseMutex (ACPI_MTX_CACHES);
+ Status = AcpiUtCreateList ("Acpi-Namespace", sizeof (ACPI_NAMESPACE_NODE),
+ &AcpiGbl_NsNodeList);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
}
+#endif
+
+ return (AE_OK);
}
-/******************************************************************************
+/*******************************************************************************
*
- * FUNCTION: AcpiUtAcquireFromCache
+ * FUNCTION: AcpiUtDeleteCaches
*
- * PARAMETERS: ListId - Memory list ID
+ * PARAMETERS: None
*
- * RETURN: A requested object. NULL if the object could not be
- * allocated.
+ * RETURN: Status
*
- * DESCRIPTION: Get an object from the specified cache. If cache is empty,
- * the object is allocated.
+ * DESCRIPTION: Purge and delete all local caches
*
******************************************************************************/
-void *
-AcpiUtAcquireFromCache (
- UINT32 ListId)
+ACPI_STATUS
+AcpiUtDeleteCaches (
+ void)
{
- ACPI_MEMORY_LIST *CacheInfo;
- void *Object;
-
-
- ACPI_FUNCTION_NAME ("UtAcquireFromCache");
-
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ char Buffer[7];
- CacheInfo = &AcpiGbl_MemoryLists[ListId];
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_CACHES)))
+ if (AcpiGbl_DisplayFinalMemStats)
{
- return (NULL);
+ ACPI_STRCPY (Buffer, "MEMORY");
+ AcpiDbDisplayStatistics (Buffer);
}
-
- ACPI_MEM_TRACKING (CacheInfo->CacheRequests++);
-
- /* Check the cache first */
-
- if (CacheInfo->ListHead)
- {
- /* There is an object available, use it */
-
- Object = CacheInfo->ListHead;
- CacheInfo->ListHead = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) Object)[CacheInfo->LinkOffset])));
-
- ACPI_MEM_TRACKING (CacheInfo->CacheHits++);
- CacheInfo->CacheDepth--;
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- ACPI_DEBUG_PRINT ((ACPI_DB_EXEC, "Object %p from %s\n",
- Object, AcpiGbl_MemoryLists[ListId].ListName));
#endif
- if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
- {
- return (NULL);
- }
-
- /* Clear (zero) the previously used Object */
-
- ACPI_MEMSET (Object, 0, CacheInfo->ObjectSize);
- }
+ (void) AcpiOsDeleteCache (AcpiGbl_NamespaceCache);
+ AcpiGbl_NamespaceCache = NULL;
- else
- {
- /* The cache is empty, create a new object */
+ (void) AcpiOsDeleteCache (AcpiGbl_StateCache);
+ AcpiGbl_StateCache = NULL;
- /* Avoid deadlock with ACPI_MEM_CALLOCATE */
+ (void) AcpiOsDeleteCache (AcpiGbl_OperandCache);
+ AcpiGbl_OperandCache = NULL;
- if (ACPI_FAILURE (AcpiUtReleaseMutex (ACPI_MTX_CACHES)))
- {
- return (NULL);
- }
+ (void) AcpiOsDeleteCache (AcpiGbl_PsNodeCache);
+ AcpiGbl_PsNodeCache = NULL;
- Object = ACPI_MEM_CALLOCATE (CacheInfo->ObjectSize);
- ACPI_MEM_TRACKING (CacheInfo->TotalAllocated++);
- }
+ (void) AcpiOsDeleteCache (AcpiGbl_PsNodeExtCache);
+ AcpiGbl_PsNodeExtCache = NULL;
- return (Object);
-}
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-/******************************************************************************
- *
- * FUNCTION: AcpiUtDeleteGenericCache
- *
- * PARAMETERS: ListId - Memory list ID
- *
- * RETURN: None
- *
- * DESCRIPTION: Free all objects within the requested cache.
- *
- ******************************************************************************/
-
-void
-AcpiUtDeleteGenericCache (
- UINT32 ListId)
-{
- ACPI_MEMORY_LIST *CacheInfo;
- char *Next;
-
+ /* Debug only - display leftover memory allocation, if any */
- ACPI_FUNCTION_ENTRY ();
+ AcpiUtDumpAllocations (ACPI_UINT32_MAX, NULL);
+ /* Free memory lists */
- CacheInfo = &AcpiGbl_MemoryLists[ListId];
- while (CacheInfo->ListHead)
- {
- /* Delete one cached state object */
+ AcpiOsFree (AcpiGbl_GlobalList);
+ AcpiGbl_GlobalList = NULL;
- Next = *(ACPI_CAST_INDIRECT_PTR (char, &(((char *) CacheInfo->ListHead)[CacheInfo->LinkOffset])));
- ACPI_MEM_FREE (CacheInfo->ListHead);
+ AcpiOsFree (AcpiGbl_NsNodeList);
+ AcpiGbl_NsNodeList = NULL;
+#endif
- CacheInfo->ListHead = Next;
- CacheInfo->CacheDepth--;
- }
+ return (AE_OK);
}
@@ -393,7 +360,7 @@
/* Allocate a new buffer with local interface to allow tracking */
- Buffer->Pointer = ACPI_MEM_CALLOCATE (RequiredLength);
+ Buffer->Pointer = ACPI_ALLOCATE_ZEROED (RequiredLength);
if (!Buffer->Pointer)
{
return (AE_NO_MEMORY);
@@ -433,7 +400,7 @@
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
- * DESCRIPTION: The subsystem's equivalent of malloc.
+ * DESCRIPTION: Subsystem equivalent of malloc.
*
******************************************************************************/
@@ -447,15 +414,15 @@
void *Allocation;
- ACPI_FUNCTION_TRACE_U32 ("UtAllocate", Size);
+ ACPI_FUNCTION_TRACE_U32 (UtAllocate, Size);
/* Check for an inadvertent size of zero bytes */
if (!Size)
{
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtAllocate: Attempt to allocate zero bytes\n"));
+ ACPI_WARNING ((Module, Line,
+ "Attempt to allocate zero bytes, allocating 1 byte"));
Size = 1;
}
@@ -464,8 +431,8 @@
{
/* Report allocation error */
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtAllocate: Could not allocate size %X\n", (UINT32) Size));
+ ACPI_WARNING ((Module, Line,
+ "Could not allocate size %X", (UINT32) Size));
return_PTR (NULL);
}
@@ -476,7 +443,7 @@
/*******************************************************************************
*
- * FUNCTION: AcpiUtCallocate
+ * FUNCTION: AcpiUtAllocateZeroed
*
* PARAMETERS: Size - Size of the allocation
* Component - Component type of caller
@@ -485,12 +452,12 @@
*
* RETURN: Address of the allocated memory on success, NULL on failure.
*
- * DESCRIPTION: Subsystem equivalent of calloc.
+ * DESCRIPTION: Subsystem equivalent of calloc. Allocate and zero memory.
*
******************************************************************************/
void *
-AcpiUtCallocate (
+AcpiUtAllocateZeroed (
ACPI_SIZE Size,
UINT32 Component,
char *Module,
@@ -499,585 +466,17 @@
void *Allocation;
- ACPI_FUNCTION_TRACE_U32 ("UtCallocate", Size);
-
-
- /* Check for an inadvertent size of zero bytes */
-
- if (!Size)
- {
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Attempt to allocate zero bytes\n"));
- return_PTR (NULL);
- }
-
- Allocation = AcpiOsAllocate (Size);
- if (!Allocation)
- {
- /* Report allocation error */
-
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Could not allocate size %X\n", (UINT32) Size));
- return_PTR (NULL);
- }
-
- /* Clear the memory block */
-
- ACPI_MEMSET (Allocation, 0, Size);
- return_PTR (Allocation);
-}
-
-
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
-/*
- * These procedures are used for tracking memory leaks in the subsystem, and
- * they get compiled out when the ACPI_DBG_TRACK_ALLOCATIONS is not set.
- *
- * Each memory allocation is tracked via a doubly linked list. Each
- * element contains the caller's component, module name, function name, and
- * line number. AcpiUtAllocate and AcpiUtCallocate call
- * AcpiUtTrackAllocation to add an element to the list; deletion
- * occurs in the body of AcpiUtFree.
- */
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtAllocateAndTrack
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: The subsystem's equivalent of malloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtAllocateAndTrack (
- ACPI_SIZE Size,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *Allocation;
- ACPI_STATUS Status;
-
-
- Allocation = AcpiUtAllocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER), Component,
- Module, Line);
- if (!Allocation)
- {
- return (NULL);
- }
-
- Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
- ACPI_MEM_MALLOC, Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsFree (Allocation);
- return (NULL);
- }
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
-
- return ((void *) &Allocation->UserSpace);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtCallocateAndTrack
- *
- * PARAMETERS: Size - Size of the allocation
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: Address of the allocated memory on success, NULL on failure.
- *
- * DESCRIPTION: Subsystem equivalent of calloc.
- *
- ******************************************************************************/
-
-void *
-AcpiUtCallocateAndTrack (
- ACPI_SIZE Size,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *Allocation;
- ACPI_STATUS Status;
-
-
- Allocation = AcpiUtCallocate (Size + sizeof (ACPI_DEBUG_MEM_HEADER), Component,
- Module, Line);
- if (!Allocation)
- {
- /* Report allocation error */
-
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtCallocate: Could not allocate size %X\n", (UINT32) Size));
- return (NULL);
- }
-
- Status = AcpiUtTrackAllocation (ACPI_MEM_LIST_GLOBAL, Allocation, Size,
- ACPI_MEM_CALLOC, Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- AcpiOsFree (Allocation);
- return (NULL);
- }
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalAllocated++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize += (UINT32) Size;
-
- return ((void *) &Allocation->UserSpace);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtFreeAndTrack
- *
- * PARAMETERS: Allocation - Address of the memory to deallocate
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: None
- *
- * DESCRIPTION: Frees the memory at Allocation
- *
- ******************************************************************************/
-
-void
-AcpiUtFreeAndTrack (
- void *Allocation,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_DEBUG_MEM_BLOCK *DebugBlock;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE_PTR ("UtFree", Allocation);
-
-
- if (NULL == Allocation)
- {
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("AcpiUtFree: Attempt to delete a NULL address\n"));
-
- return_VOID;
- }
-
- DebugBlock = ACPI_CAST_PTR (ACPI_DEBUG_MEM_BLOCK,
- (((char *) Allocation) - sizeof (ACPI_DEBUG_MEM_HEADER)));
-
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].TotalFreed++;
- AcpiGbl_MemoryLists[ACPI_MEM_LIST_GLOBAL].CurrentTotalSize -= DebugBlock->Size;
-
- Status = AcpiUtRemoveAllocation (ACPI_MEM_LIST_GLOBAL, DebugBlock,
- Component, Module, Line);
- if (ACPI_FAILURE (Status))
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not free memory, %s\n",
- AcpiFormatException (Status)));
- }
-
- AcpiOsFree (DebugBlock);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "%p freed\n", Allocation));
-
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtFindAllocation
- *
- * PARAMETERS: ListId - Memory list to search
- * Allocation - Address of allocated memory
- *
- * RETURN: A list element if found; NULL otherwise.
- *
- * DESCRIPTION: Searches for an element in the global allocation tracking list.
- *
- ******************************************************************************/
-
-ACPI_DEBUG_MEM_BLOCK *
-AcpiUtFindAllocation (
- UINT32 ListId,
- void *Allocation)
-{
- ACPI_DEBUG_MEM_BLOCK *Element;
-
-
ACPI_FUNCTION_ENTRY ();
- if (ListId > ACPI_MEM_LIST_MAX)
- {
- return (NULL);
- }
-
- Element = AcpiGbl_MemoryLists[ListId].ListHead;
-
- /* Search for the address. */
-
- while (Element)
- {
- if (Element == Allocation)
- {
- return (Element);
- }
-
- Element = Element->Next;
- }
-
- return (NULL);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtTrackAllocation
- *
- * PARAMETERS: ListId - Memory list to search
- * Allocation - Address of allocated memory
- * Size - Size of the allocation
- * AllocType - MEM_MALLOC or MEM_CALLOC
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN: None.
- *
- * DESCRIPTION: Inserts an element into the global allocation tracking list.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtTrackAllocation (
- UINT32 ListId,
- ACPI_DEBUG_MEM_BLOCK *Allocation,
- ACPI_SIZE Size,
- UINT8 AllocType,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_MEMORY_LIST *MemList;
- ACPI_DEBUG_MEM_BLOCK *Element;
- ACPI_STATUS Status = AE_OK;
-
-
- ACPI_FUNCTION_TRACE_PTR ("UtTrackAllocation", Allocation);
-
-
- if (ListId > ACPI_MEM_LIST_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- MemList = &AcpiGbl_MemoryLists[ListId];
- Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Search list for this address to make sure it is not already on the list.
- * This will catch several kinds of problems.
- */
-
- Element = AcpiUtFindAllocation (ListId, Allocation);
- if (Element)
+ Allocation = AcpiUtAllocate (Size, Component, Module, Line);
+ if (Allocation)
{
- ACPI_REPORT_ERROR (("UtTrackAllocation: Allocation already present in list! (%p)\n",
- Allocation));
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Element %p Address %p\n", Element, Allocation));
+ /* Clear the memory block */
- goto UnlockAndExit;
+ ACPI_MEMSET (Allocation, 0, Size);
}
- /* Fill in the instance data. */
-
- Allocation->Size = (UINT32) Size;
- Allocation->AllocType = AllocType;
- Allocation->Component = Component;
- Allocation->Line = Line;
-
- ACPI_STRNCPY (Allocation->Module, Module, ACPI_MAX_MODULE_NAME);
- Allocation->Module[ACPI_MAX_MODULE_NAME-1] = 0;
-
- /* Insert at list head */
-
- if (MemList->ListHead)
- {
- ((ACPI_DEBUG_MEM_BLOCK *)(MemList->ListHead))->Previous = Allocation;
- }
-
- Allocation->Next = MemList->ListHead;
- Allocation->Previous = NULL;
-
- MemList->ListHead = Allocation;
-
-
-UnlockAndExit:
- Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
- return_ACPI_STATUS (Status);
+ return (Allocation);
}
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtRemoveAllocation
- *
- * PARAMETERS: ListId - Memory list to search
- * Allocation - Address of allocated memory
- * Component - Component type of caller
- * Module - Source file name of caller
- * Line - Line number of caller
- *
- * RETURN:
- *
- * DESCRIPTION: Deletes an element from the global allocation tracking list.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiUtRemoveAllocation (
- UINT32 ListId,
- ACPI_DEBUG_MEM_BLOCK *Allocation,
- UINT32 Component,
- char *Module,
- UINT32 Line)
-{
- ACPI_MEMORY_LIST *MemList;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE ("UtRemoveAllocation");
-
-
- if (ListId > ACPI_MEM_LIST_MAX)
- {
- return_ACPI_STATUS (AE_BAD_PARAMETER);
- }
-
- MemList = &AcpiGbl_MemoryLists[ListId];
- if (NULL == MemList->ListHead)
- {
- /* No allocations! */
-
- _ACPI_REPORT_ERROR (Module, Line, Component,
- ("UtRemoveAllocation: Empty allocation list, nothing to free!\n"));
-
- return_ACPI_STATUS (AE_OK);
- }
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_MEMORY);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Unlink */
-
- if (Allocation->Previous)
- {
- (Allocation->Previous)->Next = Allocation->Next;
- }
- else
- {
- MemList->ListHead = Allocation->Next;
- }
-
- if (Allocation->Next)
- {
- (Allocation->Next)->Previous = Allocation->Previous;
- }
-
- /* Mark the segment as deleted */
-
- ACPI_MEMSET (&Allocation->UserSpace, 0xEA, Allocation->Size);
-
- ACPI_DEBUG_PRINT ((ACPI_DB_ALLOCATIONS, "Freeing size 0%X\n", Allocation->Size));
-
- Status = AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDumpAllocationInfo
- *
- * PARAMETERS:
- *
- * RETURN: None
- *
- * DESCRIPTION: Print some info about the outstanding allocations.
- *
- ******************************************************************************/
-
-void
-AcpiUtDumpAllocationInfo (
- void)
-{
-/*
- ACPI_MEMORY_LIST *MemList;
-*/
-
- ACPI_FUNCTION_TRACE ("UtDumpAllocationInfo");
-
-/*
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Current allocations",
- MemList->CurrentCount,
- ROUND_UP_TO_1K (MemList->CurrentSize)));
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Max concurrent allocations",
- MemList->MaxConcurrentCount,
- ROUND_UP_TO_1K (MemList->MaxConcurrentSize)));
-
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Total (all) internal objects",
- RunningObjectCount,
- ROUND_UP_TO_1K (RunningObjectSize)));
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Total (all) allocations",
- RunningAllocCount,
- ROUND_UP_TO_1K (RunningAllocSize)));
-
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Current Nodes",
- AcpiGbl_CurrentNodeCount,
- ROUND_UP_TO_1K (AcpiGbl_CurrentNodeSize)));
-
- ACPI_DEBUG_PRINT (TRACE_ALLOCATIONS | TRACE_TABLES,
- ("%30s: %4d (%3d Kb)\n", "Max Nodes",
- AcpiGbl_MaxConcurrentNodeCount,
- ROUND_UP_TO_1K ((AcpiGbl_MaxConcurrentNodeCount * sizeof (ACPI_NAMESPACE_NODE)))));
-*/
- return_VOID;
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiUtDumpAllocations
- *
- * PARAMETERS: Component - Component(s) to dump info for.
- * Module - Module to dump info for. NULL means all.
- *
- * RETURN: None
- *
- * DESCRIPTION: Print a list of all outstanding allocations.
- *
- ******************************************************************************/
-
-void
-AcpiUtDumpAllocations (
- UINT32 Component,
- char *Module)
-{
- ACPI_DEBUG_MEM_BLOCK *Element;
- ACPI_DESCRIPTOR *Descriptor;
- UINT32 NumOutstanding = 0;
-
-
- ACPI_FUNCTION_TRACE ("UtDumpAllocations");
-
-
- /*
- * Walk the allocation list.
- */
- if (ACPI_FAILURE (AcpiUtAcquireMutex (ACPI_MTX_MEMORY)))
- {
- return;
- }
-
- Element = AcpiGbl_MemoryLists[0].ListHead;
- while (Element)
- {
- if ((Element->Component & Component) &&
- ((Module == NULL) || (0 == ACPI_STRCMP (Module, Element->Module))))
- {
- /* Ignore allocated objects that are in a cache */
-
- Descriptor = ACPI_CAST_PTR (ACPI_DESCRIPTOR, &Element->UserSpace);
- if (Descriptor->DescriptorId != ACPI_DESC_TYPE_CACHED)
- {
- AcpiOsPrintf ("%p Len %04X %9.9s-%d [%s] ",
- Descriptor, Element->Size, Element->Module,
- Element->Line, AcpiUtGetDescriptorName (Descriptor));
-
- /* Most of the elements will be Operand objects. */
-
- switch (ACPI_GET_DESCRIPTOR_TYPE (Descriptor))
- {
- case ACPI_DESC_TYPE_OPERAND:
- AcpiOsPrintf ("%12.12s R%hd",
- AcpiUtGetTypeName (Descriptor->Object.Common.Type),
- Descriptor->Object.Common.ReferenceCount);
- break;
-
- case ACPI_DESC_TYPE_PARSER:
- AcpiOsPrintf ("AmlOpcode %04hX",
- Descriptor->Op.Asl.AmlOpcode);
- break;
-
- case ACPI_DESC_TYPE_NAMED:
- AcpiOsPrintf ("%4.4s",
- AcpiUtGetNodeName (&Descriptor->Node));
- break;
-
- default:
- break;
- }
-
- AcpiOsPrintf ( "\n");
- NumOutstanding++;
- }
- }
- Element = Element->Next;
- }
-
- (void) AcpiUtReleaseMutex (ACPI_MTX_MEMORY);
-
- /* Print summary */
-
- if (!NumOutstanding)
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "No outstanding allocations.\n"));
- }
- else
- {
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR,
- "%d(%X) Outstanding allocations\n",
- NumOutstanding, NumOutstanding));
- }
-
- return_VOID;
-}
-
-
-#endif /* #ifdef ACPI_DBG_TRACK_ALLOCATIONS */
-
Index: dmresrcs.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dmresrcs.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dmresrcs.c -L sys/contrib/dev/acpica/dmresrcs.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dmresrcs.c
+++ sys/contrib/dev/acpica/dmresrcs.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dmresrcs.c - "Small" Resource Descriptor disassembly
- * $Revision: 5 $
+ * $Revision: 1.16 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -135,13 +135,13 @@
*
* RETURN: None
*
- * DESCRIPTION: Decode a IRQ descriptor
+ * DESCRIPTION: Decode a IRQ descriptor, either Irq() or IrqNoFlags()
*
******************************************************************************/
void
AcpiDmIrqDescriptor (
- ASL_IRQ_FORMAT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
@@ -150,15 +150,23 @@
AcpiOsPrintf ("%s (",
AcpiGbl_IrqDecode [Length & 1]);
+ /* Decode flags byte if present */
+
if (Length & 1)
{
- AcpiOsPrintf ("%s, %s, %s",
- AcpiGbl_HEDecode [Resource->Flags & 1],
- AcpiGbl_LLDecode [(Resource->Flags >> 3) & 1],
- AcpiGbl_SHRDecode [(Resource->Flags >> 4) & 1]);
+ AcpiOsPrintf ("%s, %s, %s, ",
+ AcpiGbl_HeDecode [Resource->Irq.Flags & 1],
+ AcpiGbl_LlDecode [(Resource->Irq.Flags >> 3) & 1],
+ AcpiGbl_ShrDecode [(Resource->Irq.Flags >> 4) & 1]);
}
- AcpiDmBitList (Resource->IrqMask);
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmBitList (Resource->Irq.IrqMask);
}
@@ -178,18 +186,24 @@
void
AcpiDmDmaDescriptor (
- ASL_DMA_FORMAT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
AcpiDmIndent (Level);
- AcpiOsPrintf ("DMA (%s, %s, %s",
- AcpiGbl_TYPDecode [(Resource->Flags >> 5) & 3],
- AcpiGbl_BMDecode [(Resource->Flags >> 2) & 1],
- AcpiGbl_SIZDecode [(Resource->Flags >> 0) & 3]);
+ AcpiOsPrintf ("DMA (%s, %s, %s, ",
+ AcpiGbl_TypDecode [(Resource->Dma.Flags >> 5) & 3],
+ AcpiGbl_BmDecode [(Resource->Dma.Flags >> 2) & 1],
+ AcpiGbl_SizDecode [(Resource->Dma.Flags >> 0) & 3]);
+
+ /* Insert a descriptor name */
+
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
- AcpiDmBitList (Resource->DmaChannelMask);
+ AcpiDmIndent (Level + 1);
+ AcpiDmBitList (Resource->Dma.DmaChannelMask);
}
@@ -209,18 +223,32 @@
void
AcpiDmIoDescriptor (
- ASL_IO_PORT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
AcpiDmIndent (Level);
- AcpiOsPrintf ("IO (%s, 0x%4.4X, 0x%4.4X, 0x%2.2X, 0x%2.2X)\n",
- AcpiGbl_IoDecode [(Resource->Information & 1)],
- (UINT32) Resource->AddressMin,
- (UINT32) Resource->AddressMax,
- (UINT32) Resource->Alignment,
- (UINT32) Resource->Length);
+ AcpiOsPrintf ("IO (%s,\n",
+ AcpiGbl_IoDecode [(Resource->Io.Flags & 1)]);
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger16 (Resource->Io.Minimum, "Range Minimum");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger16 (Resource->Io.Maximum, "Range Maximum");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger8 (Resource->Io.Alignment, "Alignment");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger8 (Resource->Io.AddressLength, "Length");
+
+ /* Insert a descriptor name */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
}
@@ -240,15 +268,25 @@
void
AcpiDmFixedIoDescriptor (
- ASL_FIXED_IO_PORT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
AcpiDmIndent (Level);
- AcpiOsPrintf ("FixedIO (0x%4.4X, 0x%2.2X)\n",
- (UINT32) Resource->BaseAddress,
- (UINT32) Resource->Length);
+ AcpiOsPrintf ("FixedIO (\n");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger16 (Resource->FixedIo.Address, "Address");
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDumpInteger8 (Resource->FixedIo.AddressLength, "Length");
+
+ /* Insert a descriptor name */
+
+ AcpiDmIndent (Level + 1);
+ AcpiDmDescriptorName ();
+ AcpiOsPrintf (")\n");
}
@@ -268,7 +306,7 @@
void
AcpiDmStartDependentDescriptor (
- ASL_START_DEPENDENT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
@@ -278,8 +316,8 @@
if (Length & 1)
{
AcpiOsPrintf ("StartDependentFn (0x%2.2X, 0x%2.2X)\n",
- (UINT32) Resource->Flags & 3,
- (UINT32) (Resource->Flags >> 2) & 3);
+ (UINT32) Resource->StartDpf.Flags & 3,
+ (UINT32) (Resource->StartDpf.Flags >> 2) & 3);
}
else
{
@@ -307,7 +345,7 @@
void
AcpiDmEndDependentDescriptor (
- ASL_START_DEPENDENT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
@@ -335,18 +373,15 @@
void
AcpiDmVendorSmallDescriptor (
- ASL_SMALL_VENDOR_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level)
{
- AcpiDmIndent (Level);
- AcpiOsPrintf ("VendorShort () {");
-
- AcpiDmDisasmByteList (0, (UINT8 *) Resource->VendorDefined, Length);
- AcpiOsPrintf ("}\n");
+ AcpiDmVendorCommon ("Short",
+ ACPI_ADD_PTR (UINT8, Resource, sizeof (AML_RESOURCE_SMALL_HEADER)),
+ Length, Level);
}
#endif
-
Index: acdisasm.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acdisasm.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acdisasm.h -L sys/contrib/dev/acpica/acdisasm.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acdisasm.h
+++ sys/contrib/dev/acpica/acdisasm.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acdisasm.h - AML disassembler
- * $Revision: 12 $
+ * $Revision: 1.39 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,41 +124,84 @@
#define BLOCK_PAREN 1
#define BLOCK_BRACE 2
#define BLOCK_COMMA_LIST 4
+#define ACPI_DEFAULT_RESNAME *(UINT32 *) "__RD"
typedef struct acpi_external_list
{
char *Path;
+ char *InternalPath;
struct acpi_external_list *Next;
+ UINT32 Value;
+ UINT16 Length;
+ UINT8 Type;
} ACPI_EXTERNAL_LIST;
extern ACPI_EXTERNAL_LIST *AcpiGbl_ExternalList;
-extern const char *AcpiGbl_IoDecode[2];
-extern const char *AcpiGbl_WordDecode[4];
-extern const char *AcpiGbl_ConsumeDecode[2];
-extern const char *AcpiGbl_MinDecode[2];
-extern const char *AcpiGbl_MaxDecode[2];
-extern const char *AcpiGbl_DECDecode[2];
-extern const char *AcpiGbl_RNGDecode[4];
-extern const char *AcpiGbl_MEMDecode[4];
-extern const char *AcpiGbl_RWDecode[2];
-extern const char *AcpiGbl_IrqDecode[2];
-extern const char *AcpiGbl_HEDecode[2];
-extern const char *AcpiGbl_LLDecode[2];
-extern const char *AcpiGbl_SHRDecode[2];
-extern const char *AcpiGbl_TYPDecode[4];
-extern const char *AcpiGbl_BMDecode[2];
-extern const char *AcpiGbl_SIZDecode[4];
-extern const char *AcpiGbl_LockRule[ACPI_NUM_LOCK_RULES];
-extern const char *AcpiGbl_AccessTypes[ACPI_NUM_ACCESS_TYPES];
-extern const char *AcpiGbl_UpdateRules[ACPI_NUM_UPDATE_RULES];
-extern const char *AcpiGbl_MatchOps[ACPI_NUM_MATCH_OPS];
+
+typedef const struct acpi_dmtable_info
+{
+ UINT8 Opcode;
+ UINT8 Offset;
+ char *Name;
+
+} ACPI_DMTABLE_INFO;
+
+/*
+ * Values for Opcode above.
+ * Note: 0-7 must not change, used as a flag shift value
+ */
+#define ACPI_DMT_FLAG0 0
+#define ACPI_DMT_FLAG1 1
+#define ACPI_DMT_FLAG2 2
+#define ACPI_DMT_FLAG3 3
+#define ACPI_DMT_FLAG4 4
+#define ACPI_DMT_FLAG5 5
+#define ACPI_DMT_FLAG6 6
+#define ACPI_DMT_FLAG7 7
+#define ACPI_DMT_FLAGS0 8
+#define ACPI_DMT_FLAGS2 9
+#define ACPI_DMT_UINT8 10
+#define ACPI_DMT_UINT16 11
+#define ACPI_DMT_UINT24 12
+#define ACPI_DMT_UINT32 13
+#define ACPI_DMT_UINT56 14
+#define ACPI_DMT_UINT64 15
+#define ACPI_DMT_STRING 16
+#define ACPI_DMT_NAME4 17
+#define ACPI_DMT_NAME6 18
+#define ACPI_DMT_NAME8 19
+#define ACPI_DMT_CHKSUM 20
+#define ACPI_DMT_SPACEID 21
+#define ACPI_DMT_GAS 22
+#define ACPI_DMT_DMAR 23
+#define ACPI_DMT_MADT 24
+#define ACPI_DMT_SRAT 25
+#define ACPI_DMT_EXIT 26
+#define ACPI_DMT_SIG 27
+
+typedef
+void (*ACPI_TABLE_HANDLER) (
+ ACPI_TABLE_HEADER *Table);
+
+typedef struct acpi_dmtable_data
+{
+ char *Signature;
+ ACPI_DMTABLE_INFO *TableInfo;
+ ACPI_TABLE_HANDLER TableHandler;
+ char *Name;
+
+} ACPI_DMTABLE_DATA;
typedef struct acpi_op_walk_info
{
UINT32 Level;
+ UINT32 LastLevel;
+ UINT32 Count;
UINT32 BitOffset;
+ UINT32 Flags;
+ ACPI_WALK_STATE *WalkState;
} ACPI_OP_WALK_INFO;
@@ -168,62 +211,169 @@
UINT32 Level,
void *Context);
+typedef struct acpi_resource_tag
+{
+ UINT32 BitIndex;
+ char *Tag;
+
+} ACPI_RESOURCE_TAG;
+
+/* Strings used for decoding flags to ASL keywords */
+
+extern const char *AcpiGbl_WordDecode[];
+extern const char *AcpiGbl_IrqDecode[];
+extern const char *AcpiGbl_LockRule[];
+extern const char *AcpiGbl_AccessTypes[];
+extern const char *AcpiGbl_UpdateRules[];
+extern const char *AcpiGbl_MatchOps[];
+
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoGas[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[];
+extern ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[];
+
/*
- * dmwalk
+ * dmtable
*/
+void
+AcpiDmDumpDataTable (
+ ACPI_TABLE_HEADER *Table);
void
-AcpiDmWalkParseTree (
- ACPI_PARSE_OBJECT *Op,
- ASL_WALK_CALLBACK DescendingCallback,
- ASL_WALK_CALLBACK AscendingCallback,
- void *Context);
+AcpiDmDumpTable (
+ UINT32 TableLength,
+ UINT32 TableOffset,
+ void *Table,
+ UINT32 SubTableLength,
+ ACPI_DMTABLE_INFO *Info);
-ACPI_STATUS
-AcpiDmDescendingOp (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
+void
+AcpiDmLineHeader (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name);
-ACPI_STATUS
-AcpiDmAscendingOp (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
+void
+AcpiDmLineHeader2 (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name,
+ UINT32 Value);
/*
- * dmopcode
+ * dmtbdump
*/
+void
+AcpiDmDumpAsf (
+ ACPI_TABLE_HEADER *Table);
void
-AcpiDmValidateName (
- char *Name,
- ACPI_PARSE_OBJECT *Op);
+AcpiDmDumpCpep (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpDmar (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpFadt (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpSrat (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpMcfg (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpMadt (
+ ACPI_TABLE_HEADER *Table);
UINT32
-AcpiDmDumpName (
- char *Name);
+AcpiDmDumpRsdp (
+ ACPI_TABLE_HEADER *Table);
void
-AcpiDmUnicode (
- ACPI_PARSE_OBJECT *Op);
+AcpiDmDumpRsdt (
+ ACPI_TABLE_HEADER *Table);
+
+void
+AcpiDmDumpSlit (
+ ACPI_TABLE_HEADER *Table);
void
+AcpiDmDumpXsdt (
+ ACPI_TABLE_HEADER *Table);
+
+
+/*
+ * dmwalk
+ */
+void
AcpiDmDisassemble (
ACPI_WALK_STATE *WalkState,
ACPI_PARSE_OBJECT *Origin,
UINT32 NumOpcodes);
void
-AcpiDmNamestring (
- char *Name);
+AcpiDmWalkParseTree (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_WALK_CALLBACK DescendingCallback,
+ ASL_WALK_CALLBACK AscendingCallback,
+ void *Context);
-void
-AcpiDmDisplayPath (
- ACPI_PARSE_OBJECT *Op);
+/*
+ * dmopcode
+ */
void
AcpiDmDisassembleOneOp (
ACPI_WALK_STATE *WalkState,
@@ -235,18 +385,9 @@
ACPI_OPERAND_OBJECT *ObjDesc);
UINT32
-AcpiDmBlockType (
- ACPI_PARSE_OBJECT *Op);
-
-UINT32
AcpiDmListType (
ACPI_PARSE_OBJECT *Op);
-ACPI_STATUS
-AcpiPsDisplayObjectPathname (
- ACPI_WALK_STATE *WalkState,
- ACPI_PARSE_OBJECT *Op);
-
void
AcpiDmMethodFlags (
ACPI_PARSE_OBJECT *Op);
@@ -267,10 +408,6 @@
AcpiDmMatchOp (
ACPI_PARSE_OBJECT *Op);
-void
-AcpiDmMatchKeyword (
- ACPI_PARSE_OBJECT *Op);
-
BOOLEAN
AcpiDmCommaIfListMember (
ACPI_PARSE_OBJECT *Op);
@@ -281,13 +418,25 @@
/*
- * dmobject
+ * dmnames
*/
+UINT32
+AcpiDmDumpName (
+ char *Name);
+
+ACPI_STATUS
+AcpiPsDisplayObjectPathname (
+ ACPI_WALK_STATE *WalkState,
+ ACPI_PARSE_OBJECT *Op);
void
-AcpiDmDecodeNode (
- ACPI_NAMESPACE_NODE *Node);
+AcpiDmNamestring (
+ char *Name);
+
+/*
+ * dmobject
+ */
void
AcpiDmDisplayInternalObject (
ACPI_OPERAND_OBJECT *ObjDesc,
@@ -311,9 +460,19 @@
/*
* dmbuffer
*/
+void
+AcpiDmDisasmByteList (
+ UINT32 Level,
+ UINT8 *ByteData,
+ UINT32 ByteCount);
void
-AcpiIsEisaId (
+AcpiDmByteList (
+ ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op);
+
+void
+AcpiDmIsEisaId (
ACPI_PARSE_OBJECT *Op);
void
@@ -332,26 +491,35 @@
/*
* dmresrc
*/
+void
+AcpiDmDumpInteger8 (
+ UINT8 Value,
+ char *Name);
void
-AcpiDmDisasmByteList (
- UINT32 Level,
- UINT8 *ByteData,
- UINT32 ByteCount);
+AcpiDmDumpInteger16 (
+ UINT16 Value,
+ char *Name);
void
-AcpiDmByteList (
- ACPI_OP_WALK_INFO *Info,
- ACPI_PARSE_OBJECT *Op);
+AcpiDmDumpInteger32 (
+ UINT32 Value,
+ char *Name);
+
+void
+AcpiDmDumpInteger64 (
+ UINT64 Value,
+ char *Name);
void
-AcpiDmResourceDescriptor (
+AcpiDmResourceTemplate (
ACPI_OP_WALK_INFO *Info,
+ ACPI_PARSE_OBJECT *Op,
UINT8 *ByteData,
UINT32 ByteCount);
-BOOLEAN
-AcpiDmIsResourceDescriptor (
+ACPI_STATUS
+AcpiDmIsResourceTemplate (
ACPI_PARSE_OBJECT *Op);
void
@@ -366,70 +534,78 @@
AcpiDmDecodeAttribute (
UINT8 Attribute);
-/*
- * dmresrcl
- */
-
void
-AcpiDmIoFlags (
- UINT8 Flags);
+AcpiDmDescriptorName (
+ void);
-void
-AcpiDmMemoryFlags (
- UINT8 Flags,
- UINT8 SpecificFlags);
+/*
+ * dmresrcl
+ */
void
AcpiDmWordDescriptor (
- ASL_WORD_ADDRESS_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmDwordDescriptor (
- ASL_DWORD_ADDRESS_DESC *Resource,
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmExtendedDescriptor (
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmQwordDescriptor (
- ASL_QWORD_ADDRESS_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmMemory24Descriptor (
- ASL_MEMORY_24_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmMemory32Descriptor (
- ASL_MEMORY_32_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
-AcpiDmFixedMem32Descriptor (
- ASL_FIXED_MEMORY_32_DESC *Resource,
+AcpiDmFixedMemory32Descriptor (
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmGenericRegisterDescriptor (
- ASL_GENERAL_REGISTER_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmInterruptDescriptor (
- ASL_EXTENDED_XRUPT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmVendorLargeDescriptor (
- ASL_LARGE_VENDOR_DESC *Resource,
+ AML_RESOURCE *Resource,
+ UINT32 Length,
+ UINT32 Level);
+
+void
+AcpiDmVendorCommon (
+ char *Name,
+ UINT8 *ByteData,
UINT32 Length,
UINT32 Level);
@@ -437,46 +613,45 @@
/*
* dmresrcs
*/
-
void
AcpiDmIrqDescriptor (
- ASL_IRQ_FORMAT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmDmaDescriptor (
- ASL_DMA_FORMAT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmIoDescriptor (
- ASL_IO_PORT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmFixedIoDescriptor (
- ASL_FIXED_IO_PORT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmStartDependentDescriptor (
- ASL_START_DEPENDENT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmEndDependentDescriptor (
- ASL_START_DEPENDENT_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
void
AcpiDmVendorSmallDescriptor (
- ASL_SMALL_VENDOR_DESC *Resource,
+ AML_RESOURCE *Resource,
UINT32 Length,
UINT32 Level);
@@ -484,9 +659,22 @@
/*
* dmutils
*/
-
void
AcpiDmAddToExternalList (
- char *Path);
+ char *Path,
+ UINT8 Type,
+ UINT32 Value);
+
+/*
+ * dmrestag
+ */
+void
+AcpiDmFindResources (
+ ACPI_PARSE_OBJECT *Root);
+
+void
+AcpiDmCheckResourceReference (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState);
#endif /* __ACDISASM_H__ */
Index: dbdisply.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbdisply.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbdisply.c -L sys/contrib/dev/acpica/dbdisply.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbdisply.c
+++ sys/contrib/dev/acpica/dbdisply.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbdisply - debug display commands
- * $Revision: 106 $
+ * $Revision: 1.120 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -127,12 +127,21 @@
#ifdef ACPI_DEBUGGER
-
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbdisply")
+/* Local prototypes */
-/******************************************************************************
+static void
+AcpiDbDumpParserDescriptor (
+ ACPI_PARSE_OBJECT *Op);
+
+static void *
+AcpiDbGetPointer (
+ void *Target);
+
+
+/*******************************************************************************
*
* FUNCTION: AcpiDbGetPointer
*
@@ -142,33 +151,16 @@
*
* DESCRIPTION: Convert an ascii pointer value to a real value
*
- *****************************************************************************/
+ ******************************************************************************/
-void *
+static void *
AcpiDbGetPointer (
void *Target)
{
void *ObjPtr;
-#if ACPI_MACHINE_WIDTH == 16
-#include <stdio.h>
-
- /* Have to handle 16-bit pointers of the form segment:offset */
-
- if (!sscanf (Target, "%p", &ObjPtr))
- {
- AcpiOsPrintf ("Invalid pointer: %s\n", Target);
- return (NULL);
- }
-
-#else
-
- /* Simple flat pointer */
-
ObjPtr = ACPI_TO_POINTER (ACPI_STRTOUL (Target, NULL, 16));
-#endif
-
return (ObjPtr);
}
@@ -185,7 +177,7 @@
*
******************************************************************************/
-void
+static void
AcpiDbDumpParserDescriptor (
ACPI_PARSE_OBJECT *Op)
{
@@ -197,7 +189,8 @@
AcpiOsPrintf ("Parser Op Descriptor:\n");
AcpiOsPrintf ("%20.20s : %4.4X\n", "Opcode", Op->Common.AmlOpcode);
- ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name", Info->Name));
+ ACPI_DEBUG_ONLY_MEMBERS (AcpiOsPrintf ("%20.20s : %s\n", "Opcode Name",
+ Info->Name));
AcpiOsPrintf ("%20.20s : %p\n", "Value/ArgList", Op->Common.Value.Arg);
AcpiOsPrintf ("%20.20s : %p\n", "Parent", Op->Common.Parent);
@@ -243,7 +236,7 @@
if (OutputType)
{
- ACPI_STRUPR (OutputType);
+ AcpiUtStrupr (OutputType);
if (OutputType[0] == 'W')
{
Display = DB_WORD_DISPLAY;
@@ -268,7 +261,8 @@
ObjPtr = AcpiDbGetPointer (Target);
if (!AcpiOsReadable (ObjPtr, 16))
{
- AcpiOsPrintf ("Address %p is invalid in this address space\n", ObjPtr);
+ AcpiOsPrintf ("Address %p is invalid in this address space\n",
+ ObjPtr);
return;
}
@@ -282,12 +276,13 @@
if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_NAMESPACE_NODE)))
{
- AcpiOsPrintf ("Cannot read entire Named object at address %p\n", ObjPtr);
+ AcpiOsPrintf (
+ "Cannot read entire Named object at address %p\n", ObjPtr);
return;
}
Node = ObjPtr;
- goto DumpNte;
+ goto DumpNode;
case ACPI_DESC_TYPE_OPERAND:
@@ -296,11 +291,13 @@
if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_OPERAND_OBJECT)))
{
- AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n", ObjPtr);
+ AcpiOsPrintf ("Cannot read entire ACPI object at address %p\n",
+ ObjPtr);
return;
}
- AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
+ AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_OPERAND_OBJECT), Display,
+ ACPI_UINT32_MAX);
AcpiExDumpObjectDescriptor (ObjPtr, 1);
break;
@@ -311,11 +308,13 @@
if (!AcpiOsReadable (ObjPtr, sizeof (ACPI_PARSE_OBJECT)))
{
- AcpiOsPrintf ("Cannot read entire Parser object at address %p\n", ObjPtr);
+ AcpiOsPrintf (
+ "Cannot read entire Parser object at address %p\n", ObjPtr);
return;
}
- AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display, ACPI_UINT32_MAX);
+ AcpiUtDumpBuffer (ObjPtr, sizeof (ACPI_PARSE_OBJECT), Display,
+ ACPI_UINT32_MAX);
AcpiDbDumpParserDescriptor ((ACPI_PARSE_OBJECT *) ObjPtr);
break;
@@ -348,8 +347,8 @@
}
-DumpNte:
- /* Now dump the Named obj */
+DumpNode:
+ /* Now dump the NS node */
Status = AcpiGetName (Node, ACPI_FULL_PATHNAME, &RetBuf);
if (ACPI_FAILURE (Status))
@@ -359,7 +358,8 @@
else
{
- AcpiOsPrintf ("Object (%p) Pathname: %s\n", Node, (char *) RetBuf.Pointer);
+ AcpiOsPrintf ("Object (%p) Pathname: %s\n",
+ Node, (char *) RetBuf.Pointer);
}
if (!AcpiOsReadable (Node, sizeof (ACPI_NAMESPACE_NODE)))
@@ -368,8 +368,9 @@
return;
}
- AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE), Display, ACPI_UINT32_MAX);
- AcpiExDumpNode (Node, 1);
+ AcpiUtDumpBuffer ((void *) Node, sizeof (ACPI_NAMESPACE_NODE),
+ Display, ACPI_UINT32_MAX);
+ AcpiExDumpNamespaceNode (Node, 1);
ObjDesc = AcpiNsGetAttachedObject (Node);
if (ObjDesc)
@@ -377,11 +378,13 @@
AcpiOsPrintf ("\nAttached Object (%p):\n", ObjDesc);
if (!AcpiOsReadable (ObjDesc, sizeof (ACPI_OPERAND_OBJECT)))
{
- AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n", ObjDesc);
+ AcpiOsPrintf ("Invalid internal ACPI Object at address %p\n",
+ ObjDesc);
return;
}
- AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT), Display, ACPI_UINT32_MAX);
+ AcpiUtDumpBuffer ((void *) ObjDesc, sizeof (ACPI_OPERAND_OBJECT),
+ Display, ACPI_UINT32_MAX);
AcpiExDumpObjectDescriptor (ObjDesc, 1);
}
}
@@ -415,8 +418,6 @@
UINT32 NumRemainingOps = 0;
UINT32 NumRemainingOperands = 0;
UINT32 NumRemainingOperators = 0;
- UINT32 NumArgs;
- UINT32 Concurrency;
BOOLEAN CountRemaining = FALSE;
@@ -430,13 +431,11 @@
ObjDesc = WalkState->MethodDesc;
Node = WalkState->MethodNode;
- NumArgs = ObjDesc->Method.ParamCount;
- Concurrency = ObjDesc->Method.Concurrency;
-
AcpiOsPrintf ("Currently executing control method is [%4.4s]\n",
AcpiUtGetNodeName (Node));
- AcpiOsPrintf ("%X arguments, max concurrency = %X\n",
- NumArgs, Concurrency);
+ AcpiOsPrintf ("%X Arguments, SyncLevel = %X\n",
+ (UINT32) ObjDesc->Method.ParamCount,
+ (UINT32) ObjDesc->Method.SyncLevel);
RootOp = StartOp;
@@ -492,11 +491,13 @@
Op = AcpiPsGetDepthNext (StartOp, Op);
}
- AcpiOsPrintf ("Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
- NumOps, NumOperators, NumOperands);
-
- AcpiOsPrintf ("Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
- NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
+ AcpiOsPrintf (
+ "Method contains: %X AML Opcodes - %X Operators, %X Operands\n",
+ NumOps, NumOperators, NumOperands);
+
+ AcpiOsPrintf (
+ "Remaining to execute: %X AML Opcodes - %X Operators, %X Operands\n",
+ NumRemainingOps, NumRemainingOperators, NumRemainingOperands);
}
@@ -513,7 +514,8 @@
******************************************************************************/
void
-AcpiDbDisplayLocals (void)
+AcpiDbDisplayLocals (
+ void)
{
ACPI_WALK_STATE *WalkState;
@@ -542,7 +544,8 @@
******************************************************************************/
void
-AcpiDbDisplayArguments (void)
+AcpiDbDisplayArguments (
+ void)
{
ACPI_WALK_STATE *WalkState;
@@ -571,13 +574,16 @@
******************************************************************************/
void
-AcpiDbDisplayResults (void)
+AcpiDbDisplayResults (
+ void)
{
UINT32 i;
ACPI_WALK_STATE *WalkState;
ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 NumResults = 0;
+ UINT32 ResultCount = 0;
ACPI_NAMESPACE_NODE *Node;
+ ACPI_GENERIC_STATE *Frame;
+ UINT32 Index; /* Index onto current frame */
WalkState = AcpiDsGetCurrentWalkState (AcpiGbl_CurrentWalkList);
@@ -592,17 +598,28 @@
if (WalkState->Results)
{
- NumResults = WalkState->Results->Results.NumResults;
+ ResultCount = WalkState->ResultCount;
}
AcpiOsPrintf ("Method [%4.4s] has %X stacked result objects\n",
- AcpiUtGetNodeName (Node), NumResults);
+ AcpiUtGetNodeName (Node), ResultCount);
+
+ /* From the top element of result stack */
- for (i = 0; i < NumResults; i++)
+ Frame = WalkState->Results;
+ Index = (ResultCount - 1) % ACPI_RESULTS_FRAME_OBJ_NUM;
+
+ for (i = 0; i < ResultCount; i++)
{
- ObjDesc = WalkState->Results->Results.ObjDesc[i];
+ ObjDesc = Frame->Results.ObjDesc[Index];
AcpiOsPrintf ("Result%d: ", i);
AcpiDmDisplayInternalObject (ObjDesc, WalkState);
+ if (Index == 0)
+ {
+ Frame = Frame->Results.Next;
+ Index = ACPI_RESULTS_FRAME_OBJ_NUM;
+ }
+ Index--;
}
}
@@ -620,7 +637,8 @@
******************************************************************************/
void
-AcpiDbDisplayCallingTree (void)
+AcpiDbDisplayCallingTree (
+ void)
{
ACPI_WALK_STATE *WalkState;
ACPI_NAMESPACE_NODE *Node;
@@ -677,22 +695,24 @@
if (ACPI_SUCCESS (Status))
{
Info = Buffer.Pointer;
- AcpiOsPrintf ("S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
- Info->HighestDstates[0], Info->HighestDstates[1],
- Info->HighestDstates[2], Info->HighestDstates[3],
- Info->HardwareId.Value,
- ACPI_FORMAT_UINT64 (Info->Address),
- Info->CurrentStatus);
+ AcpiOsPrintf (
+ "S1D-%2.2X S2D-%2.2X S3D-%2.2X S4D-%2.2X HID: %s, ADR: %8.8X%8.8X, Status %8.8X\n",
+ Info->HighestDstates[0], Info->HighestDstates[1],
+ Info->HighestDstates[2], Info->HighestDstates[3],
+ Info->HardwareId.Value,
+ ACPI_FORMAT_UINT64 (Info->Address),
+ Info->CurrentStatus);
if (Info->Valid & ACPI_VALID_CID)
{
for (i = 0; i < Info->CompatibilityId.Count; i++)
{
- AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i, Info->CompatibilityId.Id[i].Value);
+ AcpiOsPrintf ("CID #%d: %s\n", (UINT32) i,
+ Info->CompatibilityId.Id[i].Value);
}
}
- ACPI_MEM_FREE (Info);
+ ACPI_FREE (Info);
}
else
{
@@ -779,7 +799,8 @@
******************************************************************************/
void
-AcpiDbDisplayGpes (void)
+AcpiDbDisplayGpes (
+ void)
{
ACPI_GPE_BLOCK_INFO *GpeBlock;
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
@@ -814,18 +835,23 @@
}
AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n",
- Block, GpeBlock, GpeBlock->Node, Buffer);
- AcpiOsPrintf (" Registers: %u (%u GPEs) \n",
- GpeBlock->RegisterCount,
- ACPI_MUL_8 (GpeBlock->RegisterCount));
+ Block, GpeBlock, GpeBlock->Node, Buffer);
+
+ AcpiOsPrintf (" Registers: %u (%u GPEs)\n",
+ GpeBlock->RegisterCount,
+ ACPI_MUL_8 (GpeBlock->RegisterCount));
+
AcpiOsPrintf (" GPE range: 0x%X to 0x%X\n",
- GpeBlock->BlockBaseNumber,
- GpeBlock->BlockBaseNumber +
- (GpeBlock->RegisterCount * 8) -1);
- AcpiOsPrintf (" RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
- GpeBlock->RegisterInfo,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->StatusAddress.Address)),
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeBlock->RegisterInfo->EnableAddress.Address)));
+ GpeBlock->BlockBaseNumber,
+ GpeBlock->BlockBaseNumber +
+ (GpeBlock->RegisterCount * 8) -1);
+
+ AcpiOsPrintf (
+ " RegisterInfo: %p Status %8.8X%8.8X Enable %8.8X%8.8X\n",
+ GpeBlock->RegisterInfo,
+ ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->StatusAddress.Address),
+ ACPI_FORMAT_UINT64 (GpeBlock->RegisterInfo->EnableAddress.Address));
+
AcpiOsPrintf (" EventInfo: %p\n", GpeBlock->EventInfo);
/* Examine each GPE Register within the block */
@@ -835,11 +861,11 @@
GpeRegisterInfo = &GpeBlock->RegisterInfo[i];
AcpiOsPrintf (
- " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n",
- i, GpeRegisterInfo->EnableForWake,
- GpeRegisterInfo->EnableForRun,
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->StatusAddress.Address)),
- ACPI_FORMAT_UINT64 (ACPI_GET_ADDRESS (GpeRegisterInfo->EnableAddress.Address)));
+ " Reg %u: WakeEnable %2.2X, RunEnable %2.2X Status %8.8X%8.8X Enable %8.8X%8.8X\n",
+ i, GpeRegisterInfo->EnableForWake,
+ GpeRegisterInfo->EnableForRun,
+ ACPI_FORMAT_UINT64 (GpeRegisterInfo->StatusAddress.Address),
+ ACPI_FORMAT_UINT64 (GpeRegisterInfo->EnableAddress.Address));
/* Now look at the individual GPEs in this byte register */
@@ -856,10 +882,10 @@
}
AcpiOsPrintf (
- " GPE %.3X: %p Bit %2.2X Flags %2.2X: ",
- GpeBlock->BlockBaseNumber + GpeIndex,
- GpeEventInfo, GpeEventInfo->RegisterBit,
- GpeEventInfo->Flags);
+ " GPE %.3X: %p Flags %2.2X: ",
+ GpeBlock->BlockBaseNumber + GpeIndex,
+ GpeEventInfo,
+ GpeEventInfo->Flags);
if (GpeEventInfo->Flags & ACPI_GPE_LEVEL_TRIGGERED)
{
@@ -931,6 +957,5 @@
}
}
-
#endif /* ACPI_DEBUGGER */
Index: dbstats.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/dbstats.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/dbstats.c -L sys/contrib/dev/acpica/dbstats.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/dbstats.c
+++ sys/contrib/dev/acpica/dbstats.c
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Module Name: dbstats - Generation and display of ACPI table statistics
- * $Revision: 70 $
+ * $Revision: 1.87 $
*
******************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,6 +124,30 @@
#define _COMPONENT ACPI_CA_DEBUGGER
ACPI_MODULE_NAME ("dbstats")
+/* Local prototypes */
+
+static void
+AcpiDbCountNamespaceObjects (
+ void);
+
+static void
+AcpiDbEnumerateObject (
+ ACPI_OPERAND_OBJECT *ObjDesc);
+
+static ACPI_STATUS
+AcpiDbClassifyOneObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
+
+#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
+static void
+AcpiDbListInfo (
+ ACPI_MEMORY_LIST *List);
+#endif
+
+
/*
* Statistics subcommands
*/
@@ -148,6 +172,81 @@
#define CMD_STAT_STACK 6
+#if defined ACPI_DBG_TRACK_ALLOCATIONS || defined ACPI_USE_LOCAL_CACHE
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDbListInfo
+ *
+ * PARAMETERS: List - Memory list/cache to be displayed
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display information about the input memory list or cache.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDbListInfo (
+ ACPI_MEMORY_LIST *List)
+{
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ UINT32 Outstanding;
+#endif
+
+ AcpiOsPrintf ("\n%s\n", List->ListName);
+
+ /* MaxDepth > 0 indicates a cache object */
+
+ if (List->MaxDepth > 0)
+ {
+ AcpiOsPrintf (
+ " Cache: [Depth MaxD Avail Size] %8.2X %8.2X %8.2X %8.2X\n",
+ List->CurrentDepth,
+ List->MaxDepth,
+ List->MaxDepth - List->CurrentDepth,
+ (List->CurrentDepth * List->ObjectSize));
+ }
+
+#ifdef ACPI_DBG_TRACK_ALLOCATIONS
+ if (List->MaxDepth > 0)
+ {
+ AcpiOsPrintf (
+ " Cache: [Requests Hits Misses ObjSize] %8.2X %8.2X %8.2X %8.2X\n",
+ List->Requests,
+ List->Hits,
+ List->Requests - List->Hits,
+ List->ObjectSize);
+ }
+
+ Outstanding = AcpiDbGetCacheInfo (List);
+
+ if (List->ObjectSize)
+ {
+ AcpiOsPrintf (
+ " Mem: [Alloc Free Max CurSize Outstanding] %8.2X %8.2X %8.2X %8.2X %8.2X\n",
+ List->TotalAllocated,
+ List->TotalFreed,
+ List->MaxOccupied,
+ Outstanding * List->ObjectSize,
+ Outstanding);
+ }
+ else
+ {
+ AcpiOsPrintf (
+ " Mem: [Alloc Free Max CurSize Outstanding Total] %8.2X %8.2X %8.2X %8.2X %8.2X %8.2X\n",
+ List->TotalAllocated,
+ List->TotalFreed,
+ List->MaxOccupied,
+ List->CurrentTotalSize,
+ Outstanding,
+ List->TotalSize);
+ }
+#endif
+}
+#endif
+
+
/*******************************************************************************
*
* FUNCTION: AcpiDbEnumerateObject
@@ -162,7 +261,7 @@
*
******************************************************************************/
-void
+static void
AcpiDbEnumerateObject (
ACPI_OPERAND_OBJECT *ObjDesc)
{
@@ -174,7 +273,6 @@
return;
}
-
/* Enumerate this object first */
AcpiGbl_NumObjects++;
@@ -260,7 +358,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
AcpiDbClassifyOneObject (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@@ -284,7 +382,6 @@
{
AcpiGbl_NodeTypeCountMisc++;
}
-
else
{
AcpiGbl_NodeTypeCount [Type]++;
@@ -293,8 +390,10 @@
return AE_OK;
+#ifdef ACPI_FUTURE_IMPLEMENTATION
+
/* TBD: These need to be counted during the initial parsing phase */
- /*
+
if (AcpiPsIsNamedOp (Op->Opcode))
{
NumNodes++;
@@ -308,12 +407,12 @@
NumGrammarElements++;
Op = AcpiPsGetDepthNext (Root, Op);
- SizeOfParseTree = (NumGrammarElements - NumMethodElements) * (UINT32) sizeof (ACPI_PARSE_OBJECT);
- SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
- SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
- SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
-
- */
+ SizeOfParseTree = (NumGrammarElements - NumMethodElements) *
+ (UINT32) sizeof (ACPI_PARSE_OBJECT);
+ SizeOfMethodTrees = NumMethodElements * (UINT32) sizeof (ACPI_PARSE_OBJECT);
+ SizeOfNodeEntries = NumNodes * (UINT32) sizeof (ACPI_NAMESPACE_NODE);
+ SizeOfAcpiObjects = NumNodes * (UINT32) sizeof (ACPI_OPERAND_OBJECT);
+#endif
}
@@ -323,14 +422,14 @@
*
* PARAMETERS: None
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Count and classify the entire namespace, including all
* namespace nodes and attached objects.
*
******************************************************************************/
-void
+static void
AcpiDbCountNamespaceObjects (
void)
{
@@ -347,8 +446,8 @@
AcpiGbl_NodeTypeCount [i] = 0;
}
- (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX,
- FALSE, AcpiDbClassifyOneObject, NULL, NULL);
+ (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, AcpiDbClassifyOneObject, NULL, NULL);
}
@@ -369,36 +468,28 @@
char *TypeArg)
{
UINT32 i;
- UINT32 Type;
- UINT32 Size;
-#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- UINT32 Outstanding;
-#endif
+ UINT32 Temp;
- if (!AcpiGbl_DSDT)
- {
- AcpiOsPrintf ("*** Warning: There is no DSDT loaded\n");
- }
-
if (!TypeArg)
{
AcpiOsPrintf ("The following subcommands are available:\n ALLOCATIONS, OBJECTS, MEMORY, MISC, SIZES, TABLES\n");
return (AE_OK);
}
- ACPI_STRUPR (TypeArg);
- Type = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
- if (Type == (UINT32) -1)
+ AcpiUtStrupr (TypeArg);
+ Temp = AcpiDbMatchArgument (TypeArg, AcpiDbStatTypes);
+ if (Temp == (UINT32) -1)
{
AcpiOsPrintf ("Invalid or unsupported argument\n");
return (AE_OK);
}
- switch (Type)
+ switch (Temp)
{
case CMD_STAT_ALLOCATIONS:
+
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
AcpiUtDumpAllocationInfo ();
#endif
@@ -406,11 +497,7 @@
case CMD_STAT_TABLES:
- AcpiOsPrintf ("ACPI Table Information:\n\n");
- if (AcpiGbl_DSDT)
- {
- AcpiOsPrintf ("DSDT Length:................% 7ld (%X)\n", AcpiGbl_DSDT->Length, AcpiGbl_DSDT->Length);
- }
+ AcpiOsPrintf ("ACPI Table Information (not implemented):\n\n");
break;
case CMD_STAT_OBJECTS:
@@ -419,7 +506,8 @@
AcpiOsPrintf ("\nObjects defined in the current namespace:\n\n");
- AcpiOsPrintf ("%16.16s %10.10s %10.10s\n", "ACPI_TYPE", "NODES", "OBJECTS");
+ AcpiOsPrintf ("%16.16s %10.10s %10.10s\n",
+ "ACPI_TYPE", "NODES", "OBJECTS");
for (i = 0; i < ACPI_TYPE_NS_NODE_MAX; i++)
{
@@ -436,45 +524,18 @@
case CMD_STAT_MEMORY:
#ifdef ACPI_DBG_TRACK_ALLOCATIONS
- AcpiOsPrintf ("\n----Object and Cache Statistics---------------------------------------------\n");
+ AcpiOsPrintf ("\n----Object Statistics (all in hex)---------\n");
- for (i = 0; i < ACPI_NUM_MEM_LISTS; i++)
- {
- AcpiOsPrintf ("\n%s\n", AcpiGbl_MemoryLists[i].ListName);
+ AcpiDbListInfo (AcpiGbl_GlobalList);
+ AcpiDbListInfo (AcpiGbl_NsNodeList);
+#endif
- if (AcpiGbl_MemoryLists[i].MaxCacheDepth > 0)
- {
- AcpiOsPrintf (" Cache: [Depth Max Avail Size] % 7d % 7d % 7d % 7d B\n",
- AcpiGbl_MemoryLists[i].CacheDepth,
- AcpiGbl_MemoryLists[i].MaxCacheDepth,
- AcpiGbl_MemoryLists[i].MaxCacheDepth - AcpiGbl_MemoryLists[i].CacheDepth,
- (AcpiGbl_MemoryLists[i].CacheDepth * AcpiGbl_MemoryLists[i].ObjectSize));
-
- AcpiOsPrintf (" Cache: [Requests Hits Misses ObjSize] % 7d % 7d % 7d % 7d B\n",
- AcpiGbl_MemoryLists[i].CacheRequests,
- AcpiGbl_MemoryLists[i].CacheHits,
- AcpiGbl_MemoryLists[i].CacheRequests - AcpiGbl_MemoryLists[i].CacheHits,
- AcpiGbl_MemoryLists[i].ObjectSize);
- }
-
- Outstanding = AcpiGbl_MemoryLists[i].TotalAllocated -
- AcpiGbl_MemoryLists[i].TotalFreed -
- AcpiGbl_MemoryLists[i].CacheDepth;
-
- if (AcpiGbl_MemoryLists[i].ObjectSize)
- {
- Size = ACPI_ROUND_UP_TO_1K (Outstanding * AcpiGbl_MemoryLists[i].ObjectSize);
- }
- else
- {
- Size = ACPI_ROUND_UP_TO_1K (AcpiGbl_MemoryLists[i].CurrentTotalSize);
- }
-
- AcpiOsPrintf (" Mem: [Alloc Free Outstanding Size] % 7d % 7d % 7d % 7d Kb\n",
- AcpiGbl_MemoryLists[i].TotalAllocated,
- AcpiGbl_MemoryLists[i].TotalFreed,
- Outstanding, Size);
- }
+#ifdef ACPI_USE_LOCAL_CACHE
+ AcpiOsPrintf ("\n----Cache Statistics (all in hex)----------\n");
+ AcpiDbListInfo (AcpiGbl_OperandCache);
+ AcpiDbListInfo (AcpiGbl_PsNodeCache);
+ AcpiDbListInfo (AcpiGbl_PsNodeExtCache);
+ AcpiDbListInfo (AcpiGbl_StateCache);
#endif
break;
@@ -482,15 +543,18 @@
case CMD_STAT_MISC:
AcpiOsPrintf ("\nMiscellaneous Statistics:\n\n");
- AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n", AcpiGbl_PsFindCount);
- AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n", AcpiGbl_NsLookupCount);
+ AcpiOsPrintf ("Calls to AcpiPsFind:.. ........% 7ld\n",
+ AcpiGbl_PsFindCount);
+ AcpiOsPrintf ("Calls to AcpiNsLookup:..........% 7ld\n",
+ AcpiGbl_NsLookupCount);
AcpiOsPrintf ("\n");
AcpiOsPrintf ("Mutex usage:\n\n");
- for (i = 0; i < NUM_MUTEX; i++)
+ for (i = 0; i < ACPI_NUM_MUTEX; i++)
{
- AcpiOsPrintf ("%-28s: % 7ld\n", AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
+ AcpiOsPrintf ("%-28s: % 7ld\n",
+ AcpiUtGetMutexName (i), AcpiGbl_MutexInfo[i].UseCount);
}
break;
@@ -536,12 +600,12 @@
case CMD_STAT_STACK:
#if defined(ACPI_DEBUG_OUTPUT)
- Size = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
+ Temp = (UINT32) (AcpiGbl_EntryStackPointer - AcpiGbl_LowestStackPointer);
AcpiOsPrintf ("\nSubsystem Stack Usage:\n\n");
AcpiOsPrintf ("Entry Stack Pointer %X\n", AcpiGbl_EntryStackPointer);
AcpiOsPrintf ("Lowest Stack Pointer %X\n", AcpiGbl_LowestStackPointer);
- AcpiOsPrintf ("Stack Use %X (%d)\n", Size, Size);
+ AcpiOsPrintf ("Stack Use %X (%d)\n", Temp, Temp);
AcpiOsPrintf ("Deepest Procedure Nesting %d\n", AcpiGbl_DeepestNesting);
#endif
break;
@@ -554,5 +618,4 @@
return (AE_OK);
}
-
#endif /* ACPI_DEBUGGER */
Index: actypes.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/actypes.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/actypes.h -L sys/contrib/dev/acpica/actypes.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/actypes.h
+++ sys/contrib/dev/acpica/actypes.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: actypes.h - Common data types for the entire ACPI subsystem
- * $Revision: 274 $
+ * $Revision: 1.316 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,9 +117,18 @@
#ifndef __ACTYPES_H__
#define __ACTYPES_H__
-/*! [Begin] no source code translation (keep the typedefs) */
+/* acpisrc:StructDefs -- for acpisrc conversion */
+/*
+ * ACPI_MACHINE_WIDTH must be specified in an OS- or compiler-dependent header
+ * and must be either 32 or 64. 16-bit ACPICA is no longer supported, as of
+ * 12/2006.
+ */
+#ifndef ACPI_MACHINE_WIDTH
+#error ACPI_MACHINE_WIDTH not defined
+#endif
+/*! [Begin] no source code translation */
/*
* Data type ranges
@@ -134,195 +143,225 @@
#define ACPI_ASCII_MAX 0x7F
-#ifdef DEFINE_ALTERNATE_TYPES
/*
- * Types used only in translated source, defined here to enable
- * cross-platform compilation only.
+ * Architecture-specific ACPICA Subsystem Data Types
+ *
+ * The goal of these types is to provide source code portability across
+ * 16-bit, 32-bit, and 64-bit targets.
+ *
+ * 1) The following types are of fixed size for all targets (16/32/64):
+ *
+ * BOOLEAN Logical boolean
+ *
+ * UINT8 8-bit (1 byte) unsigned value
+ * UINT16 16-bit (2 byte) unsigned value
+ * UINT32 32-bit (4 byte) unsigned value
+ * UINT64 64-bit (8 byte) unsigned value
+ *
+ * INT16 16-bit (2 byte) signed value
+ * INT32 32-bit (4 byte) signed value
+ * INT64 64-bit (8 byte) signed value
+ *
+ * COMPILER_DEPENDENT_UINT64/INT64 - These types are defined in the
+ * compiler-dependent header(s) and were introduced because there is no common
+ * 64-bit integer type across the various compilation models, as shown in
+ * the table below.
+ *
+ * Datatype LP64 ILP64 LLP64 ILP32 LP32 16bit
+ * char 8 8 8 8 8 8
+ * short 16 16 16 16 16 16
+ * _int32 32
+ * int 32 64 32 32 16 16
+ * long 64 64 32 32 32 32
+ * long long 64 64
+ * pointer 64 64 64 32 32 32
+ *
+ * Note: ILP64 and LP32 are currently not supported.
+ *
+ *
+ * 2) These types represent the native word size of the target mode of the
+ * processor, and may be 16-bit, 32-bit, or 64-bit as required. They are
+ * usually used for memory allocation, efficient loop counters, and array
+ * indexes. The types are similar to the size_t type in the C library and are
+ * required because there is no C type that consistently represents the native
+ * data width.
+ *
+ * ACPI_SIZE 16/32/64-bit unsigned value
+ * ACPI_NATIVE_UINT 16/32/64-bit unsigned value
+ * ACPI_NATIVE_INT 16/32/64-bit signed value
+ *
*/
-typedef int s32;
-typedef unsigned char u8;
-typedef unsigned short u16;
-typedef unsigned int u32;
-typedef COMPILER_DEPENDENT_UINT64 u64;
-#endif
+/*******************************************************************************
+ *
+ * Common types for all compilers, all targets
+ *
+ ******************************************************************************/
+
+typedef unsigned char BOOLEAN;
+typedef unsigned char UINT8;
+typedef unsigned short UINT16;
+typedef COMPILER_DEPENDENT_UINT64 UINT64;
+typedef COMPILER_DEPENDENT_INT64 INT64;
+/*! [End] no source code translation !*/
-/*
- * Data types - Fixed across all compilation models (16/32/64)
- *
- * BOOLEAN Logical Boolean.
- * INT8 8-bit (1 byte) signed value
- * UINT8 8-bit (1 byte) unsigned value
- * INT16 16-bit (2 byte) signed value
- * UINT16 16-bit (2 byte) unsigned value
- * INT32 32-bit (4 byte) signed value
- * UINT32 32-bit (4 byte) unsigned value
- * INT64 64-bit (8 byte) signed value
- * UINT64 64-bit (8 byte) unsigned value
- * ACPI_NATIVE_INT 32-bit on IA-32, 64-bit on IA-64 signed value
- * ACPI_NATIVE_UINT 32-bit on IA-32, 64-bit on IA-64 unsigned value
- */
-#ifndef ACPI_MACHINE_WIDTH
-#error ACPI_MACHINE_WIDTH not defined
-#endif
+/*******************************************************************************
+ *
+ * Types specific to 64-bit targets
+ *
+ ******************************************************************************/
#if ACPI_MACHINE_WIDTH == 64
-/*! [Begin] no source code translation (keep the typedefs) */
+/*! [Begin] no source code translation (keep the typedefs as-is) */
-/*
- * 64-bit type definitions
- */
-typedef unsigned char UINT8;
-typedef unsigned char BOOLEAN;
-typedef unsigned short UINT16;
-typedef int INT32;
typedef unsigned int UINT32;
-typedef COMPILER_DEPENDENT_INT64 INT64;
-typedef COMPILER_DEPENDENT_UINT64 UINT64;
+typedef int INT32;
/*! [End] no source code translation !*/
-typedef INT64 ACPI_NATIVE_INT;
+
typedef UINT64 ACPI_NATIVE_UINT;
+typedef INT64 ACPI_NATIVE_INT;
-typedef UINT64 ACPI_TABLE_PTR;
typedef UINT64 ACPI_IO_ADDRESS;
typedef UINT64 ACPI_PHYSICAL_ADDRESS;
-typedef UINT64 ACPI_SIZE;
-#define ALIGNED_ADDRESS_BOUNDARY 0x00000008 /* No hardware alignment support in IA64 */
-#define ACPI_USE_NATIVE_DIVIDE /* Native 64-bit integer support */
#define ACPI_MAX_PTR ACPI_UINT64_MAX
#define ACPI_SIZE_MAX ACPI_UINT64_MAX
-
-#elif ACPI_MACHINE_WIDTH == 16
-
-/*! [Begin] no source code translation (keep the typedefs) */
+#define ACPI_USE_NATIVE_DIVIDE /* Has native 64-bit integer support */
/*
- * 16-bit type definitions
+ * In the case of the Itanium Processor Family (IPF), the hardware does not
+ * support misaligned memory transfers. Set the MISALIGNMENT_NOT_SUPPORTED flag
+ * to indicate that special precautions must be taken to avoid alignment faults.
+ * (IA64 or ia64 is currently used by existing compilers to indicate IPF.)
+ *
+ * Note: EM64T and other X86-64 processors support misaligned transfers,
+ * so there is no need to define this flag.
*/
-typedef unsigned char UINT8;
-typedef unsigned char BOOLEAN;
-typedef unsigned int UINT16;
-typedef long INT32;
-typedef int INT16;
-typedef unsigned long UINT32;
-
-typedef struct
-{
- UINT32 Lo;
- UINT32 Hi;
-
-} UINT64;
-
-/*! [End] no source code translation !*/
-
-typedef UINT16 ACPI_NATIVE_UINT;
-typedef INT16 ACPI_NATIVE_INT;
-
-typedef UINT32 ACPI_TABLE_PTR;
-typedef UINT32 ACPI_IO_ADDRESS;
-typedef char *ACPI_PHYSICAL_ADDRESS;
-typedef UINT16 ACPI_SIZE;
-
-#define ALIGNED_ADDRESS_BOUNDARY 0x00000002
-#define ACPI_MISALIGNED_TRANSFERS
-#define ACPI_USE_NATIVE_DIVIDE /* No 64-bit integers, ok to use native divide */
-#define ACPI_MAX_PTR ACPI_UINT16_MAX
-#define ACPI_SIZE_MAX ACPI_UINT16_MAX
+#if defined (__IA64__) || defined (__ia64__)
+#define ACPI_MISALIGNMENT_NOT_SUPPORTED
+#endif
-/*
- * (16-bit only) internal integers must be 32-bits, so
- * 64-bit integers cannot be supported
- */
-#define ACPI_NO_INTEGER64_SUPPORT
+/*******************************************************************************
+ *
+ * Types specific to 32-bit targets
+ *
+ ******************************************************************************/
#elif ACPI_MACHINE_WIDTH == 32
-/*! [Begin] no source code translation (keep the typedefs) */
+/*! [Begin] no source code translation (keep the typedefs as-is) */
-/*
- * 32-bit type definitions (default)
- */
-typedef unsigned char UINT8;
-typedef unsigned char BOOLEAN;
-typedef unsigned short UINT16;
-typedef int INT32;
typedef unsigned int UINT32;
-typedef COMPILER_DEPENDENT_INT64 INT64;
-typedef COMPILER_DEPENDENT_UINT64 UINT64;
+typedef int INT32;
/*! [End] no source code translation !*/
-typedef INT32 ACPI_NATIVE_INT;
+
typedef UINT32 ACPI_NATIVE_UINT;
+typedef INT32 ACPI_NATIVE_INT;
-typedef UINT64 ACPI_TABLE_PTR;
typedef UINT32 ACPI_IO_ADDRESS;
-typedef UINT64 ACPI_PHYSICAL_ADDRESS;
-typedef UINT32 ACPI_SIZE;
+typedef UINT32 ACPI_PHYSICAL_ADDRESS;
-#define ALIGNED_ADDRESS_BOUNDARY 0x00000004
-#define ACPI_MISALIGNED_TRANSFERS
#define ACPI_MAX_PTR ACPI_UINT32_MAX
#define ACPI_SIZE_MAX ACPI_UINT32_MAX
#else
+
+/* ACPI_MACHINE_WIDTH must be either 64 or 32 */
+
#error unknown ACPI_MACHINE_WIDTH
#endif
-/*
- * Miscellaneous common types
- */
-typedef UINT16 UINT16_BIT;
-typedef UINT32 UINT32_BIT;
-typedef ACPI_NATIVE_UINT ACPI_PTRDIFF;
+/* Variable-width type, used instead of clib size_t */
-/*
- * Pointer overlays to avoid lots of typecasting for
- * code that accepts both physical and logical pointers.
- */
-typedef union acpi_pointers
-{
- ACPI_PHYSICAL_ADDRESS Physical;
- void *Logical;
- ACPI_TABLE_PTR Value;
+typedef ACPI_NATIVE_UINT ACPI_SIZE;
-} ACPI_POINTERS;
-typedef struct acpi_pointer
-{
- UINT32 PointerType;
- union acpi_pointers Pointer;
+/*******************************************************************************
+ *
+ * OS-dependent and compiler-dependent types
+ *
+ * If the defaults below are not appropriate for the host system, they can
+ * be defined in the compiler-specific or OS-specific header, and this will
+ * take precedence.
+ *
+ ******************************************************************************/
-} ACPI_POINTER;
-/* PointerTypes for above */
+/* Value returned by AcpiOsGetThreadId */
-#define ACPI_PHYSICAL_POINTER 0x01
-#define ACPI_LOGICAL_POINTER 0x02
+#ifndef ACPI_THREAD_ID
+#define ACPI_THREAD_ID ACPI_NATIVE_UINT
+#endif
-/* Processor mode */
+/* Object returned from AcpiOsCreateLock */
-#define ACPI_PHYSICAL_ADDRESSING 0x04
-#define ACPI_LOGICAL_ADDRESSING 0x08
-#define ACPI_MEMORY_MODE 0x0C
+#ifndef ACPI_SPINLOCK
+#define ACPI_SPINLOCK void *
+#endif
-#define ACPI_PHYSMODE_PHYSPTR ACPI_PHYSICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
-#define ACPI_LOGMODE_PHYSPTR ACPI_LOGICAL_ADDRESSING | ACPI_PHYSICAL_POINTER
-#define ACPI_LOGMODE_LOGPTR ACPI_LOGICAL_ADDRESSING | ACPI_LOGICAL_POINTER
+/* Flags for AcpiOsAcquireLock/AcpiOsReleaseLock */
+#ifndef ACPI_CPU_FLAGS
+#define ACPI_CPU_FLAGS ACPI_NATIVE_UINT
+#endif
+
+/* Object returned from AcpiOsCreateCache */
+
+#ifndef ACPI_CACHE_T
+#define ACPI_CACHE_T ACPI_MEMORY_LIST
+#endif
+
+/* Use C99 uintptr_t for pointer casting if available, "void *" otherwise */
+
+#ifndef ACPI_UINTPTR_T
+#define ACPI_UINTPTR_T void *
+#endif
+
+/*
+ * ACPI_PRINTF_LIKE is used to tag functions as "printf-like" because
+ * some compilers can catch printf format string problems
+ */
+#ifndef ACPI_PRINTF_LIKE
+#define ACPI_PRINTF_LIKE(c)
+#endif
/*
- * Useful defines
+ * Some compilers complain about unused variables. Sometimes we don't want to
+ * use all the variables (for example, _AcpiModuleName). This allows us
+ * to to tell the compiler in a per-variable manner that a variable
+ * is unused
*/
+#ifndef ACPI_UNUSED_VAR
+#define ACPI_UNUSED_VAR
+#endif
+
+/*
+ * All ACPICA functions that are available to the rest of the kernel are
+ * tagged with this macro which can be defined as appropriate for the host.
+ */
+#ifndef ACPI_EXPORT_SYMBOL
+#define ACPI_EXPORT_SYMBOL(Symbol)
+#endif
+
+
+/*******************************************************************************
+ *
+ * Independent types
+ *
+ ******************************************************************************/
+
+/* Logical defines and NULL */
+
#ifdef FALSE
#undef FALSE
#endif
@@ -339,58 +378,47 @@
/*
- * Local datatypes
+ * Mescellaneous types
*/
typedef UINT32 ACPI_STATUS; /* All ACPI Exceptions */
typedef UINT32 ACPI_NAME; /* 4-byte ACPI name */
typedef char * ACPI_STRING; /* Null terminated ASCII string */
-typedef void * ACPI_HANDLE; /* Actually a ptr to an Node */
+typedef void * ACPI_HANDLE; /* Actually a ptr to a NS Node */
typedef struct uint64_struct
{
- UINT32 Lo;
- UINT32 Hi;
+ UINT32 Lo;
+ UINT32 Hi;
} UINT64_STRUCT;
typedef union uint64_overlay
{
- UINT64 Full;
- UINT64_STRUCT Part;
+ UINT64 Full;
+ UINT64_STRUCT Part;
} UINT64_OVERLAY;
typedef struct uint32_struct
{
- UINT32 Lo;
- UINT32 Hi;
+ UINT32 Lo;
+ UINT32 Hi;
} UINT32_STRUCT;
-/*
- * Acpi integer width. In ACPI version 1, integers are
- * 32 bits. In ACPI version 2, integers are 64 bits.
- * Note that this pertains to the ACPI integer type only, not
- * other integers used in the implementation of the ACPI CA
- * subsystem.
- */
-#ifdef ACPI_NO_INTEGER64_SUPPORT
-
-/* 32-bit integers only, no 64-bit support */
-
-typedef UINT32 ACPI_INTEGER;
-#define ACPI_INTEGER_MAX ACPI_UINT32_MAX
-#define ACPI_INTEGER_BIT_SIZE 32
-#define ACPI_MAX_DECIMAL_DIGITS 10 /* 2^32 = 4,294,967,296 */
-
-#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 32-bit divide */
-
+/* Synchronization objects */
-#else
+#define ACPI_MUTEX void *
+#define ACPI_SEMAPHORE void *
-/* 64-bit integers */
+/*
+ * Acpi integer width. In ACPI version 1, integers are 32 bits. In ACPI
+ * version 2, integers are 64 bits. Note that this pertains to the ACPI integer
+ * type only, not other integers used in the implementation of the ACPI CA
+ * subsystem.
+ */
typedef UINT64 ACPI_INTEGER;
#define ACPI_INTEGER_MAX ACPI_UINT64_MAX
#define ACPI_INTEGER_BIT_SIZE 64
@@ -400,7 +428,6 @@
#if ACPI_MACHINE_WIDTH == 64
#define ACPI_USE_NATIVE_DIVIDE /* Use compiler native 64-bit divide */
#endif
-#endif
#define ACPI_MAX64_DECIMAL_DIGITS 20
#define ACPI_MAX32_DECIMAL_DIGITS 10
@@ -410,7 +437,7 @@
/*
* Constants with special meanings
*/
-#define ACPI_ROOT_OBJECT (ACPI_HANDLE) ACPI_PTR_ADD (char, NULL, ACPI_MAX_PTR)
+#define ACPI_ROOT_OBJECT ACPI_ADD_PTR (ACPI_HANDLE, NULL, ACPI_MAX_PTR)
/*
@@ -428,7 +455,8 @@
/*
* Initialization state
*/
-#define ACPI_INITIALIZED_OK 0x01
+#define ACPI_SUBSYSTEM_INITIALIZE 0x01
+#define ACPI_INITIALIZED_OK 0x02
/*
* Power state values
@@ -477,21 +505,6 @@
#define ACPI_NOTIFY_POWER_FAULT (UINT8) 7
/*
- * Table types. These values are passed to the table related APIs
- */
-typedef UINT32 ACPI_TABLE_TYPE;
-
-#define ACPI_TABLE_RSDP (ACPI_TABLE_TYPE) 0
-#define ACPI_TABLE_DSDT (ACPI_TABLE_TYPE) 1
-#define ACPI_TABLE_FADT (ACPI_TABLE_TYPE) 2
-#define ACPI_TABLE_FACS (ACPI_TABLE_TYPE) 3
-#define ACPI_TABLE_PSDT (ACPI_TABLE_TYPE) 4
-#define ACPI_TABLE_SSDT (ACPI_TABLE_TYPE) 5
-#define ACPI_TABLE_XSDT (ACPI_TABLE_TYPE) 6
-#define ACPI_TABLE_MAX 6
-#define NUM_ACPI_TABLE_TYPES (ACPI_TABLE_MAX+1)
-
-/*
* Types associated with ACPI names and objects. The first group of
* values (up to ACPI_TYPE_EXTERNAL_MAX) correspond to the definition
* of the ACPI ObjectType() operator (See the ACPI Spec). Therefore,
@@ -557,38 +570,6 @@
#define ACPI_TYPE_INVALID 0x1E
#define ACPI_TYPE_NOT_FOUND 0xFF
-
-/*
- * Bitmapped ACPI types. Used internally only
- */
-#define ACPI_BTYPE_ANY 0x00000000
-#define ACPI_BTYPE_INTEGER 0x00000001
-#define ACPI_BTYPE_STRING 0x00000002
-#define ACPI_BTYPE_BUFFER 0x00000004
-#define ACPI_BTYPE_PACKAGE 0x00000008
-#define ACPI_BTYPE_FIELD_UNIT 0x00000010
-#define ACPI_BTYPE_DEVICE 0x00000020
-#define ACPI_BTYPE_EVENT 0x00000040
-#define ACPI_BTYPE_METHOD 0x00000080
-#define ACPI_BTYPE_MUTEX 0x00000100
-#define ACPI_BTYPE_REGION 0x00000200
-#define ACPI_BTYPE_POWER 0x00000400
-#define ACPI_BTYPE_PROCESSOR 0x00000800
-#define ACPI_BTYPE_THERMAL 0x00001000
-#define ACPI_BTYPE_BUFFER_FIELD 0x00002000
-#define ACPI_BTYPE_DDB_HANDLE 0x00004000
-#define ACPI_BTYPE_DEBUG_OBJECT 0x00008000
-#define ACPI_BTYPE_REFERENCE 0x00010000
-#define ACPI_BTYPE_RESOURCE 0x00020000
-
-#define ACPI_BTYPE_COMPUTE_DATA (ACPI_BTYPE_INTEGER | ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER)
-
-#define ACPI_BTYPE_DATA (ACPI_BTYPE_COMPUTE_DATA | ACPI_BTYPE_PACKAGE)
-#define ACPI_BTYPE_DATA_REFERENCE (ACPI_BTYPE_DATA | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE)
-#define ACPI_BTYPE_DEVICE_OBJECTS (ACPI_BTYPE_DEVICE | ACPI_BTYPE_THERMAL | ACPI_BTYPE_PROCESSOR)
-#define ACPI_BTYPE_OBJECTS_AND_REFS 0x0001FFFF /* ARG or LOCAL */
-#define ACPI_BTYPE_ALL_OBJECTS 0x0000FFFF
-
/*
* All I/O
*/
@@ -656,7 +637,7 @@
* | | | +--- Type of dispatch -- to method, handler, or none
* | | +--- Enabled for runtime?
* | +--- Enabled for wake?
- * +--- System state when GPE ocurred (running/waking)
+ * +--- Unused
*/
#define ACPI_GPE_XRUPT_TYPE_MASK (UINT8) 0x01
#define ACPI_GPE_LEVEL_TRIGGERED (UINT8) 0x01
@@ -682,10 +663,6 @@
#define ACPI_GPE_ENABLE_MASK (UINT8) 0x60 /* Both run/wake */
-#define ACPI_GPE_SYSTEM_MASK (UINT8) 0x80
-#define ACPI_GPE_SYSTEM_RUNNING (UINT8) 0x80
-#define ACPI_GPE_SYSTEM_WAKING (UINT8) 0x00
-
/*
* Flags for GPE and Lock interfaces
*/
@@ -732,24 +709,26 @@
#define ACPI_BITREG_SLEEP_BUTTON_STATUS 0x04
#define ACPI_BITREG_RT_CLOCK_STATUS 0x05
#define ACPI_BITREG_WAKE_STATUS 0x06
+#define ACPI_BITREG_PCIEXP_WAKE_STATUS 0x07
-#define ACPI_BITREG_TIMER_ENABLE 0x07
-#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x08
-#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x09
-#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0A
-#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0B
-#define ACPI_BITREG_WAKE_ENABLE 0x0C
-
-#define ACPI_BITREG_SCI_ENABLE 0x0D
-#define ACPI_BITREG_BUS_MASTER_RLD 0x0E
-#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x0F
-#define ACPI_BITREG_SLEEP_TYPE_A 0x10
-#define ACPI_BITREG_SLEEP_TYPE_B 0x11
-#define ACPI_BITREG_SLEEP_ENABLE 0x12
+#define ACPI_BITREG_TIMER_ENABLE 0x08
+#define ACPI_BITREG_GLOBAL_LOCK_ENABLE 0x09
+#define ACPI_BITREG_POWER_BUTTON_ENABLE 0x0A
+#define ACPI_BITREG_SLEEP_BUTTON_ENABLE 0x0B
+#define ACPI_BITREG_RT_CLOCK_ENABLE 0x0C
+#define ACPI_BITREG_WAKE_ENABLE 0x0D
+#define ACPI_BITREG_PCIEXP_WAKE_DISABLE 0x0E
+
+#define ACPI_BITREG_SCI_ENABLE 0x0F
+#define ACPI_BITREG_BUS_MASTER_RLD 0x10
+#define ACPI_BITREG_GLOBAL_LOCK_RELEASE 0x11
+#define ACPI_BITREG_SLEEP_TYPE_A 0x12
+#define ACPI_BITREG_SLEEP_TYPE_B 0x13
+#define ACPI_BITREG_SLEEP_ENABLE 0x14
-#define ACPI_BITREG_ARB_DISABLE 0x13
+#define ACPI_BITREG_ARB_DISABLE 0x15
-#define ACPI_BITREG_MAX 0x13
+#define ACPI_BITREG_MAX 0x15
#define ACPI_NUM_BITREG ACPI_BITREG_MAX + 1
@@ -758,54 +737,54 @@
*/
typedef union acpi_object
{
- ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */
+ ACPI_OBJECT_TYPE Type; /* See definition of AcpiNsType for values */
struct
{
- ACPI_OBJECT_TYPE Type;
- ACPI_INTEGER Value; /* The actual number */
+ ACPI_OBJECT_TYPE Type;
+ ACPI_INTEGER Value; /* The actual number */
} Integer;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 Length; /* # of bytes in string, excluding trailing null */
- char *Pointer; /* points to the string value */
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Length; /* # of bytes in string, excluding trailing null */
+ char *Pointer; /* points to the string value */
} String;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 Length; /* # of bytes in buffer */
- UINT8 *Pointer; /* points to the buffer */
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Length; /* # of bytes in buffer */
+ UINT8 *Pointer; /* points to the buffer */
} Buffer;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 Fill1;
- ACPI_HANDLE Handle; /* object reference */
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Fill1;
+ ACPI_HANDLE Handle; /* object reference */
} Reference;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 Count; /* # of elements in package */
- union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */
+ ACPI_OBJECT_TYPE Type;
+ UINT32 Count; /* # of elements in package */
+ union acpi_object *Elements; /* Pointer to an array of ACPI_OBJECTs */
} Package;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 ProcId;
- ACPI_IO_ADDRESS PblkAddress;
- UINT32 PblkLength;
+ ACPI_OBJECT_TYPE Type;
+ UINT32 ProcId;
+ ACPI_IO_ADDRESS PblkAddress;
+ UINT32 PblkLength;
} Processor;
struct
{
- ACPI_OBJECT_TYPE Type;
- UINT32 SystemLevel;
- UINT32 ResourceOrder;
+ ACPI_OBJECT_TYPE Type;
+ UINT32 SystemLevel;
+ UINT32 ResourceOrder;
} PowerResource;
} ACPI_OBJECT;
@@ -816,8 +795,8 @@
*/
typedef struct acpi_object_list
{
- UINT32 Count;
- ACPI_OBJECT *Pointer;
+ UINT32 Count;
+ ACPI_OBJECT *Pointer;
} ACPI_OBJECT_LIST;
@@ -831,8 +810,8 @@
typedef struct acpi_buffer
{
- ACPI_SIZE Length; /* Length in bytes of the buffer */
- void *Pointer; /* pointer to buffer */
+ ACPI_SIZE Length; /* Length in bytes of the buffer */
+ void *Pointer; /* pointer to buffer */
} ACPI_BUFFER;
@@ -855,29 +834,17 @@
/*
- * ACPI Table Info. One per ACPI table _type_
- */
-typedef struct acpi_table_info
-{
- UINT32 Count;
-
-} ACPI_TABLE_INFO;
-
-
-/*
* System info returned by AcpiGetSystemInfo()
*/
typedef struct acpi_system_info
{
- UINT32 AcpiCaVersion;
- UINT32 Flags;
- UINT32 TimerResolution;
- UINT32 Reserved1;
- UINT32 Reserved2;
- UINT32 DebugLevel;
- UINT32 DebugLayer;
- UINT32 NumTableTypes;
- ACPI_TABLE_INFO TableInfo [NUM_ACPI_TABLE_TYPES];
+ UINT32 AcpiCaVersion;
+ UINT32 Flags;
+ UINT32 TimerResolution;
+ UINT32 Reserved1;
+ UINT32 Reserved2;
+ UINT32 DebugLevel;
+ UINT32 DebugLayer;
} ACPI_SYSTEM_INFO;
@@ -885,80 +852,79 @@
/*
* Types specific to the OS service interfaces
*/
-
typedef UINT32
(ACPI_SYSTEM_XFACE *ACPI_OSD_HANDLER) (
- void *Context);
+ void *Context);
typedef void
(ACPI_SYSTEM_XFACE *ACPI_OSD_EXEC_CALLBACK) (
- void *Context);
+ void *Context);
/*
* Various handlers and callback procedures
*/
typedef
UINT32 (*ACPI_EVENT_HANDLER) (
- void *Context);
+ void *Context);
typedef
void (*ACPI_NOTIFY_HANDLER) (
- ACPI_HANDLE Device,
- UINT32 Value,
- void *Context);
+ ACPI_HANDLE Device,
+ UINT32 Value,
+ void *Context);
typedef
void (*ACPI_OBJECT_HANDLER) (
- ACPI_HANDLE Object,
- UINT32 Function,
- void *Data);
+ ACPI_HANDLE Object,
+ UINT32 Function,
+ void *Data);
typedef
ACPI_STATUS (*ACPI_INIT_HANDLER) (
- ACPI_HANDLE Object,
- UINT32 Function);
+ ACPI_HANDLE Object,
+ UINT32 Function);
#define ACPI_INIT_DEVICE_INI 1
typedef
ACPI_STATUS (*ACPI_EXCEPTION_HANDLER) (
- ACPI_STATUS AmlStatus,
- ACPI_NAME Name,
- UINT16 Opcode,
- UINT32 AmlOffset,
- void *Context);
+ ACPI_STATUS AmlStatus,
+ ACPI_NAME Name,
+ UINT16 Opcode,
+ UINT32 AmlOffset,
+ void *Context);
/* Address Spaces (For Operation Regions) */
typedef
ACPI_STATUS (*ACPI_ADR_SPACE_HANDLER) (
- UINT32 Function,
- ACPI_PHYSICAL_ADDRESS Address,
- UINT32 BitWidth,
- ACPI_INTEGER *Value,
- void *HandlerContext,
- void *RegionContext);
+ UINT32 Function,
+ ACPI_PHYSICAL_ADDRESS Address,
+ UINT32 BitWidth,
+ ACPI_INTEGER *Value,
+ void *HandlerContext,
+ void *RegionContext);
-#define ACPI_DEFAULT_HANDLER NULL
+#define ACPI_DEFAULT_HANDLER NULL
typedef
ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
- ACPI_HANDLE RegionHandle,
- UINT32 Function,
- void *HandlerContext,
- void **RegionContext);
+ ACPI_HANDLE RegionHandle,
+ UINT32 Function,
+ void *HandlerContext,
+ void **RegionContext);
#define ACPI_REGION_ACTIVATE 0
#define ACPI_REGION_DEACTIVATE 1
typedef
ACPI_STATUS (*ACPI_WALK_CALLBACK) (
- ACPI_HANDLE ObjHandle,
- UINT32 NestingLevel,
- void *Context,
- void **ReturnValue);
+ ACPI_HANDLE ObjHandle,
+ UINT32 NestingLevel,
+ void *Context,
+ void **ReturnValue);
/* Interrupt handler return values */
@@ -971,7 +937,7 @@
typedef struct acpi_device_id
{
- char Value[ACPI_DEVICE_ID_LENGTH];
+ char Value[ACPI_DEVICE_ID_LENGTH];
} ACPI_DEVICE_ID;
@@ -979,15 +945,15 @@
typedef struct acpi_compatible_id
{
- char Value[ACPI_MAX_CID_LENGTH];
+ char Value[ACPI_MAX_CID_LENGTH];
} ACPI_COMPATIBLE_ID;
typedef struct acpi_compatible_id_list
{
- UINT32 Count;
- UINT32 Size;
- ACPI_COMPATIBLE_ID Id[1];
+ UINT32 Count;
+ UINT32 Size;
+ ACPI_COMPATIBLE_ID Id[1];
} ACPI_COMPATIBLE_ID_LIST;
@@ -1001,10 +967,19 @@
#define ACPI_VALID_CID 0x0010
#define ACPI_VALID_SXDS 0x0020
+/* Flags for _STA method */
+
+#define ACPI_STA_DEVICE_PRESENT 0x01
+#define ACPI_STA_DEVICE_ENABLED 0x02
+#define ACPI_STA_DEVICE_UI 0x04
+#define ACPI_STA_DEVICE_FUNCTIONING 0x08
+#define ACPI_STA_DEVICE_OK 0x08 /* Synonym */
+#define ACPI_STA_BATTERY_PRESENT 0x10
+
#define ACPI_COMMON_OBJ_INFO \
- ACPI_OBJECT_TYPE Type; /* ACPI object type */ \
- ACPI_NAME Name /* ACPI object Name */
+ ACPI_OBJECT_TYPE Type; /* ACPI object type */ \
+ ACPI_NAME Name /* ACPI object Name */
typedef struct acpi_obj_info_header
@@ -1020,13 +995,13 @@
{
ACPI_COMMON_OBJ_INFO;
- UINT32 Valid; /* Indicates which fields below are valid */
- UINT32 CurrentStatus; /* _STA value */
- ACPI_INTEGER Address; /* _ADR value if any */
- ACPI_DEVICE_ID HardwareId; /* _HID value if any */
- ACPI_DEVICE_ID UniqueId; /* _UID value if any */
- UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
- ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
+ UINT32 Valid; /* Indicates which fields below are valid */
+ UINT32 CurrentStatus; /* _STA value */
+ ACPI_INTEGER Address; /* _ADR value if any */
+ ACPI_DEVICE_ID HardwareId; /* _HID value if any */
+ ACPI_DEVICE_ID UniqueId; /* _UID value if any */
+ UINT8 HighestDstates[4]; /* _SxD values: 0xFF indicates not valid */
+ ACPI_COMPATIBLE_ID_LIST CompatibilityId; /* List of _CIDs if any */
} ACPI_DEVICE_INFO;
@@ -1035,21 +1010,21 @@
typedef struct acpi_pci_id
{
- UINT16 Segment;
- UINT16 Bus;
- UINT16 Device;
- UINT16 Function;
+ UINT16 Segment;
+ UINT16 Bus;
+ UINT16 Device;
+ UINT16 Function;
} ACPI_PCI_ID;
typedef struct acpi_mem_space_context
{
- UINT32 Length;
- ACPI_PHYSICAL_ADDRESS Address;
- ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress;
- UINT8 *MappedLogicalAddress;
- ACPI_SIZE MappedLength;
+ UINT32 Length;
+ ACPI_PHYSICAL_ADDRESS Address;
+ ACPI_PHYSICAL_ADDRESS MappedPhysicalAddress;
+ UINT8 *MappedLogicalAddress;
+ ACPI_SIZE MappedLength;
} ACPI_MEM_SPACE_CONTEXT;
@@ -1057,6 +1032,8 @@
/*
* Definitions for Resource Attributes
*/
+typedef UINT16 ACPI_RS_LENGTH; /* Resource Length field is fixed at 16 bits */
+typedef UINT32 ACPI_RSDESC_SIZE; /* Max Resource Descriptor size is (Length+3) = (64K-1)+3 */
/*
* Memory Attributes
@@ -1078,7 +1055,9 @@
#define ACPI_ISA_ONLY_RANGES (UINT8) 0x02
#define ACPI_ENTIRE_RANGE (ACPI_NON_ISA_ONLY_RANGES | ACPI_ISA_ONLY_RANGES)
-#define ACPI_SPARSE_TRANSLATION (UINT8) 0x03
+/* Type of translation - 1=Sparse, 0=Dense */
+
+#define ACPI_SPARSE_TRANSLATION (UINT8) 0x01
/*
* IO Port Descriptor Decode
@@ -1089,8 +1068,8 @@
/*
* IRQ Attributes
*/
-#define ACPI_EDGE_SENSITIVE (UINT8) 0x00
-#define ACPI_LEVEL_SENSITIVE (UINT8) 0x01
+#define ACPI_LEVEL_SENSITIVE (UINT8) 0x00
+#define ACPI_EDGE_SENSITIVE (UINT8) 0x01
#define ACPI_ACTIVE_HIGH (UINT8) 0x00
#define ACPI_ACTIVE_LOW (UINT8) 0x01
@@ -1138,277 +1117,337 @@
/*
+ * If possible, pack the following structures to byte alignment
+ */
+#ifndef ACPI_MISALIGNMENT_NOT_SUPPORTED
+#pragma pack(1)
+#endif
+
+/* UUID data structures for use in vendor-defined resource descriptors */
+
+typedef struct acpi_uuid
+{
+ UINT8 Data[ACPI_UUID_LENGTH];
+} ACPI_UUID;
+
+typedef struct acpi_vendor_uuid
+{
+ UINT8 Subtype;
+ UINT8 Data[ACPI_UUID_LENGTH];
+
+} ACPI_VENDOR_UUID;
+
+/*
* Structures used to describe device resources
*/
typedef struct acpi_resource_irq
{
- UINT32 EdgeLevel;
- UINT32 ActiveHighLow;
- UINT32 SharedExclusive;
- UINT32 NumberOfInterrupts;
- UINT32 Interrupts[1];
+ UINT8 Triggering;
+ UINT8 Polarity;
+ UINT8 Sharable;
+ UINT8 InterruptCount;
+ UINT8 Interrupts[1];
} ACPI_RESOURCE_IRQ;
+
typedef struct ACPI_RESOURCE_DMA
{
- UINT32 Type;
- UINT32 BusMaster;
- UINT32 Transfer;
- UINT32 NumberOfChannels;
- UINT32 Channels[1];
+ UINT8 Type;
+ UINT8 BusMaster;
+ UINT8 Transfer;
+ UINT8 ChannelCount;
+ UINT8 Channels[1];
} ACPI_RESOURCE_DMA;
-typedef struct acpi_resource_start_dpf
+
+typedef struct acpi_resource_start_dependent
{
- UINT32 CompatibilityPriority;
- UINT32 PerformanceRobustness;
+ UINT8 CompatibilityPriority;
+ UINT8 PerformanceRobustness;
+
+} ACPI_RESOURCE_START_DEPENDENT;
-} ACPI_RESOURCE_START_DPF;
/*
* END_DEPENDENT_FUNCTIONS_RESOURCE struct is not
* needed because it has no fields
*/
+
typedef struct acpi_resource_io
{
- UINT32 IoDecode;
- UINT32 MinBaseAddress;
- UINT32 MaxBaseAddress;
- UINT32 Alignment;
- UINT32 RangeLength;
+ UINT8 IoDecode;
+ UINT8 Alignment;
+ UINT8 AddressLength;
+ UINT16 Minimum;
+ UINT16 Maximum;
} ACPI_RESOURCE_IO;
typedef struct acpi_resource_fixed_io
{
- UINT32 BaseAddress;
- UINT32 RangeLength;
+ UINT16 Address;
+ UINT8 AddressLength;
} ACPI_RESOURCE_FIXED_IO;
typedef struct acpi_resource_vendor
{
- UINT32 Length;
- UINT8 Reserved[1];
+ UINT16 ByteLength;
+ UINT8 ByteData[1];
} ACPI_RESOURCE_VENDOR;
+/* Vendor resource with UUID info (introduced in ACPI 3.0) */
+
+typedef struct acpi_resource_vendor_typed
+{
+ UINT16 ByteLength;
+ UINT8 UuidSubtype;
+ UINT8 Uuid[ACPI_UUID_LENGTH];
+ UINT8 ByteData[1];
+
+} ACPI_RESOURCE_VENDOR_TYPED;
+
typedef struct acpi_resource_end_tag
{
- UINT8 Checksum;
+ UINT8 Checksum;
} ACPI_RESOURCE_END_TAG;
-typedef struct acpi_resource_mem24
+typedef struct acpi_resource_memory24
{
- UINT32 ReadWriteAttribute;
- UINT32 MinBaseAddress;
- UINT32 MaxBaseAddress;
- UINT32 Alignment;
- UINT32 RangeLength;
+ UINT8 WriteProtect;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT16 Alignment;
+ UINT16 AddressLength;
-} ACPI_RESOURCE_MEM24;
+} ACPI_RESOURCE_MEMORY24;
-typedef struct acpi_resource_mem32
+typedef struct acpi_resource_memory32
{
- UINT32 ReadWriteAttribute;
- UINT32 MinBaseAddress;
- UINT32 MaxBaseAddress;
- UINT32 Alignment;
- UINT32 RangeLength;
+ UINT8 WriteProtect;
+ UINT32 Minimum;
+ UINT32 Maximum;
+ UINT32 Alignment;
+ UINT32 AddressLength;
-} ACPI_RESOURCE_MEM32;
+} ACPI_RESOURCE_MEMORY32;
-typedef struct acpi_resource_fixed_mem32
+typedef struct acpi_resource_fixed_memory32
{
- UINT32 ReadWriteAttribute;
- UINT32 RangeBaseAddress;
- UINT32 RangeLength;
+ UINT8 WriteProtect;
+ UINT32 Address;
+ UINT32 AddressLength;
-} ACPI_RESOURCE_FIXED_MEM32;
+} ACPI_RESOURCE_FIXED_MEMORY32;
typedef struct acpi_memory_attribute
{
- UINT16 CacheAttribute;
- UINT16 ReadWriteAttribute;
+ UINT8 WriteProtect;
+ UINT8 Caching;
+ UINT8 RangeType;
+ UINT8 Translation;
} ACPI_MEMORY_ATTRIBUTE;
typedef struct acpi_io_attribute
{
- UINT16 RangeAttribute;
- UINT16 TranslationAttribute;
+ UINT8 RangeType;
+ UINT8 Translation;
+ UINT8 TranslationType;
+ UINT8 Reserved1;
} ACPI_IO_ATTRIBUTE;
-typedef struct acpi_bus_attribute
+typedef union acpi_resource_attribute
{
- UINT16 Reserved1;
- UINT16 Reserved2;
+ ACPI_MEMORY_ATTRIBUTE Mem;
+ ACPI_IO_ATTRIBUTE Io;
-} ACPI_BUS_ATTRIBUTE;
+ /* Used for the *WordSpace macros */
-typedef union acpi_resource_attribute
-{
- ACPI_MEMORY_ATTRIBUTE Memory;
- ACPI_IO_ATTRIBUTE Io;
- ACPI_BUS_ATTRIBUTE Bus;
+ UINT8 TypeSpecific;
} ACPI_RESOURCE_ATTRIBUTE;
typedef struct acpi_resource_source
{
- UINT32 Index;
- UINT32 StringLength;
- char *StringPtr;
+ UINT8 Index;
+ UINT16 StringLength;
+ char *StringPtr;
} ACPI_RESOURCE_SOURCE;
+/* Fields common to all address descriptors, 16/32/64 bit */
+
+#define ACPI_RESOURCE_ADDRESS_COMMON \
+ UINT8 ResourceType; \
+ UINT8 ProducerConsumer; \
+ UINT8 Decode; \
+ UINT8 MinAddressFixed; \
+ UINT8 MaxAddressFixed; \
+ ACPI_RESOURCE_ATTRIBUTE Info;
+
+typedef struct acpi_resource_address
+{
+ ACPI_RESOURCE_ADDRESS_COMMON
+
+} ACPI_RESOURCE_ADDRESS;
+
typedef struct acpi_resource_address16
{
- UINT32 ResourceType;
- UINT32 ProducerConsumer;
- UINT32 Decode;
- UINT32 MinAddressFixed;
- UINT32 MaxAddressFixed;
- ACPI_RESOURCE_ATTRIBUTE Attribute;
- UINT32 Granularity;
- UINT32 MinAddressRange;
- UINT32 MaxAddressRange;
- UINT32 AddressTranslationOffset;
- UINT32 AddressLength;
- ACPI_RESOURCE_SOURCE ResourceSource;
+ ACPI_RESOURCE_ADDRESS_COMMON
+ UINT16 Granularity;
+ UINT16 Minimum;
+ UINT16 Maximum;
+ UINT16 TranslationOffset;
+ UINT16 AddressLength;
+ ACPI_RESOURCE_SOURCE ResourceSource;
} ACPI_RESOURCE_ADDRESS16;
typedef struct acpi_resource_address32
{
- UINT32 ResourceType;
- UINT32 ProducerConsumer;
- UINT32 Decode;
- UINT32 MinAddressFixed;
- UINT32 MaxAddressFixed;
- ACPI_RESOURCE_ATTRIBUTE Attribute;
- UINT32 Granularity;
- UINT32 MinAddressRange;
- UINT32 MaxAddressRange;
- UINT32 AddressTranslationOffset;
- UINT32 AddressLength;
- ACPI_RESOURCE_SOURCE ResourceSource;
+ ACPI_RESOURCE_ADDRESS_COMMON
+ UINT32 Granularity;
+ UINT32 Minimum;
+ UINT32 Maximum;
+ UINT32 TranslationOffset;
+ UINT32 AddressLength;
+ ACPI_RESOURCE_SOURCE ResourceSource;
} ACPI_RESOURCE_ADDRESS32;
typedef struct acpi_resource_address64
{
- UINT32 ResourceType;
- UINT32 ProducerConsumer;
- UINT32 Decode;
- UINT32 MinAddressFixed;
- UINT32 MaxAddressFixed;
- ACPI_RESOURCE_ATTRIBUTE Attribute;
- UINT64 Granularity;
- UINT64 MinAddressRange;
- UINT64 MaxAddressRange;
- UINT64 AddressTranslationOffset;
- UINT64 AddressLength;
- ACPI_RESOURCE_SOURCE ResourceSource;
+ ACPI_RESOURCE_ADDRESS_COMMON
+ UINT64 Granularity;
+ UINT64 Minimum;
+ UINT64 Maximum;
+ UINT64 TranslationOffset;
+ UINT64 AddressLength;
+ ACPI_RESOURCE_SOURCE ResourceSource;
} ACPI_RESOURCE_ADDRESS64;
-typedef struct acpi_resource_ext_irq
+typedef struct acpi_resource_extended_address64
{
- UINT32 ProducerConsumer;
- UINT32 EdgeLevel;
- UINT32 ActiveHighLow;
- UINT32 SharedExclusive;
- UINT32 NumberOfInterrupts;
- ACPI_RESOURCE_SOURCE ResourceSource;
- UINT32 Interrupts[1];
+ ACPI_RESOURCE_ADDRESS_COMMON
+ UINT8 RevisionID;
+ UINT64 Granularity;
+ UINT64 Minimum;
+ UINT64 Maximum;
+ UINT64 TranslationOffset;
+ UINT64 AddressLength;
+ UINT64 TypeSpecific;
+
+} ACPI_RESOURCE_EXTENDED_ADDRESS64;
+
+typedef struct acpi_resource_extended_irq
+{
+ UINT8 ProducerConsumer;
+ UINT8 Triggering;
+ UINT8 Polarity;
+ UINT8 Sharable;
+ UINT8 InterruptCount;
+ ACPI_RESOURCE_SOURCE ResourceSource;
+ UINT32 Interrupts[1];
+
+} ACPI_RESOURCE_EXTENDED_IRQ;
+
+typedef struct acpi_resource_generic_register
+{
+ UINT8 SpaceId;
+ UINT8 BitWidth;
+ UINT8 BitOffset;
+ UINT8 AccessSize;
+ UINT64 Address;
-} ACPI_RESOURCE_EXT_IRQ;
+} ACPI_RESOURCE_GENERIC_REGISTER;
/* ACPI_RESOURCE_TYPEs */
-#define ACPI_RSTYPE_IRQ 0
-#define ACPI_RSTYPE_DMA 1
-#define ACPI_RSTYPE_START_DPF 2
-#define ACPI_RSTYPE_END_DPF 3
-#define ACPI_RSTYPE_IO 4
-#define ACPI_RSTYPE_FIXED_IO 5
-#define ACPI_RSTYPE_VENDOR 6
-#define ACPI_RSTYPE_END_TAG 7
-#define ACPI_RSTYPE_MEM24 8
-#define ACPI_RSTYPE_MEM32 9
-#define ACPI_RSTYPE_FIXED_MEM32 10
-#define ACPI_RSTYPE_ADDRESS16 11
-#define ACPI_RSTYPE_ADDRESS32 12
-#define ACPI_RSTYPE_ADDRESS64 13
-#define ACPI_RSTYPE_EXT_IRQ 14
+#define ACPI_RESOURCE_TYPE_IRQ 0
+#define ACPI_RESOURCE_TYPE_DMA 1
+#define ACPI_RESOURCE_TYPE_START_DEPENDENT 2
+#define ACPI_RESOURCE_TYPE_END_DEPENDENT 3
+#define ACPI_RESOURCE_TYPE_IO 4
+#define ACPI_RESOURCE_TYPE_FIXED_IO 5
+#define ACPI_RESOURCE_TYPE_VENDOR 6
+#define ACPI_RESOURCE_TYPE_END_TAG 7
+#define ACPI_RESOURCE_TYPE_MEMORY24 8
+#define ACPI_RESOURCE_TYPE_MEMORY32 9
+#define ACPI_RESOURCE_TYPE_FIXED_MEMORY32 10
+#define ACPI_RESOURCE_TYPE_ADDRESS16 11
+#define ACPI_RESOURCE_TYPE_ADDRESS32 12
+#define ACPI_RESOURCE_TYPE_ADDRESS64 13
+#define ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64 14 /* ACPI 3.0 */
+#define ACPI_RESOURCE_TYPE_EXTENDED_IRQ 15
+#define ACPI_RESOURCE_TYPE_GENERIC_REGISTER 16
+#define ACPI_RESOURCE_TYPE_MAX 16
-typedef UINT32 ACPI_RESOURCE_TYPE;
typedef union acpi_resource_data
{
- ACPI_RESOURCE_IRQ Irq;
- ACPI_RESOURCE_DMA Dma;
- ACPI_RESOURCE_START_DPF StartDpf;
- ACPI_RESOURCE_IO Io;
- ACPI_RESOURCE_FIXED_IO FixedIo;
- ACPI_RESOURCE_VENDOR VendorSpecific;
- ACPI_RESOURCE_END_TAG EndTag;
- ACPI_RESOURCE_MEM24 Memory24;
- ACPI_RESOURCE_MEM32 Memory32;
- ACPI_RESOURCE_FIXED_MEM32 FixedMemory32;
- ACPI_RESOURCE_ADDRESS16 Address16;
- ACPI_RESOURCE_ADDRESS32 Address32;
- ACPI_RESOURCE_ADDRESS64 Address64;
- ACPI_RESOURCE_EXT_IRQ ExtendedIrq;
+ ACPI_RESOURCE_IRQ Irq;
+ ACPI_RESOURCE_DMA Dma;
+ ACPI_RESOURCE_START_DEPENDENT StartDpf;
+ ACPI_RESOURCE_IO Io;
+ ACPI_RESOURCE_FIXED_IO FixedIo;
+ ACPI_RESOURCE_VENDOR Vendor;
+ ACPI_RESOURCE_VENDOR_TYPED VendorTyped;
+ ACPI_RESOURCE_END_TAG EndTag;
+ ACPI_RESOURCE_MEMORY24 Memory24;
+ ACPI_RESOURCE_MEMORY32 Memory32;
+ ACPI_RESOURCE_FIXED_MEMORY32 FixedMemory32;
+ ACPI_RESOURCE_ADDRESS16 Address16;
+ ACPI_RESOURCE_ADDRESS32 Address32;
+ ACPI_RESOURCE_ADDRESS64 Address64;
+ ACPI_RESOURCE_EXTENDED_ADDRESS64 ExtAddress64;
+ ACPI_RESOURCE_EXTENDED_IRQ ExtendedIrq;
+ ACPI_RESOURCE_GENERIC_REGISTER GenericReg;
+
+ /* Common fields */
+
+ ACPI_RESOURCE_ADDRESS Address; /* Common 16/32/64 address fields */
} ACPI_RESOURCE_DATA;
+
typedef struct acpi_resource
{
- ACPI_RESOURCE_TYPE Id;
- UINT32 Length;
- ACPI_RESOURCE_DATA Data;
+ UINT32 Type;
+ UINT32 Length;
+ ACPI_RESOURCE_DATA Data;
} ACPI_RESOURCE;
-#define ACPI_RESOURCE_LENGTH 12
-#define ACPI_RESOURCE_LENGTH_NO_DATA 8 /* Id + Length fields */
+/* restore default alignment */
-#define ACPI_SIZEOF_RESOURCE(Type) (ACPI_RESOURCE_LENGTH_NO_DATA + sizeof (Type))
+#pragma pack()
-#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
-#ifdef ACPI_MISALIGNED_TRANSFERS
-#define ACPI_ALIGN_RESOURCE_SIZE(Length) (Length)
-#else
-#define ACPI_ALIGN_RESOURCE_SIZE(Length) ACPI_ROUND_UP_TO_NATIVE_WORD(Length)
-#endif
+#define ACPI_RS_SIZE_MIN 12
+#define ACPI_RS_SIZE_NO_DATA 8 /* Id + Length fields */
+#define ACPI_RS_SIZE(Type) (UINT32) (ACPI_RS_SIZE_NO_DATA + sizeof (Type))
-/*
- * END: of definitions for Resource Attributes
- */
+#define ACPI_NEXT_RESOURCE(Res) (ACPI_RESOURCE *)((UINT8 *) Res + Res->Length)
typedef struct acpi_pci_routing_table
{
- UINT32 Length;
- UINT32 Pin;
- ACPI_INTEGER Address; /* here for 64-bit alignment */
- UINT32 SourceIndex;
- char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
+ UINT32 Length;
+ UINT32 Pin;
+ ACPI_INTEGER Address; /* here for 64-bit alignment */
+ UINT32 SourceIndex;
+ char Source[4]; /* pad to 64 bits so sizeof() works in all cases */
} ACPI_PCI_ROUTING_TABLE;
-/*
- * END: of definitions for PCI Routing tables
- */
-
#endif /* __ACTYPES_H__ */
Index: acstruct.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/acstruct.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/acstruct.h -L sys/contrib/dev/acpica/acstruct.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/acstruct.h
+++ sys/contrib/dev/acpica/acstruct.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Name: acstruct.h - Internal structs
- * $Revision: 28 $
+ * $Revision: 1.47 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -117,6 +117,7 @@
#ifndef __ACSTRUCT_H__
#define __ACSTRUCT_H__
+/* acpisrc:StructDefs -- for acpisrc conversion */
/*****************************************************************************
*
@@ -126,69 +127,81 @@
/*
- * Walk state - current state of a parse tree walk. Used for both a leisurely stroll through
- * the tree (for whatever reason), and for control method execution.
+ * Walk state - current state of a parse tree walk. Used for both a leisurely
+ * stroll through the tree (for whatever reason), and for control method
+ * execution.
*/
-
#define ACPI_NEXT_OP_DOWNWARD 1
#define ACPI_NEXT_OP_UPWARD 2
+/*
+ * Groups of definitions for WalkType used for different implementations of
+ * walkers (never simultaneously) - flags for interpreter:
+ */
#define ACPI_WALK_NON_METHOD 0
-#define ACPI_WALK_METHOD 1
-#define ACPI_WALK_METHOD_RESTART 2
-#define ACPI_WALK_CONST_REQUIRED 3
-#define ACPI_WALK_CONST_OPTIONAL 4
+#define ACPI_WALK_METHOD 0x01
+#define ACPI_WALK_METHOD_RESTART 0x02
+
+/* Flags for iASL compiler only */
+
+#define ACPI_WALK_CONST_REQUIRED 0x10
+#define ACPI_WALK_CONST_OPTIONAL 0x20
+
typedef struct acpi_walk_state
{
- UINT8 DataType; /* To differentiate various internal objs MUST BE FIRST!*/\
- UINT8 WalkType;
- ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
- BOOLEAN LastPredicate; /* Result of last predicate */
- UINT8 Reserved; /* For alignment */
- UINT8 CurrentResult; /* */
- UINT8 NextOpInfo; /* Info about NextOp */
- UINT8 NumOperands; /* Stack pointer for Operands[] array */
- UINT8 ReturnUsed;
- UINT16 Opcode; /* Current AML opcode */
- UINT8 ScopeDepth;
- UINT8 Reserved1;
- UINT32 ArgCount; /* push for fixed or var args */
- UINT32 AmlOffset;
- UINT32 ArgTypes;
- UINT32 MethodBreakpoint; /* For single stepping */
- UINT32 UserBreakpoint; /* User AML breakpoint */
- UINT32 ParseFlags;
- UINT32 PrevArgTypes;
-
- UINT8 *AmlLastWhile;
- struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
- union acpi_operand_object **CallerReturnDesc;
- ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
- struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */
- struct acpi_gpe_event_info *GpeEventInfo; /* Info for GPE (_Lxx/_Exx methods only */
- struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
- struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
- ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
- union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
- struct acpi_namespace_node *MethodNode; /* Method node if running a method. */
- ACPI_PARSE_OBJECT *Op; /* Current parser op */
- union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS+1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
- const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
- ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
- union acpi_operand_object **Params;
- ACPI_PARSE_STATE ParserState; /* Current state of parser */
- union acpi_operand_object *ResultObj;
- ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
- union acpi_operand_object *ReturnDesc; /* Return object, if any */
- ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
-
- ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
- ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
- ACPI_PARSE_DOWNWARDS DescendingCallback;
- ACPI_PARSE_UPWARDS AscendingCallback;
- ACPI_THREAD_STATE *Thread;
- struct acpi_walk_state *Next; /* Next WalkState in list */
+ struct acpi_walk_state *Next; /* Next WalkState in list */
+ UINT8 DescriptorType; /* To differentiate various internal objs */
+ UINT8 WalkType;
+ UINT16 Opcode; /* Current AML opcode */
+ UINT8 NextOpInfo; /* Info about NextOp */
+ UINT8 NumOperands; /* Stack pointer for Operands[] array */
+ UINT8 OperandIndex; /* Index into operand stack, to be used by AcpiDsObjStackPush */
+ ACPI_OWNER_ID OwnerId; /* Owner of objects created during the walk */
+ BOOLEAN LastPredicate; /* Result of last predicate */
+ UINT8 CurrentResult;
+ UINT8 ReturnUsed;
+ UINT8 ScopeDepth;
+ UINT8 PassNumber; /* Parse pass during table load */
+ UINT8 ResultSize; /* Total elements for the result stack */
+ UINT8 ResultCount; /* Current number of occupied elements of result stack */
+ UINT32 AmlOffset;
+ UINT32 ArgTypes;
+ UINT32 MethodBreakpoint; /* For single stepping */
+ UINT32 UserBreakpoint; /* User AML breakpoint */
+ UINT32 ParseFlags;
+
+ ACPI_PARSE_STATE ParserState; /* Current state of parser */
+ UINT32 PrevArgTypes;
+ UINT32 ArgCount; /* push for fixed or var args */
+
+ struct acpi_namespace_node Arguments[ACPI_METHOD_NUM_ARGS]; /* Control method arguments */
+ struct acpi_namespace_node LocalVariables[ACPI_METHOD_NUM_LOCALS]; /* Control method locals */
+ union acpi_operand_object *Operands[ACPI_OBJ_NUM_OPERANDS + 1]; /* Operands passed to the interpreter (+1 for NULL terminator) */
+ union acpi_operand_object **Params;
+
+ UINT8 *AmlLastWhile;
+ union acpi_operand_object **CallerReturnDesc;
+ ACPI_GENERIC_STATE *ControlState; /* List of control states (nested IFs) */
+ struct acpi_namespace_node *DeferredNode; /* Used when executing deferred opcodes */
+ struct acpi_gpe_event_info *GpeEventInfo; /* Info for GPE (_Lxx/_Exx methods only */
+ union acpi_operand_object *ImplicitReturnObj;
+ struct acpi_namespace_node *MethodCallNode; /* Called method Node*/
+ ACPI_PARSE_OBJECT *MethodCallOp; /* MethodCall Op if running a method */
+ union acpi_operand_object *MethodDesc; /* Method descriptor if running a method */
+ struct acpi_namespace_node *MethodNode; /* Method node if running a method. */
+ ACPI_PARSE_OBJECT *Op; /* Current parser op */
+ const ACPI_OPCODE_INFO *OpInfo; /* Info on current opcode */
+ ACPI_PARSE_OBJECT *Origin; /* Start of walk [Obsolete] */
+ union acpi_operand_object *ResultObj;
+ ACPI_GENERIC_STATE *Results; /* Stack of accumulated results */
+ union acpi_operand_object *ReturnDesc; /* Return object, if any */
+ ACPI_GENERIC_STATE *ScopeInfo; /* Stack of nested scopes */
+ ACPI_PARSE_OBJECT *PrevOp; /* Last op that was processed */
+ ACPI_PARSE_OBJECT *NextOp; /* next op to be processed */
+ ACPI_THREAD_STATE *Thread;
+ ACPI_PARSE_DOWNWARDS DescendingCallback;
+ ACPI_PARSE_UPWARDS AscendingCallback;
} ACPI_WALK_STATE;
@@ -197,106 +210,124 @@
typedef struct acpi_init_walk_info
{
- UINT16 MethodCount;
- UINT16 DeviceCount;
- UINT16 OpRegionCount;
- UINT16 FieldCount;
- UINT16 BufferCount;
- UINT16 PackageCount;
- UINT16 OpRegionInit;
- UINT16 FieldInit;
- UINT16 BufferInit;
- UINT16 PackageInit;
- UINT16 ObjectCount;
- ACPI_TABLE_DESC *TableDesc;
+ UINT16 MethodCount;
+ UINT16 DeviceCount;
+ UINT16 OpRegionCount;
+ UINT16 FieldCount;
+ UINT16 BufferCount;
+ UINT16 PackageCount;
+ UINT16 OpRegionInit;
+ UINT16 FieldInit;
+ UINT16 BufferInit;
+ UINT16 PackageInit;
+ UINT16 ObjectCount;
+ ACPI_OWNER_ID OwnerId;
+ ACPI_NATIVE_UINT TableIndex;
} ACPI_INIT_WALK_INFO;
-/* Info used by AcpiNsInitializeDevices */
-
-typedef struct acpi_device_walk_info
-{
- UINT16 DeviceCount;
- UINT16 Num_STA;
- UINT16 Num_INI;
- ACPI_TABLE_DESC *TableDesc;
-
-} ACPI_DEVICE_WALK_INFO;
-
-
-/* TBD: [Restructure] Merge with struct above */
-
-typedef struct acpi_walk_info
-{
- UINT32 DebugLevel;
- UINT32 OwnerId;
- UINT8 DisplayType;
-
-} ACPI_WALK_INFO;
-
-/* Display Types */
-
-#define ACPI_DISPLAY_SUMMARY 0
-#define ACPI_DISPLAY_OBJECTS 1
-
typedef struct acpi_get_devices_info
{
- ACPI_WALK_CALLBACK UserFunction;
- void *Context;
- char *Hid;
+ ACPI_WALK_CALLBACK UserFunction;
+ void *Context;
+ char *Hid;
} ACPI_GET_DEVICES_INFO;
typedef union acpi_aml_operands
{
- ACPI_OPERAND_OBJECT *Operands[7];
+ ACPI_OPERAND_OBJECT *Operands[7];
struct
{
- ACPI_OBJECT_INTEGER *Type;
- ACPI_OBJECT_INTEGER *Code;
- ACPI_OBJECT_INTEGER *Argument;
+ ACPI_OBJECT_INTEGER *Type;
+ ACPI_OBJECT_INTEGER *Code;
+ ACPI_OBJECT_INTEGER *Argument;
} Fatal;
struct
{
- ACPI_OPERAND_OBJECT *Source;
- ACPI_OBJECT_INTEGER *Index;
- ACPI_OPERAND_OBJECT *Target;
+ ACPI_OPERAND_OBJECT *Source;
+ ACPI_OBJECT_INTEGER *Index;
+ ACPI_OPERAND_OBJECT *Target;
} Index;
struct
{
- ACPI_OPERAND_OBJECT *Source;
- ACPI_OBJECT_INTEGER *Index;
- ACPI_OBJECT_INTEGER *Length;
- ACPI_OPERAND_OBJECT *Target;
+ ACPI_OPERAND_OBJECT *Source;
+ ACPI_OBJECT_INTEGER *Index;
+ ACPI_OBJECT_INTEGER *Length;
+ ACPI_OPERAND_OBJECT *Target;
} Mid;
} ACPI_AML_OPERANDS;
-/* Internal method parameter list */
-
-typedef struct acpi_parameter_info
+/*
+ * Structure used to pass object evaluation parameters.
+ * Purpose is to reduce CPU stack use.
+ */
+typedef struct acpi_evaluate_info
{
- ACPI_NAMESPACE_NODE *Node;
- ACPI_OPERAND_OBJECT **Parameters;
- ACPI_OPERAND_OBJECT *ReturnObject;
- UINT8 ParameterType;
- UINT8 ReturnObjectType;
+ ACPI_NAMESPACE_NODE *PrefixNode;
+ char *Pathname;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_OPERAND_OBJECT **Parameters;
+ ACPI_NAMESPACE_NODE *ResolvedNode;
+ ACPI_OPERAND_OBJECT *ReturnObject;
+ UINT8 PassNumber;
+ UINT8 ParameterType;
+ UINT8 ReturnObjectType;
+ UINT8 Flags;
-} ACPI_PARAMETER_INFO;
+} ACPI_EVALUATE_INFO;
/* Types for ParameterType above */
#define ACPI_PARAM_ARGS 0
#define ACPI_PARAM_GPE 1
+/* Values for Flags above */
+
+#define ACPI_IGNORE_RETURN_VALUE 1
+
+
+/* Info used by AcpiNsInitializeDevices */
+
+typedef struct acpi_device_walk_info
+{
+ UINT16 DeviceCount;
+ UINT16 Num_STA;
+ UINT16 Num_INI;
+ ACPI_TABLE_DESC *TableDesc;
+ ACPI_EVALUATE_INFO *EvaluateInfo;
+
+} ACPI_DEVICE_WALK_INFO;
+
+
+/* TBD: [Restructure] Merge with struct above */
+
+typedef struct acpi_walk_info
+{
+ UINT32 DebugLevel;
+ UINT32 Count;
+ ACPI_OWNER_ID OwnerId;
+ UINT8 DisplayType;
+
+} ACPI_WALK_INFO;
+
+/* Display Types */
+
+#define ACPI_DISPLAY_SUMMARY (UINT8) 0
+#define ACPI_DISPLAY_OBJECTS (UINT8) 1
+#define ACPI_DISPLAY_MASK (UINT8) 1
+
+#define ACPI_DISPLAY_SHORT (UINT8) 2
+
#endif
Index: excreate.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/excreate.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/excreate.c -L sys/contrib/dev/acpica/excreate.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/excreate.c
+++ sys/contrib/dev/acpica/excreate.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: excreate - Named object creation
- * $Revision: 103 $
+ * $Revision: 1.114 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -130,7 +130,7 @@
#ifndef ACPI_NO_METHOD_EXECUTION
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExCreateAlias
*
@@ -140,7 +140,7 @@
*
* DESCRIPTION: Create a new named alias
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreateAlias (
@@ -151,7 +151,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExCreateAlias");
+ ACPI_FUNCTION_TRACE (ExCreateAlias);
/* Get the source/alias operands (both namespace nodes) */
@@ -217,8 +217,7 @@
* target node or the alias Node
*/
Status = AcpiNsAttachObject (AliasNode,
- AcpiNsGetAttachedObject (TargetNode),
- TargetNode->Type);
+ AcpiNsGetAttachedObject (TargetNode), TargetNode->Type);
break;
}
@@ -228,7 +227,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExCreateEvent
*
@@ -238,7 +237,7 @@
*
* DESCRIPTION: Create a new event object
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreateEvent (
@@ -248,7 +247,7 @@
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE ("ExCreateEvent");
+ ACPI_FUNCTION_TRACE (ExCreateEvent);
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_EVENT);
@@ -263,7 +262,7 @@
* that the event is created in an unsignalled state
*/
Status = AcpiOsCreateSemaphore (ACPI_NO_UNIT_LIMIT, 0,
- &ObjDesc->Event.Semaphore);
+ &ObjDesc->Event.OsSemaphore);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -272,7 +271,7 @@
/* Attach object to the Node */
Status = AcpiNsAttachObject ((ACPI_NAMESPACE_NODE *) WalkState->Operands[0],
- ObjDesc, ACPI_TYPE_EVENT);
+ ObjDesc, ACPI_TYPE_EVENT);
Cleanup:
/*
@@ -284,7 +283,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExCreateMutex
*
@@ -296,7 +295,7 @@
*
* Mutex (Name[0], SyncLevel[1])
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreateMutex (
@@ -306,7 +305,7 @@
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExCreateMutex", ACPI_WALK_OPERANDS);
+ ACPI_FUNCTION_TRACE_PTR (ExCreateMutex, ACPI_WALK_OPERANDS);
/* Create the new mutex object */
@@ -318,12 +317,9 @@
goto Cleanup;
}
- /*
- * Create the actual OS semaphore.
- * One unit max to make it a mutex, with one initial unit to allow
- * the mutex to be acquired.
- */
- Status = AcpiOsCreateSemaphore (1, 1, &ObjDesc->Mutex.Semaphore);
+ /* Create the actual OS Mutex */
+
+ Status = AcpiOsCreateMutex (&ObjDesc->Mutex.OsMutex);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
@@ -334,8 +330,7 @@
ObjDesc->Mutex.SyncLevel = (UINT8) WalkState->Operands[1]->Integer.Value;
ObjDesc->Mutex.Node = (ACPI_NAMESPACE_NODE *) WalkState->Operands[0];
- Status = AcpiNsAttachObject (ObjDesc->Mutex.Node,
- ObjDesc, ACPI_TYPE_MUTEX);
+ Status = AcpiNsAttachObject (ObjDesc->Mutex.Node, ObjDesc, ACPI_TYPE_MUTEX);
Cleanup:
@@ -348,20 +343,20 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExCreateRegion
*
* PARAMETERS: AmlStart - Pointer to the region declaration AML
* AmlLength - Max length of the declaration AML
- * Operands - List of operands for the opcode
+ * RegionSpace - SpaceID for the region
* WalkState - Current state
*
* RETURN: Status
*
* DESCRIPTION: Create a new operation region object
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreateRegion (
@@ -376,7 +371,7 @@
ACPI_OPERAND_OBJECT *RegionObj2;
- ACPI_FUNCTION_TRACE ("ExCreateRegion");
+ ACPI_FUNCTION_TRACE (ExCreateRegion);
/* Get the Namespace Node */
@@ -399,12 +394,12 @@
if ((RegionSpace >= ACPI_NUM_PREDEFINED_REGIONS) &&
(RegionSpace < ACPI_USER_REGION_BEGIN))
{
- ACPI_REPORT_ERROR (("Invalid AddressSpace type %X\n", RegionSpace));
+ ACPI_ERROR ((AE_INFO, "Invalid AddressSpace type %X", RegionSpace));
return_ACPI_STATUS (AE_AML_INVALID_SPACE_ID);
}
ACPI_DEBUG_PRINT ((ACPI_DB_LOAD, "Region Type - %s (%X)\n",
- AcpiUtGetRegionName (RegionSpace), RegionSpace));
+ AcpiUtGetRegionName (RegionSpace), RegionSpace));
/* Create the region descriptor */
@@ -419,16 +414,16 @@
* Remember location in AML stream of address & length
* operands since they need to be evaluated at run time.
*/
- RegionObj2 = ObjDesc->Common.NextObject;
- RegionObj2->Extra.AmlStart = AmlStart;
+ RegionObj2 = ObjDesc->Common.NextObject;
+ RegionObj2->Extra.AmlStart = AmlStart;
RegionObj2->Extra.AmlLength = AmlLength;
/* Init the region from the operands */
ObjDesc->Region.SpaceId = RegionSpace;
ObjDesc->Region.Address = 0;
- ObjDesc->Region.Length = 0;
- ObjDesc->Region.Node = Node;
+ ObjDesc->Region.Length = 0;
+ ObjDesc->Region.Node = Node;
/* Install the new region object in the parent Node */
@@ -444,7 +439,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExCreateTableRegion
*
@@ -454,7 +449,7 @@
*
* DESCRIPTION: Create a new DataTableRegion object
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreateTableRegion (
@@ -464,11 +459,12 @@
ACPI_OPERAND_OBJECT **Operand = &WalkState->Operands[0];
ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_NAMESPACE_NODE *Node;
- ACPI_TABLE_HEADER *Table;
ACPI_OPERAND_OBJECT *RegionObj2;
+ ACPI_NATIVE_UINT TableIndex;
+ ACPI_TABLE_HEADER *Table;
- ACPI_FUNCTION_TRACE ("ExCreateTableRegion");
+ ACPI_FUNCTION_TRACE (ExCreateTableRegion);
/* Get the Node from the object stack */
@@ -487,8 +483,8 @@
/* Find the ACPI table */
Status = AcpiTbFindTable (Operand[1]->String.Pointer,
- Operand[2]->String.Pointer,
- Operand[3]->String.Pointer, &Table);
+ Operand[2]->String.Pointer, Operand[3]->String.Pointer,
+ &TableIndex);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -502,16 +498,22 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
- RegionObj2 = ObjDesc->Common.NextObject;
+ RegionObj2 = ObjDesc->Common.NextObject;
RegionObj2->Extra.RegionContext = NULL;
+ Status = AcpiGetTableByIndex (TableIndex, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
/* Init the region from the operands */
ObjDesc->Region.SpaceId = REGION_DATA_TABLE;
ObjDesc->Region.Address = (ACPI_PHYSICAL_ADDRESS) ACPI_TO_INTEGER (Table);
- ObjDesc->Region.Length = Table->Length;
- ObjDesc->Region.Node = Node;
- ObjDesc->Region.Flags = AOPOBJ_DATA_VALID;
+ ObjDesc->Region.Length = Table->Length;
+ ObjDesc->Region.Node = Node;
+ ObjDesc->Region.Flags = AOPOBJ_DATA_VALID;
/* Install the new region object in the parent Node */
@@ -546,7 +548,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExCreateProcessor
*
@@ -558,7 +560,7 @@
*
* Processor (Name[0], CpuID[1], PblockAddr[2], PblockLength[3])
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreateProcessor (
@@ -569,7 +571,7 @@
ACPI_STATUS Status;
- ACPI_FUNCTION_TRACE_PTR ("ExCreateProcessor", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (ExCreateProcessor, WalkState);
/* Create the processor object */
@@ -580,12 +582,11 @@
return_ACPI_STATUS (AE_NO_MEMORY);
}
- /*
- * Initialize the processor object from the operands
- */
- ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
+ /* Initialize the processor object from the operands */
+
+ ObjDesc->Processor.ProcId = (UINT8) Operand[1]->Integer.Value;
+ ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
ObjDesc->Processor.Address = (ACPI_IO_ADDRESS) Operand[2]->Integer.Value;
- ObjDesc->Processor.Length = (UINT8) Operand[3]->Integer.Value;
/* Install the processor object in the parent Node */
@@ -599,7 +600,7 @@
}
-/*****************************************************************************
+/*******************************************************************************
*
* FUNCTION: AcpiExCreatePowerResource
*
@@ -611,7 +612,7 @@
*
* PowerResource (Name[0], SystemLevel[1], ResourceOrder[2])
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreatePowerResource (
@@ -622,7 +623,7 @@
ACPI_OPERAND_OBJECT *ObjDesc;
- ACPI_FUNCTION_TRACE_PTR ("ExCreatePowerResource", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (ExCreatePowerResource, WalkState);
/* Create the power resource object */
@@ -635,7 +636,7 @@
/* Initialize the power object from the operands */
- ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
+ ObjDesc->PowerResource.SystemLevel = (UINT8) Operand[1]->Integer.Value;
ObjDesc->PowerResource.ResourceOrder = (UINT16) Operand[2]->Integer.Value;
/* Install the power resource object in the parent Node */
@@ -648,10 +649,10 @@
AcpiUtRemoveReference (ObjDesc);
return_ACPI_STATUS (Status);
}
-
#endif
-/*****************************************************************************
+
+/*******************************************************************************
*
* FUNCTION: AcpiExCreateMethod
*
@@ -663,7 +664,7 @@
*
* DESCRIPTION: Create a new method object
*
- ****************************************************************************/
+ ******************************************************************************/
ACPI_STATUS
AcpiExCreateMethod (
@@ -677,7 +678,7 @@
UINT8 MethodFlags;
- ACPI_FUNCTION_TRACE_PTR ("ExCreateMethod", WalkState);
+ ACPI_FUNCTION_TRACE_PTR (ExCreateMethod, WalkState);
/* Create a new method object */
@@ -685,44 +686,36 @@
ObjDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
if (!ObjDesc)
{
- return_ACPI_STATUS (AE_NO_MEMORY);
+ Status = AE_NO_MEMORY;
+ goto Exit;
}
/* Save the method's AML pointer and length */
- ObjDesc->Method.AmlStart = AmlStart;
+ ObjDesc->Method.AmlStart = AmlStart;
ObjDesc->Method.AmlLength = AmlLength;
/*
- * Disassemble the method flags. Split off the Arg Count
+ * Disassemble the method flags. Split off the Arg Count
* for efficiency
*/
MethodFlags = (UINT8) Operand[1]->Integer.Value;
ObjDesc->Method.MethodFlags = (UINT8) (MethodFlags & ~AML_METHOD_ARG_COUNT);
- ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT);
+ ObjDesc->Method.ParamCount = (UINT8) (MethodFlags & AML_METHOD_ARG_COUNT);
/*
- * Get the concurrency count. If required, a semaphore will be
+ * Get the SyncLevel. If method is serialized, a mutex will be
* created for this method when it is parsed.
*/
- if (AcpiGbl_AllMethodsSerialized)
- {
- ObjDesc->Method.Concurrency = 1;
- ObjDesc->Method.MethodFlags |= AML_METHOD_SERIALIZED;
- }
- else if (MethodFlags & AML_METHOD_SERIALIZED)
+ if (MethodFlags & AML_METHOD_SERIALIZED)
{
/*
- * ACPI 1.0: Concurrency = 1
- * ACPI 2.0: Concurrency = (SyncLevel (in method declaration) + 1)
+ * ACPI 1.0: SyncLevel = 0
+ * ACPI 2.0: SyncLevel = SyncLevel in method declaration
*/
- ObjDesc->Method.Concurrency = (UINT8)
- (((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4) + 1);
- }
- else
- {
- ObjDesc->Method.Concurrency = ACPI_INFINITE_CONCURRENCY;
+ ObjDesc->Method.SyncLevel = (UINT8)
+ ((MethodFlags & AML_METHOD_SYNCH_LEVEL) >> 4);
}
/* Attach the new object to the method Node */
@@ -734,6 +727,7 @@
AcpiUtRemoveReference (ObjDesc);
+Exit:
/* Remove a reference to the operand */
AcpiUtRemoveReference (Operand[1]);
Index: exregion.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/exregion.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/exregion.c -L sys/contrib/dev/acpica/exregion.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/exregion.c
+++ sys/contrib/dev/acpica/exregion.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: exregion - ACPI default OpRegion (address space) handlers
- * $Revision: 87 $
+ * $Revision: 1.101 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -158,11 +158,12 @@
ACPI_MEM_SPACE_CONTEXT *MemInfo = RegionContext;
UINT32 Length;
ACPI_SIZE WindowSize;
-#ifndef ACPI_MISALIGNED_TRANSFERS
+#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
UINT32 Remainder;
#endif
- ACPI_FUNCTION_TRACE ("ExSystemMemorySpaceHandler");
+
+ ACPI_FUNCTION_TRACE (ExSystemMemorySpaceHandler);
/* Validate and translate the bit width */
@@ -186,13 +187,12 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Invalid SystemMemory width %d\n",
+ ACPI_ERROR ((AE_INFO, "Invalid SystemMemory width %d",
BitWidth));
return_ACPI_STATUS (AE_AML_OPERAND_VALUE);
}
-
-#ifndef ACPI_MISALIGNED_TRANSFERS
+#ifdef ACPI_MISALIGNMENT_NOT_SUPPORTED
/*
* Hardware does not support non-aligned data transfers, we must verify
* the request.
@@ -211,7 +211,8 @@
*/
if ((Address < MemInfo->MappedPhysicalAddress) ||
(((ACPI_INTEGER) Address + Length) >
- ((ACPI_INTEGER) MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
+ ((ACPI_INTEGER)
+ MemInfo->MappedPhysicalAddress + MemInfo->MappedLength)))
{
/*
* The request cannot be resolved by the current memory mapping;
@@ -222,14 +223,16 @@
/* Valid mapping, delete it */
AcpiOsUnmapMemory (MemInfo->MappedLogicalAddress,
- MemInfo->MappedLength);
+ MemInfo->MappedLength);
}
/*
* Don't attempt to map memory beyond the end of the region, and
* constrain the maximum mapping size to something reasonable.
*/
- WindowSize = (ACPI_SIZE) ((MemInfo->Address + MemInfo->Length) - Address);
+ WindowSize = (ACPI_SIZE)
+ ((MemInfo->Address + MemInfo->Length) - Address);
+
if (WindowSize > ACPI_SYSMEM_REGION_WINDOW_SIZE)
{
WindowSize = ACPI_SYSMEM_REGION_WINDOW_SIZE;
@@ -237,14 +240,14 @@
/* Create a new mapping starting at the address given */
- Status = AcpiOsMapMemory (Address, WindowSize,
- (void **) &MemInfo->MappedLogicalAddress);
- if (ACPI_FAILURE (Status))
+ MemInfo->MappedLogicalAddress = AcpiOsMapMemory ((ACPI_NATIVE_UINT) Address, WindowSize);
+ if (!MemInfo->MappedLogicalAddress)
{
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Could not map memory at %8.8X%8.8X, size %X\n",
- ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize));
+ ACPI_ERROR ((AE_INFO,
+ "Could not map memory at %8.8X%8.8X, size %X",
+ ACPI_FORMAT_UINT64 (Address), (UINT32) WindowSize));
MemInfo->MappedLength = 0;
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_NO_MEMORY);
}
/* Save the physical address and mapping size */
@@ -258,20 +261,20 @@
* access
*/
LogicalAddrPtr = MemInfo->MappedLogicalAddress +
- ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
+ ((ACPI_INTEGER) Address - (ACPI_INTEGER) MemInfo->MappedPhysicalAddress);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "SystemMemory %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
- ACPI_FORMAT_UINT64 (Address)));
+ "System-Memory (width %d) R/W %d Address=%8.8X%8.8X\n",
+ BitWidth, Function, ACPI_FORMAT_UINT64 (Address)));
- /*
- * Perform the memory read or write
- *
- * Note: For machines that do not support non-aligned transfers, the target
- * address was checked for alignment above. We do not attempt to break the
- * transfer up into smaller (byte-size) chunks because the AML specifically
- * asked for a transfer width that the hardware may require.
- */
+ /*
+ * Perform the memory read or write
+ *
+ * Note: For machines that do not support non-aligned transfers, the target
+ * address was checked for alignment above. We do not attempt to break the
+ * transfer up into smaller (byte-size) chunks because the AML specifically
+ * asked for a transfer width that the hardware may require.
+ */
switch (Function)
{
case ACPI_READ:
@@ -280,22 +283,21 @@
switch (BitWidth)
{
case 8:
- *Value = (ACPI_INTEGER) *((UINT8 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET8 (LogicalAddrPtr);
break;
case 16:
- *Value = (ACPI_INTEGER) *((UINT16 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET16 (LogicalAddrPtr);
break;
case 32:
- *Value = (ACPI_INTEGER) *((UINT32 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET32 (LogicalAddrPtr);
break;
-#if ACPI_MACHINE_WIDTH != 16
case 64:
- *Value = (ACPI_INTEGER) *((UINT64 *) LogicalAddrPtr);
+ *Value = (ACPI_INTEGER) ACPI_GET64 (LogicalAddrPtr);
break;
-#endif
+
default:
/* BitWidth was already validated */
break;
@@ -307,22 +309,20 @@
switch (BitWidth)
{
case 8:
- *(UINT8 *) LogicalAddrPtr = (UINT8) *Value;
+ ACPI_SET8 (LogicalAddrPtr) = (UINT8) *Value;
break;
case 16:
- *(UINT16 *) LogicalAddrPtr = (UINT16) *Value;
+ ACPI_SET16 (LogicalAddrPtr) = (UINT16) *Value;
break;
case 32:
- *(UINT32 *) LogicalAddrPtr = (UINT32) *Value;
+ ACPI_SET32 ( LogicalAddrPtr) = (UINT32) *Value;
break;
-#if ACPI_MACHINE_WIDTH != 16
case 64:
- *(UINT64 *) LogicalAddrPtr = (UINT64) *Value;
+ ACPI_SET64 (LogicalAddrPtr) = (UINT64) *Value;
break;
-#endif
default:
/* BitWidth was already validated */
@@ -370,12 +370,12 @@
UINT32 Value32;
- ACPI_FUNCTION_TRACE ("ExSystemIoSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExSystemIoSpaceHandler);
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "SystemIO %d (%d width) Address=%8.8X%8.8X\n", Function, BitWidth,
- ACPI_FORMAT_UINT64 (Address)));
+ "System-IO (width %d) R/W %d Address=%8.8X%8.8X\n",
+ BitWidth, Function, ACPI_FORMAT_UINT64 (Address)));
/* Decode the function parameter */
@@ -383,13 +383,15 @@
{
case ACPI_READ:
- Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address, &Value32, BitWidth);
+ Status = AcpiOsReadPort ((ACPI_IO_ADDRESS) Address,
+ &Value32, BitWidth);
*Value = Value32;
break;
case ACPI_WRITE:
- Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address, (UINT32) *Value, BitWidth);
+ Status = AcpiOsWritePort ((ACPI_IO_ADDRESS) Address,
+ (UINT32) *Value, BitWidth);
break;
default:
@@ -433,7 +435,7 @@
UINT16 PciRegister;
- ACPI_FUNCTION_TRACE ("ExPciConfigSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExPciConfigSpaceHandler);
/*
@@ -452,7 +454,7 @@
PciRegister = (UINT16) (UINT32) Address;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO,
- "PciConfig %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
+ "Pci-Config %d (%d) Seg(%04x) Bus(%04x) Dev(%04x) Func(%04x) Reg(%04x)\n",
Function, BitWidth, PciId->Segment, PciId->Bus, PciId->Device,
PciId->Function, PciRegister));
@@ -461,12 +463,14 @@
case ACPI_READ:
*Value = 0;
- Status = AcpiOsReadPciConfiguration (PciId, PciRegister, Value, BitWidth);
+ Status = AcpiOsReadPciConfiguration (PciId, PciRegister,
+ Value, BitWidth);
break;
case ACPI_WRITE:
- Status = AcpiOsWritePciConfiguration (PciId, PciRegister, *Value, BitWidth);
+ Status = AcpiOsWritePciConfiguration (PciId, PciRegister,
+ *Value, BitWidth);
break;
default:
@@ -509,7 +513,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExCmosSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExCmosSpaceHandler);
return_ACPI_STATUS (Status);
@@ -546,7 +550,7 @@
ACPI_STATUS Status = AE_OK;
- ACPI_FUNCTION_TRACE ("ExPciBarSpaceHandler");
+ ACPI_FUNCTION_TRACE (ExPciBarSpaceHandler);
return_ACPI_STATUS (Status);
@@ -580,28 +584,17 @@
void *HandlerContext,
void *RegionContext)
{
- ACPI_STATUS Status = AE_OK;
- UINT32 ByteWidth = ACPI_DIV_8 (BitWidth);
- UINT32 i;
- char *LogicalAddrPtr;
-
-
- ACPI_FUNCTION_TRACE ("ExDataTableSpaceHandler");
-
+ ACPI_FUNCTION_TRACE (ExDataTableSpaceHandler);
- LogicalAddrPtr = ACPI_PHYSADDR_TO_PTR (Address);
-
- /* Perform the memory read or write */
+ /* Perform the memory read or write */
switch (Function)
{
case ACPI_READ:
- for (i = 0; i < ByteWidth; i++)
- {
- ((char *) Value) [i] = LogicalAddrPtr[i];
- }
+ ACPI_MEMCPY (ACPI_CAST_PTR (char, Value), ACPI_PHYSADDR_TO_PTR (Address),
+ ACPI_DIV_8 (BitWidth));
break;
case ACPI_WRITE:
@@ -610,7 +603,7 @@
return_ACPI_STATUS (AE_SUPPORT);
}
- return_ACPI_STATUS (Status);
+ return_ACPI_STATUS (AE_OK);
}
--- /dev/null
+++ sys/contrib/dev/acpica/common/dmtbinfo.c
@@ -0,0 +1,967 @@
+/******************************************************************************
+ *
+ * Module Name: dmtbinfo - Table info for non-AML tables
+ * $Revision: 1.13 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtbinfo")
+
+/*
+ * Macros used to generate offsets to specific table fields
+ */
+#define ACPI_FACS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FACS,f)
+#define ACPI_GAS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f)
+#define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f)
+#define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f)
+#define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f)
+#define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f)
+#define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f)
+#define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f)
+#define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f)
+#define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f)
+#define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f)
+#define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f)
+#define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f)
+#define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f)
+#define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f)
+#define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f)
+#define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f)
+#define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f)
+#define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f)
+
+/* Sub-tables */
+
+#define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f)
+#define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f)
+#define ACPI_ASF1a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f)
+#define ACPI_ASF2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_REMOTE,f)
+#define ACPI_ASF2a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f)
+#define ACPI_ASF3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_RMCP,f)
+#define ACPI_ASF4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ADDRESS,f)
+#define ACPI_CPEP0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_CPEP_POLLING,f)
+#define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f)
+#define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f)
+#define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f)
+#define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f)
+#define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f)
+#define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f)
+#define ACPI_MADT3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f)
+#define ACPI_MADT4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f)
+#define ACPI_MADT5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f)
+#define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f)
+#define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f)
+#define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f)
+#define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f)
+#define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f)
+#define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f)
+#define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f)
+
+/*
+ * Simplify access to flag fields by breaking them up into bytes
+ */
+#define ACPI_FLAG_OFFSET(d,f,o) (UINT8) (ACPI_OFFSET (d,f) + o)
+
+/* Flags */
+
+#define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o)
+#define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o)
+#define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o)
+#define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o)
+#define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o)
+#define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o)
+#define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o)
+#define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o)
+#define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_NMI_SOURCE,f,o)
+#define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o)
+#define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o)
+#define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o)
+
+
+/*
+ * ACPI Table Information, used to dump formatted ACPI tables
+ *
+ * Each entry is of the form: <Field Type, Field Offset, Field Name>
+ */
+
+/*******************************************************************************
+ *
+ * Common ACPI table header
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[] =
+{
+ {ACPI_DMT_SIG, ACPI_HDR_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (Length), "Table Length"},
+ {ACPI_DMT_UINT8, ACPI_HDR_OFFSET (Revision), "Revision"},
+ {ACPI_DMT_CHKSUM, ACPI_HDR_OFFSET (Checksum), "Checksum"},
+ {ACPI_DMT_NAME6, ACPI_HDR_OFFSET (OemId[0]), "Oem ID"},
+ {ACPI_DMT_NAME8, ACPI_HDR_OFFSET (OemTableId[0]), "Oem Table ID"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (OemRevision), "Oem Revision"},
+ {ACPI_DMT_NAME4, ACPI_HDR_OFFSET (AslCompilerId[0]), "Asl Compiler ID"},
+ {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (AslCompilerRevision), "Asl Compiler Revision"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * GAS - Generic Address Structure
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] =
+{
+ {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset"},
+ {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (AccessWidth), "Access Width"},
+ {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * RSDP - Root System Description Pointer (Signature is "RSD PTR ")
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[] =
+{
+ {ACPI_DMT_NAME8, ACPI_RSDP_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Checksum), "Checksum"},
+ {ACPI_DMT_NAME6, ACPI_RSDP_OFFSET (OemId[0]), "Oem ID"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Revision), "Revision"},
+ {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (RsdtPhysicalAddress), "RSDT Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* ACPI 2.0+ Extensions */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[] =
+{
+ {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT64, ACPI_RSDP_OFFSET (XsdtPhysicalAddress), "XSDT Address"},
+ {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (ExtendedChecksum), "Extended Checksum"},
+ {ACPI_DMT_UINT24, ACPI_RSDP_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FACS - Firmware ACPI Control Structure
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] =
+{
+ {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "Firmware Waking Vector(32)"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock"},
+ {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present"},
+ {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "Firmware Waking Vector(64)"},
+ {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FADT - Fixed ACPI Description Table (Signature is FACP)
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] =
+{
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiDisable), "ACPI Disable Value"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (S4BiosRequest), "S4BIOS Command"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PstateControl), "P-State Control"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aEventBlock), "PM1A Event Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bEventBlock), "PM1B Event Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aControlBlock), "PM1A Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bControlBlock), "PM1B Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm2ControlBlock), "PM2 Control Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (PmTimerBlock), "PM Timer Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe0Block), "GPE0 Block Address"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe1Block), "GPE1 Block Address"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1EventLength), "PM1 Event Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1ControlLength), "PM1 Control Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm2ControlLength), "PM2 Control Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PmTimerLength), "PM Timer Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe0BlockLength), "GPE0 Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1BlockLength), "GPE1 Block Length"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1Base), "GPE1 Base Offset"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (CstControl), "_CST Support"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C2Latency), "C2 Latency"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C3Latency), "C3 Latency"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushSize), "CPU Cache Size"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushStride), "Cache Flush Stride"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyOffset), "Duty Cycle Offset"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyWidth), "Duty Cycle Width"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index"},
+ {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Architecture Flags"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)"},
+
+ /* Flags byte 0 */
+
+ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD is operational"},
+ {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD does not invalidate"},
+ {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1"},
+ {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system"},
+ {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Power button is generic"},
+ {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Sleep button is generic"},
+ {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup not fixed"},
+ {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wakeup/S4 not possible"},
+
+ /* Flags byte 1 */
+
+ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer"},
+ {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* ACPI 2.0+ Extensions */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] =
+{
+ {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported"},
+ {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case"},
+ {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video"},
+ {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Native instr after SLP_TYP"},
+ {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Supported"},
+ {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer"},
+
+ /* Flags byte 2 */
+
+ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid after S4"},
+ {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable"},
+ {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Cluster Model"},
+ {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "APIC Physical Dest Mode"},
+
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register"},
+ {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset"},
+ {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved"},
+ {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address"},
+ {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bEventBlock), "PM1B Event Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aControlBlock), "PM1A Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bControlBlock), "PM1B Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm2ControlBlock), "PM2 Control Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPmTimerBlock), "PM Timer Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe0Block), "GPE0 Block"},
+ {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe1Block), "GPE1 Block"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*
+ * Remaining tables are not consumed directly by the ACPICA subsystem
+ */
+
+/*******************************************************************************
+ *
+ * ASF - Alert Standard Format table (Signature "ASF!")
+ *
+ ******************************************************************************/
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved"},
+ {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 0: ASF Information */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Polling Interval"},
+ {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID"},
+ {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (SystemId), "Manufacturer ID"},
+ {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags"},
+ {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: ASF Alerts */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (AssertMask), "AssertMask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DeassertMask), "DeassertMask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (Alerts), "Alert Count"},
+ {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DataLength), "Alert Data Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1a: ASF Alert data */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Mask), "Mask"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Value), "Value"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorType), "SensorType"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Type), "Type"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Offset), "Offset"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SourceType), "SourceType"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Severity), "Severity"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorNumber), "SensorNumber"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Entity), "Entity"},
+ {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Instance), "Instance"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2: ASF Remote Control */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (Controls), "Control Count"},
+ {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (DataLength), "Control Data Length"},
+ {ACPI_DMT_UINT16, ACPI_ASF2_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2a: ASF Control data */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Function), "Function"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Value), "Value"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 3: ASF RMCP Boot Options */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] =
+{
+ {ACPI_DMT_UINT56, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilites"},
+ {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code"},
+ {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID"},
+ {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (Parameter), "Parameter"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (BootOptions), "Boot Options"},
+ {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (OemParameters), "Oem Parameters"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 4: ASF Address */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] =
+{
+ {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (EpromAddress), "Eprom Address"},
+ {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (Devices), "Device Count"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * BOOT - Simple Boot Flag Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] =
+{
+ {ACPI_DMT_UINT8, ACPI_BOOT_OFFSET (CmosIndex), "Boot Register Index"},
+ {ACPI_DMT_UINT24, ACPI_BOOT_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * CPEP - Corrected Platform Error Polling table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] =
+{
+ {ACPI_DMT_UINT64, ACPI_CPEP_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Length), "Length"},
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID"},
+ {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * DBGP - Debug Port
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DBGP_OFFSET (Type), "Interface Type"},
+ {ACPI_DMT_UINT24, ACPI_DBGP_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_GAS, ACPI_DBGP_OFFSET (DebugPort), "Debug Port Register"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * DMAR - DMA Remapping table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] =
+{
+ {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Header.Flags), "Flags"},
+ {ACPI_DMT_UINT24, ACPI_DMAR0_OFFSET (Header.Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common device scope entry */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] =
+{
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type"},
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length"},
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Segment), "PCI Segment Number"},
+ {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* DMAR sub-tables */
+
+/* 0: Hardware Unit Definition */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] =
+{
+ {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: Reserved Memory Defininition */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] =
+{
+ {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (Address), "Base Address"},
+ {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * ECDT - Embedded Controller Boot Resources Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] =
+{
+ {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Control), "Command/Status Register"},
+ {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Data), "Data Register"},
+ {ACPI_DMT_UINT32, ACPI_ECDT_OFFSET (Uid), "UID"},
+ {ACPI_DMT_UINT8, ACPI_ECDT_OFFSET (Gpe), "GPE Number"},
+ {ACPI_DMT_STRING, ACPI_ECDT_OFFSET (Id[0]), "Namepath"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * HPET - High Precision Event Timer table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] =
+{
+ {ACPI_DMT_UINT32, ACPI_HPET_OFFSET (Id), "Hardware Block ID"},
+ {ACPI_DMT_GAS, ACPI_HPET_OFFSET (Address), "Timer Block Register"},
+ {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number"},
+ {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks"},
+ {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "Page Protect"},
+ {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect"},
+ {ACPI_DMT_FLAG2, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * MADT - Multiple APIC Description Table and subtables
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] =
+{
+ {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Address), "Local Apic Address"},
+ {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT_FLAG_OFFSET (Flags,0), "PC-AT Compatibility"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* Common sub-table header (one per sub-table) */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] =
+{
+ {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* MADT sub-tables */
+
+/* 0: processor APIC */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (Id), "Local Apic ID"},
+ {ACPI_DMT_UINT32, ACPI_MADT0_OFFSET (LapicFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT0_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 1: IO APIC */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Id), "I/O Apic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (Address), "Address"},
+ {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (GlobalIrqBase), "Interrupt"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 2: Interrupt Override */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (Bus), "Bus"},
+ {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (SourceIrq), "Source"},
+ {ACPI_DMT_UINT32, ACPI_MADT2_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_UINT16, ACPI_MADT2_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 3: NMI Sources */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT3_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT32, ACPI_MADT3_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 4: Local APIC NMI */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT16, ACPI_MADT4_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (Lint), "Interrupt Input LINT"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 5: Address Override */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT5_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT64, ACPI_MADT5_OFFSET (Address), "APIC Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 6: I/O Sapic */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Id), "I/O Sapic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT6_OFFSET (GlobalIrqBase), "Interrupt Base"},
+ {ACPI_DMT_UINT64, ACPI_MADT6_OFFSET (Address), "Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 7: Local Sapic */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[] =
+{
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (ProcessorId), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Id), "Local Sapic ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Eid), "Local Sapic EID"},
+ {ACPI_DMT_UINT24, ACPI_MADT7_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (LapicFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT7_FLAG_OFFSET (LapicFlags,0), "Processor Enabled"},
+ {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (Uid), "Processor UID"},
+ {ACPI_DMT_STRING, ACPI_MADT7_OFFSET (UidString[0]), "Processor UID String"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+/* 8: Platform Interrupt Source */
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] =
+{
+ {ACPI_DMT_UINT16, ACPI_MADT8_OFFSET (IntiFlags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAGS0, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Polarity"},
+ {ACPI_DMT_FLAGS2, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Trigger Mode"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Type), "InterruptType"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Id), "Processor ID"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Eid), "Processor EID"},
+ {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (IoSapicVector), "I/O Sapic Vector"},
+ {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (GlobalIrq), "Interrupt"},
+ {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_MADT8_OFFSET (Flags), "CPEI Override"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * MCFG - PCI Memory Mapped Configuration table and sub-table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[] =
+{
+ {ACPI_DMT_UINT64, ACPI_MCFG_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] =
+{
+ {ACPI_DMT_UINT64, ACPI_MCFG0_OFFSET (Address), "Base Address"},
+ {ACPI_DMT_UINT16, ACPI_MCFG0_OFFSET (PciSegment), "Segment Group Number"},
+ {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (StartBusNumber), "Start Bus Number"},
+ {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (EndBusNumber), "End Bus Number"},
+ {ACPI_DMT_UINT32, ACPI_MCFG0_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SBST - Smart Battery Specification Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] =
+{
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (WarningLevel), "Warning Level"},
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (LowLevel), "Low Level"},
+ {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (CriticalLevel), "Critical Level"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SLIT - System Locality Information Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] =
+{
+ {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SPCR - Serial Port Console Redirection table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] =
+{
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterfaceType), "Interface Type"},
+ {ACPI_DMT_UINT24, ACPI_SPCR_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_GAS, ACPI_SPCR_OFFSET (SerialPort), "Serial Port Register"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterruptType), "Interrupt Type"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PcInterrupt), "PCAT-compatible IRQ"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Interrupt), "Interrupt"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (BaudRate), "Baud Rate"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Parity), "Parity"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (StopBits), "Stop Bits"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (FlowControl), "Flow Control"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (TerminalType), "Terminal Type"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciDeviceId), "PCI Device ID"},
+ {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciVendorId), "PCI Vendor ID"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PciFlags), "PCI Flags"},
+ {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SPMI - Server Platform Management Interface table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] =
+{
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type"},
+ {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved1), "Reserved"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDeviceFlag), "PCI Device Flag"},
+ {ACPI_DMT_UINT32, ACPI_SPMI_OFFSET (Interrupt), "Interrupt"},
+ {ACPI_DMT_GAS, ACPI_SPMI_OFFSET (IpmiRegister), "IPMI Register"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * SRAT - System Resource Affinity Table and sub-tables
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] =
+{
+ {ACPI_DMT_UINT32, ACPI_SRAT_OFFSET (TableRevision), "Table Revision"},
+ {ACPI_DMT_UINT64, ACPI_SRAT_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] =
+{
+ {ACPI_DMT_SRAT, ACPI_SRAT0_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID"},
+ {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_SRAT0_FLAG_OFFSET (Flags,0), "Enabled"},
+ {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (LocalSapicEid), "Local Sapic EID"},
+ {ACPI_DMT_UINT24, ACPI_SRAT0_OFFSET (ProximityDomainHi[0]), "Proximity Domain High(24)"},
+ {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] =
+{
+ {ACPI_DMT_SRAT, ACPI_SRAT1_OFFSET (Header.Type), "Sub-Table Type"},
+ {ACPI_DMT_UINT8, ACPI_SRAT1_OFFSET (Header.Length), "Length"},
+ {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain"},
+ {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address"},
+ {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length"},
+ {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (MemoryType), "Memory Type"},
+ {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled"},
+ {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable"},
+ {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile"},
+ {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved1), "Reserved"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * TCPA - Trusted Computing Platform Alliance table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] =
+{
+ {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length"},
+ {ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * WDRT - Watchdog Resource Table
+ *
+ ******************************************************************************/
+
+ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] =
+{
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (HeaderLength), "Header Length"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (TimerPeriod), "Timer Period"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MaxCount), "Max Count"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (MinCount), "Min Count"},
+ {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Flags), "Flags (decoded below)"},
+ {ACPI_DMT_FLAG0, ACPI_WDRT_OFFSET (Flags), "Enabled"},
+ {ACPI_DMT_FLAG7, ACPI_WDRT_OFFSET (Flags), "Stopped When Asleep"},
+ {ACPI_DMT_UINT24, ACPI_WDRT_OFFSET (Reserved[0]), "Reserved"},
+ {ACPI_DMT_UINT32, ACPI_WDRT_OFFSET (Entries), "Watchdog Entries"},
+ {ACPI_DMT_EXIT, 0, NULL}
+};
+
Index: adisasm.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/common/adisasm.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/common/adisasm.c -L sys/contrib/dev/acpica/common/adisasm.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/common/adisasm.c
+++ sys/contrib/dev/acpica/common/adisasm.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: adisasm - Application-level disassembler routines
- * $Revision: 69 $
+ * $Revision: 1.104 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,28 +115,50 @@
*****************************************************************************/
-#include "acpi.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acdebug.h"
-#include "acdisasm.h"
-#include "acdispat.h"
-#include "acnamesp.h"
-#include "acapps.h"
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acdebug.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/actables.h>
+#include <contrib/dev/acpica/acapps.h>
#include <stdio.h>
-#include <string.h>
#include <time.h>
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("adisasm")
+extern int AslCompilerdebug;
-ACPI_PARSE_OBJECT *AcpiGbl_ParsedNamespaceRoot;
+ACPI_STATUS
+LsDisplayNamespace (
+ void);
+
+void
+LsSetupNsList (void * Handle);
-#ifndef _ACPI_ASL_COMPILER
+/* Local prototypes */
+
+void
+AdCreateTableHeader (
+ char *Filename,
+ ACPI_TABLE_HEADER *Table);
+
+void
+AdDisassemblerHeader (
+ char *Filename);
+
+ACPI_PARSE_OBJECT *AcpiGbl_ParseOpRoot;
+
+
+/* Stubs for ASL compiler */
+
+#ifndef ACPI_ASL_COMPILER
BOOLEAN
AcpiDsIsResultUsed (
ACPI_PARSE_OBJECT *Op,
@@ -144,9 +166,26 @@
{
return TRUE;
}
+
+ACPI_STATUS
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
+{
+ return (Status);
+}
+
#endif
ACPI_STATUS
+AcpiNsLoadTable (
+ ACPI_NATIVE_UINT TableIndex,
+ ACPI_NAMESPACE_NODE *Node)
+{
+ return (AE_NOT_IMPLEMENTED);
+}
+
+ACPI_STATUS
AcpiDsRestartControlMethod (
ACPI_WALK_STATE *WalkState,
ACPI_OPERAND_OBJECT *ReturnDesc)
@@ -154,11 +193,12 @@
return (AE_OK);
}
-ACPI_STATUS
+void
AcpiDsTerminateControlMethod (
+ ACPI_OPERAND_OBJECT *MethodDesc,
ACPI_WALK_STATE *WalkState)
{
- return (AE_OK);
+ return;
}
ACPI_STATUS
@@ -180,112 +220,7 @@
}
-#define FILE_SUFFIX_DISASSEMBLY "dsl"
-#define ACPI_TABLE_FILE_SUFFIX ".dat"
-char FilenameBuf[20];
-
-/******************************************************************************
- *
- * FUNCTION: AfGenerateFilename
- *
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Build an output filename from an ACPI table ID string
- *
- ******************************************************************************/
-
-char *
-AdGenerateFilename (
- char *Prefix,
- char *TableId)
-{
- ACPI_NATIVE_UINT i;
- ACPI_NATIVE_UINT j;
-
-
- for (i = 0; Prefix[i]; i++)
- {
- FilenameBuf[i] = Prefix[i];
- }
-
- FilenameBuf[i] = '_';
- i++;
-
- for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
- {
- FilenameBuf[i] = TableId[j];
- }
-
- FilenameBuf[i] = 0;
- strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
- return FilenameBuf;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AfWriteBuffer
- *
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Open a file and write out a single buffer
- *
- ******************************************************************************/
-
-ACPI_NATIVE_INT
-AdWriteBuffer (
- char *Filename,
- char *Buffer,
- UINT32 Length)
-{
- FILE *fp;
- ACPI_NATIVE_INT Actual;
-
-
- fp = fopen (Filename, "wb");
- if (!fp)
- {
- printf ("Couldn't open %s\n", Filename);
- return -1;
- }
-
- Actual = fwrite (Buffer, (size_t) Length, 1, fp);
- fclose (fp);
- return Actual;
-}
-
-
-/******************************************************************************
- *
- * FUNCTION: AfWriteTable
- *
- * PARAMETERS:
- *
- * RETURN:
- *
- * DESCRIPTION: Dump the loaded tables to a file (or files)
- *
- ******************************************************************************/
-
-void
-AdWriteTable (
- ACPI_TABLE_HEADER *Table,
- UINT32 Length,
- char *TableName,
- char *OemTableId)
-{
- char *Filename;
-
-
- Filename = AdGenerateFilename (TableName, OemTableId);
- AdWriteBuffer (Filename, (char *) Table, Length);
-
- AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
-}
+ACPI_TABLE_DESC LocalTables[1];
/*******************************************************************************
@@ -309,7 +244,9 @@
/* ACPI CA subsystem initialization */
+ Status = AcpiOsInitialize ();
AcpiUtInitGlobals ();
+
Status = AcpiUtMutexInitialize ();
if (ACPI_FAILURE (Status))
{
@@ -317,133 +254,92 @@
}
Status = AcpiNsRootInitialize ();
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
+ /* Setup the Table Manager (cheat - there is no RSDT) */
+
+ AcpiGbl_RootTableList.Size = 1;
+ AcpiGbl_RootTableList.Count = 0;
+ AcpiGbl_RootTableList.Tables = LocalTables;
+
return Status;
}
/*******************************************************************************
*
- * FUNCTION: FlGenerateFilename
+ * FUNCTION: AdAddExternalsToNamespace
*
- * PARAMETERS: InputFilename - Original ASL source filename
- * Suffix - New extension.
+ * PARAMETERS:
*
- * RETURN: New filename containing the original base + the new suffix
+ * RETURN: Status
*
- * DESCRIPTION: Generate a new filename from the ASL source filename and a new
- * extension. Used to create the *.LST, *.TXT, etc. files.
+ * DESCRIPTION:
*
******************************************************************************/
-char *
-FlGenerateFilename (
- char *InputFilename,
- char *Suffix)
+void
+AdAddExternalsToNamespace (
+ void)
{
- char *Position;
- char *NewFilename;
-
-
- /* Copy the original filename to a new buffer */
-
- NewFilename = ACPI_MEM_CALLOCATE (strlen (InputFilename) + strlen (Suffix));
- strcpy (NewFilename, InputFilename);
+ ACPI_STATUS Status;
+ ACPI_NAMESPACE_NODE *Node;
+ ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
+ ACPI_OPERAND_OBJECT *MethodDesc;
- /* Try to find the last dot in the filename */
- Position = strrchr (NewFilename, '.');
- if (Position)
+ while (External)
{
- /* Tack on the new suffix */
+ Status = AcpiNsLookup (NULL, External->InternalPath, External->Type,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_EXTERNAL | ACPI_NS_DONT_OPEN_SCOPE,
+ NULL, &Node);
- Position++;
- *Position = 0;
- strcat (Position, Suffix);
- }
- else
- {
- /* No dot, add one and then the suffix */
+ if (External->Type == ACPI_TYPE_METHOD)
+ {
+ MethodDesc = AcpiUtCreateInternalObject (ACPI_TYPE_METHOD);
+ MethodDesc->Method.ParamCount = (UINT8) External->Value;
+ Node->Object = MethodDesc;
+ }
- strcat (NewFilename, ".");
- strcat (NewFilename, Suffix);
+ External = External->Next;
}
-
- return NewFilename;
}
/*******************************************************************************
*
- * FUNCTION: FlSplitInputPathname
+ * FUNCTION: AdMethodExternalCount
*
- * PARAMETERS: InputFilename - The user-specified ASL source file to be
- * compiled
+ * PARAMETERS: None
*
* RETURN: Status
*
- * DESCRIPTION: Split the input path into a directory and filename part
- * 1) Directory part used to open include files
- * 2) Filename part used to generate output filenames
+ * DESCRIPTION: Return the number of externals that have been generated
*
******************************************************************************/
-ACPI_STATUS
-FlSplitInputPathname (
- char *InputPath,
- char **OutDirectoryPath,
- char **OutFilename)
+UINT32
+AdMethodExternalCount (
+ void)
{
- char *Substring;
- char *DirectoryPath;
- char *Filename;
-
-
- *OutDirectoryPath = NULL;
- *OutFilename = NULL;
-
- if (!InputPath)
- {
- return (AE_OK);
- }
+ ACPI_EXTERNAL_LIST *External = AcpiGbl_ExternalList;
+ UINT32 Count = 0;
- /* Get the path to the input filename's directory */
- DirectoryPath = strdup (InputPath);
- if (!DirectoryPath)
+ while (External)
{
- return (AE_NO_MEMORY);
- }
-
- Substring = strrchr (DirectoryPath, '\\');
- if (!Substring)
- {
- Substring = strrchr (DirectoryPath, '/');
- if (!Substring)
+ if (External->Type == ACPI_TYPE_METHOD)
{
- Substring = strrchr (DirectoryPath, ':');
+ Count++;
}
- }
-
- if (!Substring)
- {
- DirectoryPath[0] = 0;
- Filename = strdup (InputPath);
- }
- else
- {
- Filename = strdup (Substring + 1);
- *(Substring+1) = 0;
- }
- if (!Filename)
- {
- return (AE_NO_MEMORY);
+ External = External->Next;
}
- *OutDirectoryPath = DirectoryPath;
- *OutFilename = Filename;
-
- return (AE_OK);
+ return (Count);
}
@@ -451,8 +347,11 @@
*
* FUNCTION: AdAmlDisassemble
*
- * PARAMETERS: OutToFile - TRUE if output should go to a file
- * Filename - AML input filename
+ * PARAMETERS: Filename - AML input filename
+ * OutToFile - TRUE if output should go to a file
+ * Prefix - Path prefix for output
+ * OutFilename - where the filename is returned
+ * GetAllTables - TRUE if all tables are desired
*
* RETURN: Status
*
@@ -460,6 +359,8 @@
*
*****************************************************************************/
+extern char *Gbl_ExternalFilename;
+
ACPI_STATUS
AdAmlDisassemble (
BOOLEAN OutToFile,
@@ -472,6 +373,7 @@
char *DisasmFilename = NULL;
FILE *File = NULL;
ACPI_TABLE_HEADER *Table;
+ ACPI_TABLE_HEADER *ExternalTable;
/*
@@ -485,6 +387,15 @@
{
return Status;
}
+
+ if (Gbl_ExternalFilename)
+ {
+ Status = AcpiDbGetTableFromFile (Gbl_ExternalFilename, &ExternalTable);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+ }
}
else
{
@@ -501,11 +412,18 @@
return AE_OK;
}
- /* Obtained the local tables, just disassmeble the DSDT */
+ /* Obtained the local tables, just disassemble the DSDT */
+
+ Status = AcpiGetTable (ACPI_SIG_DSDT, 0, &Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not get DSDT, %s\n",
+ AcpiFormatException (Status));
+ return Status;
+ }
- Table = AcpiGbl_DSDT;
AcpiOsPrintf ("\nDisassembly of DSDT\n");
- Prefix = AdGenerateFilename ("dsdt", AcpiGbl_DSDT->OemTableId);
+ Prefix = AdGenerateFilename ("dsdt", Table->OemTableId);
}
/*
@@ -527,7 +445,7 @@
File = fopen (DisasmFilename, "w+");
if (!File)
{
- fprintf (stderr, "Could not open output file\n");
+ fprintf (stderr, "Could not open output file %s\n", DisasmFilename);
Status = AE_ERROR;
goto Cleanup;
}
@@ -537,50 +455,173 @@
*OutFilename = DisasmFilename;
- /* Always parse the tables, only option is what to display */
-
- Status = AdParseTable (Table);
- if (ACPI_FAILURE (Status))
+ if (!AcpiUtIsAmlTable (Table))
{
- AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
- AcpiFormatException (Status));
- goto Cleanup;
+ AdDisassemblerHeader (Filename);
+ AcpiOsPrintf (" * ACPI Data Table [%4.4s]\n *\n",
+ Table->Signature);
+ AcpiOsPrintf (" * Format: [HexOffset DecimalOffset ByteLength] FieldName : FieldValue\n */\n\n");
+
+ AcpiDmDumpDataTable (Table);
+ fprintf (stderr, "Acpi Data Table [%4.4s] decoded, written to \"%s\"\n",
+ Table->Signature, DisasmFilename);
}
+ else
+ {
+ /* Always parse the tables, only option is what to display */
- /*
- * TBD: We want to cross reference the namespace here, in order to
- * generate External() statements. The problem is that the parse
- * tree is in run-time (interpreter) format, not compiler format,
- * so we cannot directly use the function below:
- *
- * Status = LkCrossReferenceNamespace ();
- *
- * We need to either convert the parse tree or create a new
- * cross ref function that can handle interpreter parse trees
- */
+ Status = AdParseTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
- /* Optional displays */
+ if (AslCompilerdebug)
+ {
+ AcpiOsPrintf ("/**** Before second load\n");
- if (AcpiGbl_DbOpt_disasm)
- {
- AdDisplayTables (Filename, Table);
- fprintf (stderr, "Disassembly completed, written to \"%s\"\n", DisasmFilename);
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+ AcpiOsPrintf ("*****/\n");
+ }
+
+ /*
+ * Load namespace from names created within control methods
+ */
+ AcpiDmFinishNamespaceLoad (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ /*
+ * Cross reference the namespace here, in order to generate External() statements
+ */
+ AcpiDmCrossReferenceNamespace (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ if (AslCompilerdebug)
+ {
+ AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
+ }
+
+ /* Find possible calls to external control methods */
+
+ AcpiDmFindOrphanMethods (AcpiGbl_ParseOpRoot);
+
+ /* Convert fixed-offset references to resource descriptors to symbolic references */
+
+ AcpiDmConvertResourceIndexes (AcpiGbl_ParseOpRoot, AcpiGbl_RootNode);
+
+ if (AslCompilerdebug)
+ {
+ AcpiOsPrintf ("/**** After second load and resource conversion\n");
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+ AcpiOsPrintf ("*****/\n");
+ }
+
+ /*
+ * If we found any external control methods, we must reparse the entire
+ * tree with the new information (namely, the number of arguments per
+ * method)
+ */
+ if (AdMethodExternalCount ())
+ {
+ fprintf (stderr,
+ "\nFound %d external control methods, reparsing with new information\n",
+ AdMethodExternalCount());
+
+ /*
+ * Reparse, rebuild namespace. no need to xref namespace
+ */
+ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
+ AcpiNsDeleteNamespaceSubtree (AcpiGbl_RootNode);
+
+ AcpiGbl_RootNode = NULL;
+ AcpiGbl_RootNodeStruct.Name.Integer = ACPI_ROOT_NAME;
+ AcpiGbl_RootNodeStruct.DescriptorType = ACPI_DESC_TYPE_NAMED;
+ AcpiGbl_RootNodeStruct.Type = ACPI_TYPE_DEVICE;
+ AcpiGbl_RootNodeStruct.Child = NULL;
+ AcpiGbl_RootNodeStruct.Peer = NULL;
+ AcpiGbl_RootNodeStruct.Object = NULL;
+ AcpiGbl_RootNodeStruct.Flags = ANOBJ_END_OF_PEER_LIST;
+
+ Status = AcpiNsRootInitialize ();
+ AdAddExternalsToNamespace ();
+
+ Status = AdParseTable (Table);
+ if (ACPI_FAILURE (Status))
+ {
+ AcpiOsPrintf ("Could not parse ACPI tables, %s\n",
+ AcpiFormatException (Status));
+ goto Cleanup;
+ }
+
+ if (AslCompilerdebug)
+ {
+ AcpiDmDumpTree (AcpiGbl_ParseOpRoot);
+ }
+ }
+
+ /* Optional displays */
+
+ if (AcpiGbl_DbOpt_disasm)
+ {
+ AdDisplayTables (Filename, Table);
+ fprintf (stderr,
+ "Disassembly completed, written to \"%s\"\n",
+ DisasmFilename);
+ }
}
Cleanup:
- if (OutToFile)
+ if (OutToFile && File)
{
+
+#ifdef ASL_DISASM_DEBUG
+ LsSetupNsList (File);
+ LsDisplayNamespace ();
+#endif
fclose (File);
AcpiOsRedirectOutput (stdout);
}
- AcpiPsDeleteParseTree (AcpiGbl_ParsedNamespaceRoot);
+ AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot);
return Status;
}
/******************************************************************************
*
+ * FUNCTION: AdDisassemblerHeader
+ *
+ * PARAMETERS: Filename - Input file for the table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Create the disassembler header, including ACPI CA signon with
+ * current time and date.
+ *
+ *****************************************************************************/
+
+void
+AdDisassemblerHeader (
+ char *Filename)
+{
+ time_t Timer;
+
+ time (&Timer);
+
+ /* Header and input table info */
+
+ AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n");
+ AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION);
+
+ AcpiOsPrintf (" *\n * Disassembly of %s, %s", Filename, ctime (&Timer));
+ AcpiOsPrintf (" *\n");
+}
+
+
+/******************************************************************************
+ *
* FUNCTION: AdCreateTableHeader
*
* PARAMETERS: Filename - Input file for the table
@@ -598,18 +639,40 @@
char *Filename,
ACPI_TABLE_HEADER *Table)
{
- time_t Timer;
+ char *NewFilename;
- time (&Timer);
+ AdDisassemblerHeader (Filename);
- AcpiOsPrintf ("/*\n * Intel ACPI Component Architecture\n");
- AcpiOsPrintf (" * AML Disassembler version %8.8X\n", ACPI_CA_VERSION);
- AcpiOsPrintf (" *\n * Disassembly of %s, %s */\n", Filename, ctime (&Timer));
+ AcpiOsPrintf (" *\n * Original Table Header:\n");
+ AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature);
+ AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length);
+ AcpiOsPrintf (" * Revision 0x%2.2X\n", Table->Revision);
+ AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId);
+ AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId);
+ AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision);
+ AcpiOsPrintf (" * Creator ID \"%.4s\"\n", Table->AslCompilerId);
+ AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision);
+ AcpiOsPrintf (" */\n");
+
+ /* Create AML output filename based on input filename */
+
+ if (Filename)
+ {
+ NewFilename = FlGenerateFilename (Filename, "aml");
+ }
+ else
+ {
+ NewFilename = ACPI_ALLOCATE_ZEROED (9);
+ strncat (NewFilename, Table->Signature, 4);
+ strcat (NewFilename, ".aml");
+ }
+
+ /* Open the ASL definition block */
AcpiOsPrintf (
- "DefinitionBlock (\"%4.4s.aml\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", %u)\n",
- Table->Signature, Table->Signature, Table->Revision,
+ "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n",
+ NewFilename, Table->Signature, Table->Revision,
Table->OemId, Table->OemTableId, Table->OemRevision);
}
@@ -619,6 +682,7 @@
* FUNCTION: AdDisplayTables
*
* PARAMETERS: Filename - Input file for the table
+ * Table - Pointer to the raw table
*
* RETURN: Status
*
@@ -633,7 +697,7 @@
{
- if (!AcpiGbl_ParsedNamespaceRoot)
+ if (!AcpiGbl_ParseOpRoot)
{
return AE_NOT_EXIST;
}
@@ -643,7 +707,7 @@
AdCreateTableHeader (Filename, Table);
}
- AcpiDmDisassemble (NULL, AcpiGbl_ParsedNamespaceRoot, ACPI_UINT32_MAX);
+ AcpiDmDisassemble (NULL, AcpiGbl_ParseOpRoot, ACPI_UINT32_MAX);
if (AcpiGbl_DbOpt_verbose)
{
@@ -689,7 +753,7 @@
ACPI_PARSE_OBJECT *ExtraOp;
- ACPI_FUNCTION_TRACE ("AdDeferredParse");
+ ACPI_FUNCTION_TRACE (AdDeferredParse);
fprintf (stderr, ".");
@@ -709,7 +773,7 @@
}
Status = AcpiDsInitAmlWalk (WalkState, Op, NULL, Aml,
- AmlLength, NULL, 1);
+ AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -718,6 +782,7 @@
/* Parse the method */
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
/*
@@ -750,12 +815,12 @@
switch (Op->Common.AmlOpcode)
{
case AML_PACKAGE_OP:
- case AML_VAR_PACKAGE_OP:
ExtraOp = Op->Common.Value.Arg;
ExtraOp = ExtraOp->Common.Next;
Op->Common.Value.Arg = ExtraOp->Common.Value.Arg;
break;
+ case AML_VAR_PACKAGE_OP:
case AML_BUFFER_OP:
default:
ExtraOp = Op->Common.Value.Arg;
@@ -806,7 +871,7 @@
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_NAME ("AdParseDeferredOps");
+ ACPI_FUNCTION_NAME (AdParseDeferredOps);
fprintf (stderr, "Parsing Deferred Opcodes (Methods/Buffers/Packages/Regions)\n");
while (Op)
@@ -845,7 +910,7 @@
break;
default:
- ACPI_DEBUG_PRINT ((ACPI_DB_ERROR, "Unhandled deferred opcode [%s]\n",
+ ACPI_ERROR ((AE_INFO, "Unhandled deferred opcode [%s]",
Op->Common.AmlOpName));
break;
}
@@ -862,9 +927,10 @@
*
* FUNCTION: AdGetLocalTables
*
- * PARAMETERS:
+ * PARAMETERS: Filename - Not used
+ * GetAllTables - TRUE if all tables are desired
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Get the ACPI tables from either memory or a file
*
@@ -880,12 +946,12 @@
ACPI_TABLE_HEADER *NewTable;
UINT32 NumTables;
UINT32 PointerSize;
- char *FacsSuffix = "";
+ ACPI_NATIVE_UINT TableIndex;
if (GetAllTables)
{
- ACPI_STRNCPY (TableHeader.Signature, RSDT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_RSDT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (!NewTable)
{
@@ -893,14 +959,11 @@
return AE_NO_ACPI_TABLES;
}
-#if ACPI_MACHINE_WIDTH != 64
-
- if (!ACPI_STRNCMP (NewTable->Signature, RSDT_SIG, 4))
+ if (ACPI_COMPARE_NAME (NewTable->Signature, ACPI_SIG_RSDT))
{
PointerSize = sizeof (UINT32);
}
else
-#endif
{
PointerSize = sizeof (UINT64);
}
@@ -917,43 +980,31 @@
/* Get the FADT */
- ACPI_STRNCPY (TableHeader.Signature, FADT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_FADT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (NewTable)
{
- AcpiGbl_FADT = (void *) NewTable;
AdWriteTable (NewTable, NewTable->Length,
- FADT_SIG, NewTable->OemTableId);
-
- /* Use the FADT tableID for the FACS, since FACS has no ID */
-
- FacsSuffix = AcpiGbl_FADT->OemTableId;
+ ACPI_SIG_FADT, NewTable->OemTableId);
}
AcpiOsPrintf ("\n");
- /* Get the FACS */
-
- ACPI_STRNCPY (TableHeader.Signature, FACS_SIG, 4);
- AcpiOsTableOverride (&TableHeader, &NewTable);
- if (NewTable)
- {
- AcpiGbl_FACS = (void *) NewTable;
- AdWriteTable (NewTable, AcpiGbl_FACS->Length,
- FACS_SIG, FacsSuffix);
- }
- AcpiOsPrintf ("\n");
+ /* Don't bother with FACS, it is usually all zeros */
}
/* Always get the DSDT */
- ACPI_STRNCPY (TableHeader.Signature, DSDT_SIG, 4);
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_DSDT);
AcpiOsTableOverride (&TableHeader, &NewTable);
if (NewTable)
{
- Status = AE_OK;
- AcpiGbl_DSDT = NewTable;
- AdWriteTable (AcpiGbl_DSDT, AcpiGbl_DSDT->Length,
- "DSDT", AcpiGbl_DSDT->OemTableId);
+ AdWriteTable (NewTable, NewTable->Length,
+ ACPI_SIG_DSDT, NewTable->OemTableId);
+
+ /* Store DSDT in the Table Manager */
+
+ Status = AcpiTbStoreTable (0, NewTable, NewTable->Length,
+ 0, &TableIndex);
}
else
{
@@ -961,28 +1012,31 @@
return AE_NO_ACPI_TABLES;
}
+#if 0
+ /* TBD: Future implementation */
+
AcpiOsPrintf ("\n");
/* Get all SSDTs */
- ACPI_STRNCPY (TableHeader.Signature, SSDT_SIG, 4);
- Status = AcpiOsTableOverride (&TableHeader, &NewTable);
- if (NewTable)
+ ACPI_MOVE_32_TO_32 (TableHeader.Signature, ACPI_SIG_SSDT);
+ do
{
- while (NewTable)
- {
- Status = AcpiOsTableOverride (&TableHeader, &NewTable);
- }
- }
+ NewTable = NULL;
+ Status = AcpiOsTableOverride (&TableHeader, &NewTable);
+
+ } while (NewTable);
+#endif
return AE_OK;
}
+
/******************************************************************************
*
* FUNCTION: AdParseTable
*
- * PARAMETERS: None
+ * PARAMETERS: Table - Pointer to the raw table
*
* RETURN: Status
*
@@ -996,9 +1050,9 @@
{
ACPI_STATUS Status = AE_OK;
ACPI_WALK_STATE *WalkState;
- ACPI_TABLE_DESC TableDesc;
UINT8 *AmlStart;
UINT32 AmlLength;
+ ACPI_NATIVE_UINT TableIndex;
if (!Table)
@@ -1010,13 +1064,13 @@
fprintf (stderr, "Pass 1 parse of [%4.4s]\n", (char *) Table->Signature);
- AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
- AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
+ AmlLength = Table->Length - sizeof (ACPI_TABLE_HEADER);
+ AmlStart = ((UINT8 *) Table + sizeof (ACPI_TABLE_HEADER));
/* Create the root object */
- AcpiGbl_ParsedNamespaceRoot = AcpiPsCreateScopeOp ();
- if (!AcpiGbl_ParsedNamespaceRoot)
+ AcpiGbl_ParseOpRoot = AcpiPsCreateScopeOp ();
+ if (!AcpiGbl_ParseOpRoot)
{
return AE_NO_MEMORY;
}
@@ -1024,20 +1078,21 @@
/* Create and initialize a new walk state */
WalkState = AcpiDsCreateWalkState (0,
- AcpiGbl_ParsedNamespaceRoot, NULL, NULL);
+ AcpiGbl_ParseOpRoot, NULL, NULL);
if (!WalkState)
{
return (AE_NO_MEMORY);
}
- Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParsedNamespaceRoot,
- NULL, AmlStart, AmlLength, NULL, 1);
+ Status = AcpiDsInitAmlWalk (WalkState, AcpiGbl_ParseOpRoot,
+ NULL, AmlStart, AmlLength, NULL, ACPI_IMODE_LOAD_PASS1);
if (ACPI_FAILURE (Status))
{
return (Status);
}
WalkState->ParseFlags &= ~ACPI_PARSE_DELETE_TREE;
+ WalkState->ParseFlags |= ACPI_PARSE_DISASSEMBLE;
Status = AcpiPsParseAml (WalkState);
if (ACPI_FAILURE (Status))
@@ -1047,11 +1102,16 @@
/* Pass 2 */
- TableDesc.AmlStart = AmlStart;
- TableDesc.AmlLength = AmlLength;
+ Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table,
+ Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return Status;
+ }
+
fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature);
- Status = AcpiNsOneCompleteParse (2, &TableDesc);
+ Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -1059,7 +1119,11 @@
/* Pass 3: Parse control methods and link their parse trees into the main parse tree */
- Status = AdParseDeferredOps (AcpiGbl_ParsedNamespaceRoot);
+ Status = AdParseDeferredOps (AcpiGbl_ParseOpRoot);
+
+ /* Process Resource Templates */
+
+ AcpiDmFindResources (AcpiGbl_ParseOpRoot);
fprintf (stderr, "Parsing completed\n");
return AE_OK;
--- /dev/null
+++ sys/contrib/dev/acpica/common/dmtbdump.c
@@ -0,0 +1,798 @@
+/******************************************************************************
+ *
+ * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code
+ * $Revision: 1.15 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/actables.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtbdump")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpRsdp
+ *
+ * PARAMETERS: Table - A RSDP
+ *
+ * RETURN: Length of the table (there is no length field, use revision)
+ *
+ * DESCRIPTION: Format the contents of a RSDP
+ *
+ ******************************************************************************/
+
+UINT32
+AcpiDmDumpRsdp (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Length = ACPI_RSDP_REV0_SIZE;
+
+
+ /* Dump the common ACPI 1.0 portion */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp1);
+
+ /* ACPI 2.0+ contains more data and has a Length field */
+
+ if (ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Revision > 0)
+ {
+ Length = ACPI_CAST_PTR (ACPI_TABLE_RSDP, Table)->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoRsdp2);
+ }
+
+ return (Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpRsdt
+ *
+ * PARAMETERS: Table - A RSDT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a RSDT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpRsdt (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 *Array;
+ UINT32 Entries;
+ UINT32 Offset;
+ UINT32 i;
+
+
+ /* Point to start of table pointer array */
+
+ Array = ACPI_CAST_PTR (ACPI_TABLE_RSDT, Table)->TableOffsetEntry;
+ Offset = sizeof (ACPI_TABLE_HEADER);
+
+ /* RSDT uses 32-bit pointers */
+
+ Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT32);
+
+ for (i = 0; i < Entries; i++)
+ {
+ AcpiDmLineHeader2 (Offset, sizeof (UINT32), "ACPI Table Address", i);
+ AcpiOsPrintf ("%8.8X\n", Array[i]);
+ Offset += sizeof (UINT32);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpXsdt
+ *
+ * PARAMETERS: Table - A XSDT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a XSDT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpXsdt (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT64 *Array;
+ UINT32 Entries;
+ UINT32 Offset;
+ UINT32 i;
+
+
+ /* Point to start of table pointer array */
+
+ Array = ACPI_CAST_PTR (ACPI_TABLE_XSDT, Table)->TableOffsetEntry;
+ Offset = sizeof (ACPI_TABLE_HEADER);
+
+ /* XSDT uses 64-bit pointers */
+
+ Entries = (Table->Length - sizeof (ACPI_TABLE_HEADER)) / sizeof (UINT64);
+
+ for (i = 0; i < Entries; i++)
+ {
+ AcpiDmLineHeader2 (Offset, sizeof (UINT64), "ACPI Table Address", i);
+ AcpiOsPrintf ("%8.8X%8.8X\n", ACPI_FORMAT_UINT64 (Array[i]));
+ Offset += sizeof (UINT64);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpFadt
+ *
+ * PARAMETERS: Table - A FADT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a FADT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpFadt (
+ ACPI_TABLE_HEADER *Table)
+{
+
+ /* Common ACPI 1.0 portion of FADT */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt1);
+
+ /* Check for ACPI 2.0+ extended data (cannot depend on Revision field) */
+
+ if (Table->Length >= sizeof (ACPI_TABLE_FADT))
+ {
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoFadt2);
+ }
+
+ /* Validate various fields in the FADT, including length */
+
+ AcpiTbCreateLocalFadt (Table, Table->Length);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpAsf
+ *
+ * PARAMETERS: Table - A ASF table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a ASF table
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpAsf (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_HEADER);
+ ACPI_ASF_INFO *SubTable;
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_DMTABLE_INFO *DataInfoTable = NULL;
+ UINT8 *DataTable = NULL;
+ ACPI_NATIVE_UINT DataCount = 0;
+ ACPI_NATIVE_UINT DataLength = 0;
+ ACPI_NATIVE_UINT DataOffset = 0;
+ ACPI_NATIVE_UINT i;
+
+
+ /* No main table, only sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr);
+
+ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_INFO:
+ InfoTable = AcpiDmTableInfoAsf0;
+ break;
+
+ case ACPI_ASF_TYPE_ALERT:
+ InfoTable = AcpiDmTableInfoAsf1;
+ DataInfoTable = AcpiDmTableInfoAsf1a;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ALERT));
+ DataCount = ((ACPI_ASF_ALERT *) SubTable)->Alerts;
+ DataLength = ((ACPI_ASF_ALERT *) SubTable)->DataLength;
+ DataOffset = Offset + sizeof (ACPI_ASF_ALERT);
+ break;
+
+ case ACPI_ASF_TYPE_CONTROL:
+ InfoTable = AcpiDmTableInfoAsf2;
+ DataInfoTable = AcpiDmTableInfoAsf2a;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_REMOTE));
+ DataCount = ((ACPI_ASF_REMOTE *) SubTable)->Controls;
+ DataLength = ((ACPI_ASF_REMOTE *) SubTable)->DataLength;
+ DataOffset = Offset + sizeof (ACPI_ASF_REMOTE);
+ break;
+
+ case ACPI_ASF_TYPE_BOOT:
+ InfoTable = AcpiDmTableInfoAsf3;
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+ InfoTable = AcpiDmTableInfoAsf4;
+ DataTable = ACPI_ADD_PTR (UINT8, SubTable, sizeof (ACPI_ASF_ADDRESS));
+ DataLength = ((ACPI_ASF_ADDRESS *) SubTable)->Devices;
+ DataOffset = Offset + sizeof (ACPI_ASF_ADDRESS);
+ break;
+
+ default:
+ AcpiOsPrintf ("\n**** Unknown ASF sub-table type %X\n", SubTable->Header.Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable);
+
+
+ /* Dump variable-length extra data */
+
+ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */
+ {
+ case ACPI_ASF_TYPE_ALERT:
+ case ACPI_ASF_TYPE_CONTROL:
+
+ for (i = 0; i < DataCount; i++)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable);
+
+ DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength);
+ DataOffset += DataLength;
+ }
+ break;
+
+ case ACPI_ASF_TYPE_ADDRESS:
+
+ for (i = 0; i < DataLength; i++)
+ {
+ if (!(i % 16))
+ {
+ AcpiDmLineHeader (DataOffset, 1, "Addresses");
+ }
+
+ AcpiOsPrintf ("%2.2X ", *DataTable);
+ DataTable++;
+ DataOffset++;
+ }
+
+ AcpiOsPrintf ("\n");
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Header.Length;
+ SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpCpep
+ *
+ * PARAMETERS: Table - A CPEP table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a CPEP. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpCpep (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_CPEP_POLLING *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_CPEP);
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_CPEP_POLLING, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDmar
+ *
+ * PARAMETERS: Table - A DMAR table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a DMAR. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpDmar (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_DMAR_HEADER *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_DMAR);
+ ACPI_DMTABLE_INFO *InfoTable;
+ ACPI_DMAR_DEVICE_SCOPE *ScopeTable;
+ UINT32 ScopeOffset;
+ UINT8 *PciPath;
+ UINT32 PathOffset;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr);
+
+ switch (SubTable->Type)
+ {
+ case ACPI_DMAR_TYPE_HARDWARE_UNIT:
+ InfoTable = AcpiDmTableInfoDmar0;
+ ScopeOffset = sizeof (ACPI_DMAR_HARDWARE_UNIT);
+ break;
+ case ACPI_DMAR_TYPE_RESERVED_MEMORY:
+ InfoTable = AcpiDmTableInfoDmar1;
+ ScopeOffset = sizeof (ACPI_DMAR_RESERVED_MEMORY);
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown DMAR sub-table type %X\n\n", SubTable->Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /*
+ * Currently, a common flag indicates whether there are any
+ * device scope entries present at the end of the subtable.
+ */
+ if ((SubTable->Flags & ACPI_DMAR_INCLUDE_ALL) == 0)
+ {
+ /* Dump the device scope entries */
+
+ ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE, SubTable, ScopeOffset);
+ while (ScopeOffset < SubTable->Length)
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable,
+ ScopeTable->Length, AcpiDmTableInfoDmarScope);
+
+ /* Dump the PCI Path entries for this device scope */
+
+ PathOffset = sizeof (ACPI_DMAR_DEVICE_SCOPE); /* Path entries start at this offset */
+
+ PciPath = ACPI_ADD_PTR (UINT8, ScopeTable,
+ sizeof (ACPI_DMAR_DEVICE_SCOPE));
+
+ while (PathOffset < ScopeTable->Length)
+ {
+ AcpiDmLineHeader ((PathOffset + ScopeOffset + Offset), 2, "PCI Path");
+ AcpiOsPrintf ("[%2.2X, %2.2X]\n", PciPath[0], PciPath[1]);
+
+ /* Point to next PCI Path entry */
+
+ PathOffset += 2;
+ PciPath += 2;
+ }
+
+ /* Point to next device scope entry */
+
+ ScopeOffset += ScopeTable->Length;
+ ScopeTable = ACPI_ADD_PTR (ACPI_DMAR_DEVICE_SCOPE,
+ ScopeTable, ScopeTable->Length);
+ }
+ }
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_DMAR_HEADER, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMadt
+ *
+ * PARAMETERS: Table - A MADT table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a MADT. This table type consists
+ * of an open-ended number of subtables.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMadt (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_SUBTABLE_HEADER *SubTable;
+ UINT32 Length = Table->Length;
+ UINT32 Offset = sizeof (ACPI_TABLE_MADT);
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ /* Common sub-table header */
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr);
+
+ switch (SubTable->Type)
+ {
+ case ACPI_MADT_TYPE_LOCAL_APIC:
+ InfoTable = AcpiDmTableInfoMadt0;
+ break;
+ case ACPI_MADT_TYPE_IO_APIC:
+ InfoTable = AcpiDmTableInfoMadt1;
+ break;
+ case ACPI_MADT_TYPE_INTERRUPT_OVERRIDE:
+ InfoTable = AcpiDmTableInfoMadt2;
+ break;
+ case ACPI_MADT_TYPE_NMI_SOURCE:
+ InfoTable = AcpiDmTableInfoMadt3;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_APIC_NMI:
+ InfoTable = AcpiDmTableInfoMadt4;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE:
+ InfoTable = AcpiDmTableInfoMadt5;
+ break;
+ case ACPI_MADT_TYPE_IO_SAPIC:
+ InfoTable = AcpiDmTableInfoMadt6;
+ break;
+ case ACPI_MADT_TYPE_LOCAL_SAPIC:
+ InfoTable = AcpiDmTableInfoMadt7;
+ break;
+ case ACPI_MADT_TYPE_INTERRUPT_SOURCE:
+ InfoTable = AcpiDmTableInfoMadt8;
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown MADT sub-table type %X\n\n", SubTable->Type);
+ return;
+ }
+
+ AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpMcfg
+ *
+ * PARAMETERS: Table - A MCFG Table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a MCFG table
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpMcfg (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_MCFG);
+ ACPI_MCFG_ALLOCATION *SubTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoMcfg);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ if (Offset + sizeof (ACPI_MCFG_ALLOCATION) > Table->Length)
+ {
+ AcpiOsPrintf ("Warning: there are %d invalid trailing bytes\n",
+ sizeof (ACPI_MCFG_ALLOCATION) - (Offset - Table->Length));
+ return;
+ }
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoMcfg0);
+
+ /* Point to next sub-table (each subtable is of fixed length) */
+
+ Offset += sizeof (ACPI_MCFG_ALLOCATION);
+ SubTable = ACPI_ADD_PTR (ACPI_MCFG_ALLOCATION, SubTable,
+ sizeof (ACPI_MCFG_ALLOCATION));
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpSlit
+ *
+ * PARAMETERS: Table - An SLIT
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a SLIT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpSlit (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset;
+ UINT8 *Row;
+ UINT32 Localities;
+ UINT32 i;
+ UINT32 j;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSlit);
+
+ /* Display the Locality NxN Matrix */
+
+ Localities = (UINT32) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->LocalityCount;
+ Offset = ACPI_OFFSET (ACPI_TABLE_SLIT, Entry[0]);
+ Row = (UINT8 *) ACPI_CAST_PTR (ACPI_TABLE_SLIT, Table)->Entry;
+
+ for (i = 0; i < Localities; i++)
+ {
+ /* Display one row of the matrix */
+
+ AcpiDmLineHeader2 (Offset, Localities, "Locality", i);
+ for (j = 0; j < Localities; j++)
+ {
+ /* Check for beyond EOT */
+
+ if (Offset >= Table->Length)
+ {
+ AcpiOsPrintf ("\n**** Not enough room in table for all localities\n");
+ return;
+ }
+
+ AcpiOsPrintf ("%2.2X ", Row[j]);
+ Offset++;
+
+ /* Display up to 16 bytes per output row */
+
+ if (j && (((j+1) % 16) == 0) && ((j+1) < Localities))
+ {
+ AcpiOsPrintf ("\n");
+ AcpiDmLineHeader (Offset, 0, "");
+ }
+ }
+
+ /* Point to next row */
+
+ AcpiOsPrintf ("\n");
+ Row += Localities;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpSrat
+ *
+ * PARAMETERS: Table - A SRAT table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Format the contents of a SRAT
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpSrat (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT32 Offset = sizeof (ACPI_TABLE_SRAT);
+ ACPI_SUBTABLE_HEADER *SubTable;
+ ACPI_DMTABLE_INFO *InfoTable;
+
+
+ /* Main table */
+
+ AcpiDmDumpTable (Table->Length, 0, Table, 0, AcpiDmTableInfoSrat);
+
+ /* Sub-tables */
+
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, Table, Offset);
+ while (Offset < Table->Length)
+ {
+ switch (SubTable->Type)
+ {
+ case ACPI_SRAT_TYPE_CPU_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat0;
+ break;
+ case ACPI_SRAT_TYPE_MEMORY_AFFINITY:
+ InfoTable = AcpiDmTableInfoSrat1;
+ break;
+ default:
+ AcpiOsPrintf ("\n**** Unknown SRAT sub-table type %X\n", SubTable->Type);
+ return;
+ }
+
+ AcpiOsPrintf ("\n");
+ AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Length, InfoTable);
+
+ /* Point to next sub-table */
+
+ Offset += SubTable->Length;
+ SubTable = ACPI_ADD_PTR (ACPI_SUBTABLE_HEADER, SubTable, SubTable->Length);
+ }
+}
+
--- /dev/null
+++ sys/contrib/dev/acpica/common/dmtable.c
@@ -0,0 +1,734 @@
+/******************************************************************************
+ *
+ * Module Name: dmtable - Support for ACPI tables that contain no AML code
+ * $Revision: 1.12 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/actables.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmtable")
+
+/* Local Prototypes */
+
+static ACPI_DMTABLE_DATA *
+AcpiDmGetTableData (
+ char *Signature);
+
+static void
+AcpiDmCheckAscii (
+ UINT8 *Target,
+ UINT32 Count);
+
+
+/* These tables map a subtable type to a description string */
+
+static const char *AcpiDmDmarSubnames[] =
+{
+ "Hardware Unit Definition",
+ "Reserved Memory Region",
+ "Unknown SubTable Type" /* Reserved */
+};
+
+static const char *AcpiDmMadtSubnames[] =
+{
+ "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */
+ "I/O APIC", /* ACPI_MADT_TYPE_IO_APIC */
+ "Interrupt Source Override", /* ACPI_MADT_TYPE_INTERRUPT_OVERRIDE */
+ "NMI Source", /* ACPI_MADT_TYPE_NMI_SOURCE */
+ "Local APIC NMI", /* ACPI_MADT_TYPE_LOCAL_APIC_NMI */
+ "Local APIC Address Override", /* ACPI_MADT_TYPE_LOCAL_APIC_OVERRIDE */
+ "I/O SAPIC", /* ACPI_MADT_TYPE_IO_SAPIC */
+ "Local SAPIC", /* ACPI_MADT_TYPE_LOCAL_SAPIC */
+ "Platform Interrupt Sources", /* ACPI_MADT_TYPE_INTERRUPT_SOURCE */
+ "Unknown SubTable Type" /* Reserved */
+};
+
+static const char *AcpiDmSratSubnames[] =
+{
+ "Processor Local APIC/SAPIC Affinity",
+ "Memory Affinity",
+ "Unknown SubTable Type" /* Reserved */
+};
+
+
+/*******************************************************************************
+ *
+ * ACPI Table Data, indexed by signature.
+ *
+ * Simple tables have only a TableInfo structure, complex tables have a handler.
+ * This table must be NULL terminated. RSDP and FACS are special-cased
+ * elsewhere.
+ *
+ ******************************************************************************/
+
+static ACPI_DMTABLE_DATA AcpiDmTableData[] =
+{
+ {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"},
+ {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"},
+ {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"},
+ {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"},
+ {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"},
+ {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"},
+ {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"},
+ {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"},
+ {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"},
+ {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"},
+ {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"},
+ {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"},
+ {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"},
+ {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"},
+ {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"},
+ {ACPI_SIG_SRAT, NULL, AcpiDmDumpSrat, "System Resource Affinity Table"},
+ {ACPI_SIG_TCPA, AcpiDmTableInfoTcpa, NULL, "Trusted Computing Platform Alliance table"},
+ {ACPI_SIG_WDRT, AcpiDmTableInfoWdrt, NULL, "Watchdog Resource Table"},
+ {ACPI_SIG_XSDT, NULL, AcpiDmDumpXsdt, "Extended System Description Table"},
+ {NULL, NULL, NULL, NULL}
+};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiTbGenerateChecksum
+ *
+ * PARAMETERS: Table - Pointer to a valid ACPI table (with a
+ * standard ACPI header)
+ *
+ * RETURN: 8 bit checksum of buffer
+ *
+ * DESCRIPTION: Computes an 8 bit checksum of the table.
+ *
+ ******************************************************************************/
+
+UINT8
+AcpiTbGenerateChecksum (
+ ACPI_TABLE_HEADER *Table)
+{
+ UINT8 Checksum;
+
+
+ /* Sum the entire table as-is */
+
+ Checksum = AcpiTbChecksum ((UINT8 *) Table, Table->Length);
+
+ /* Subtract off the existing checksum value in the table */
+
+ Checksum = (UINT8) (Checksum - Table->Checksum);
+
+ /* Compute the final checksum */
+
+ Checksum = (UINT8) (0 - Checksum);
+ return (Checksum);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetTableData
+ *
+ * PARAMETERS: Signature - ACPI signature (4 chars) to match
+ *
+ * RETURN: Pointer to a valid ACPI_DMTABLE_DATA. Null if no match found.
+ *
+ * DESCRIPTION: Find a match in the global table of supported ACPI tables
+ *
+ ******************************************************************************/
+
+static ACPI_DMTABLE_DATA *
+AcpiDmGetTableData (
+ char *Signature)
+{
+ ACPI_DMTABLE_DATA *TableData;
+
+
+ for (TableData = AcpiDmTableData; TableData->Signature; TableData++)
+ {
+ if (ACPI_COMPARE_NAME (Signature, TableData->Signature))
+ {
+ return (TableData);
+ }
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDataTable
+ *
+ * PARAMETERS: Table - An ACPI table
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Format the contents of an ACPI data table (any table other
+ * than an SSDT or DSDT that does not contain executable AML code)
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpDataTable (
+ ACPI_TABLE_HEADER *Table)
+{
+ ACPI_DMTABLE_DATA *TableData;
+ UINT32 Length;
+
+
+ /* Ignore tables that contain AML */
+
+ if (AcpiUtIsAmlTable (Table))
+ {
+ return;
+ }
+
+ /*
+ * Handle tables that don't use the common ACPI table header structure.
+ * Currently, these are the FACS and RSDP.
+ */
+ if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_FACS))
+ {
+ Length = Table->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoFacs);
+ }
+ else if (ACPI_COMPARE_NAME (Table->Signature, ACPI_SIG_RSDP))
+ {
+ Length = AcpiDmDumpRsdp (Table);
+ }
+ else
+ {
+ /*
+ * All other tables must use the common ACPI table header, dump it now
+ */
+ Length = Table->Length;
+ AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader);
+ AcpiOsPrintf ("\n");
+
+ /* Match signature and dispatch appropriately */
+
+ TableData = AcpiDmGetTableData (Table->Signature);
+ if (!TableData)
+ {
+ if (!ACPI_STRNCMP (Table->Signature, "OEM", 3))
+ {
+ AcpiOsPrintf ("\n**** OEM-defined ACPI table [%4.4s], unknown contents\n\n",
+ Table->Signature);
+ }
+ else
+ {
+ AcpiOsPrintf ("\n**** Unknown ACPI table type [%4.4s]\n\n",
+ Table->Signature);
+ }
+ }
+ else if (TableData->TableHandler)
+ {
+ /* Complex table, has a handler */
+
+ TableData->TableHandler (Table);
+ }
+ else if (TableData->TableInfo)
+ {
+ /* Simple table, just walk the info table */
+
+ AcpiDmDumpTable (Length, 0, Table, 0, TableData->TableInfo);
+ }
+ }
+
+ /* Always dump the raw table data */
+
+ AcpiOsPrintf ("\nRaw Table Data\n\n");
+ AcpiUtDumpBuffer2 (ACPI_CAST_PTR (UINT8, Table), Length, DB_BYTE_DISPLAY);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmLineHeader
+ *
+ * PARAMETERS: Offset - Current byte offset, from table start
+ * ByteLength - Length of the field in bytes, 0 for flags
+ * Name - Name of this field
+ * Value - Optional value, displayed on left of ':'
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Utility routines for formatting output lines. Displays the
+ * current table offset in hex and decimal, the field length,
+ * and the field name.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmLineHeader (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name)
+{
+
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %28s : ",
+ Offset, Offset, ByteLength, Name);
+ }
+ else
+ {
+ AcpiOsPrintf ("%42s : ",
+ Name);
+ }
+}
+
+void
+AcpiDmLineHeader2 (
+ UINT32 Offset,
+ UINT32 ByteLength,
+ char *Name,
+ UINT32 Value)
+{
+
+ if (ByteLength)
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d% 3d] %24s % 3d : ",
+ Offset, Offset, ByteLength, Name, Value);
+ }
+ else
+ {
+ AcpiOsPrintf ("[%3.3Xh %3.3d ] %24s % 3d : ",
+ Offset, Offset, Name, Value);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpTable
+ *
+ * PARAMETERS: TableLength - Length of the entire ACPI table
+ * TableOffset - Starting offset within the table for this
+ * sub-descriptor (0 if main table)
+ * Table - The ACPI table
+ * SubtableLength - Lenghth of this sub-descriptor
+ * Info - Info table for this ACPI table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Display ACPI table contents by walking the Info table.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpTable (
+ UINT32 TableLength,
+ UINT32 TableOffset,
+ void *Table,
+ UINT32 SubtableLength,
+ ACPI_DMTABLE_INFO *Info)
+{
+ UINT8 *Target;
+ UINT32 CurrentOffset;
+ UINT32 ByteLength;
+ UINT8 Temp8;
+ UINT16 Temp16;
+ ACPI_DMTABLE_DATA *TableData;
+
+
+ if (!Info)
+ {
+ AcpiOsPrintf ("Display not implemented\n");
+ return;
+ }
+
+ /* Walk entire Info table; Null name terminates */
+
+ for (; Info->Name; Info++)
+ {
+ /*
+ * Target points to the field within the ACPI Table. CurrentOffset is
+ * the offset of the field from the start of the main table.
+ */
+ Target = ACPI_ADD_PTR (UINT8, Table, Info->Offset);
+ CurrentOffset = TableOffset + Info->Offset;
+
+ /* Check for beyond EOT or beyond subtable end */
+
+ if ((CurrentOffset >= TableLength) ||
+ (SubtableLength && (Info->Offset >= SubtableLength)))
+ {
+ return;
+ }
+
+ /* Generate the byte length for this field */
+
+ switch (Info->Opcode)
+ {
+ case ACPI_DMT_UINT8:
+ case ACPI_DMT_CHKSUM:
+ case ACPI_DMT_SPACEID:
+ case ACPI_DMT_MADT:
+ case ACPI_DMT_SRAT:
+ ByteLength = 1;
+ break;
+ case ACPI_DMT_UINT16:
+ case ACPI_DMT_DMAR:
+ ByteLength = 2;
+ break;
+ case ACPI_DMT_UINT24:
+ ByteLength = 3;
+ break;
+ case ACPI_DMT_UINT32:
+ case ACPI_DMT_NAME4:
+ case ACPI_DMT_SIG:
+ ByteLength = 4;
+ break;
+ case ACPI_DMT_NAME6:
+ ByteLength = 6;
+ break;
+ case ACPI_DMT_UINT56:
+ ByteLength = 7;
+ break;
+ case ACPI_DMT_UINT64:
+ case ACPI_DMT_NAME8:
+ ByteLength = 8;
+ break;
+ case ACPI_DMT_STRING:
+ ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1;
+ break;
+ case ACPI_DMT_GAS:
+ AcpiOsPrintf ("\n");
+ ByteLength = sizeof (ACPI_GENERIC_ADDRESS);
+ break;
+ default:
+ ByteLength = 0;
+ break;
+ }
+
+ /* Start a new line and decode the opcode */
+
+ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name);
+
+ switch (Info->Opcode)
+ {
+ /* Single-bit Flag fields. Note: Opcode is the bit position */
+
+ case ACPI_DMT_FLAG0:
+ case ACPI_DMT_FLAG1:
+ case ACPI_DMT_FLAG2:
+ case ACPI_DMT_FLAG3:
+ case ACPI_DMT_FLAG4:
+ case ACPI_DMT_FLAG5:
+ case ACPI_DMT_FLAG6:
+ case ACPI_DMT_FLAG7:
+
+ AcpiOsPrintf ("%1.1X\n", (*Target >> Info->Opcode) & 0x01);
+ break;
+
+ /* 2-bit Flag fields */
+
+ case ACPI_DMT_FLAGS0:
+
+ AcpiOsPrintf ("%1.1X\n", *Target & 0x03);
+ break;
+
+ case ACPI_DMT_FLAGS2:
+
+ AcpiOsPrintf ("%1.1X\n", (*Target >> 2) & 0x03);
+ break;
+
+ /* Standard Data Types */
+
+ case ACPI_DMT_UINT8:
+
+ AcpiOsPrintf ("%2.2X\n", *Target);
+ break;
+
+ case ACPI_DMT_UINT16:
+
+ AcpiOsPrintf ("%4.4X\n", ACPI_GET16 (Target));
+ break;
+
+ case ACPI_DMT_UINT24:
+
+ AcpiOsPrintf ("%2.2X%2.2X%2.2X\n",
+ *Target, *(Target + 1), *(Target + 2));
+ break;
+
+ case ACPI_DMT_UINT32:
+
+ AcpiOsPrintf ("%8.8X\n", ACPI_GET32 (Target));
+ break;
+
+ case ACPI_DMT_UINT56:
+
+ AcpiOsPrintf ("%6.6X%8.8X\n",
+ ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF,
+ ACPI_LODWORD (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_DMT_UINT64:
+
+ AcpiOsPrintf ("%8.8X%8.8X\n",
+ ACPI_FORMAT_UINT64 (ACPI_GET64 (Target)));
+ break;
+
+ case ACPI_DMT_STRING:
+
+ AcpiOsPrintf ("%s\n", ACPI_CAST_PTR (char, Target));
+ break;
+
+ /* Fixed length ASCII name fields */
+
+ case ACPI_DMT_SIG:
+
+ AcpiDmCheckAscii (Target, 4);
+ AcpiOsPrintf ("\"%4.4s\" ", Target);
+ TableData = AcpiDmGetTableData (ACPI_CAST_PTR (char, Target));
+ if (TableData)
+ {
+ AcpiOsPrintf ("/* %s */", TableData->Name);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_DMT_NAME4:
+
+ AcpiDmCheckAscii (Target, 4);
+ AcpiOsPrintf ("\"%4.4s\"\n", Target);
+ break;
+
+ case ACPI_DMT_NAME6:
+
+ AcpiDmCheckAscii (Target, 6);
+ AcpiOsPrintf ("\"%6.6s\"\n", Target);
+ break;
+
+ case ACPI_DMT_NAME8:
+
+ AcpiDmCheckAscii (Target, 8);
+ AcpiOsPrintf ("\"%8.8s\"\n", Target);
+ break;
+
+ /* Special Data Types */
+
+ case ACPI_DMT_CHKSUM:
+
+ /* Checksum, display and validate */
+
+ AcpiOsPrintf ("%2.2X", *Target);
+ Temp8 = AcpiTbGenerateChecksum (Table);
+ if (Temp8 != ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Checksum)
+ {
+ AcpiOsPrintf (
+ " /* Incorrect checksum, should be %2.2X */", Temp8);
+ }
+ AcpiOsPrintf ("\n");
+ break;
+
+ case ACPI_DMT_SPACEID:
+
+ /* Address Space ID */
+
+ AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiUtGetRegionName (*Target));
+ break;
+
+ case ACPI_DMT_GAS:
+
+ /* Generic Address Structure */
+
+ AcpiOsPrintf ("<Generic Address Structure>\n");
+ AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length,
+ CurrentOffset, Target, 0, AcpiDmTableInfoGas);
+ break;
+
+ case ACPI_DMT_DMAR:
+
+ /* DMAR subtable types */
+
+ Temp16 = *Target;
+ if (Temp16 > ACPI_DMAR_TYPE_RESERVED)
+ {
+ Temp16 = ACPI_DMAR_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]);
+ break;
+
+ case ACPI_DMT_MADT:
+
+ /* MADT subtable types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_MADT_TYPE_RESERVED)
+ {
+ Temp8 = ACPI_MADT_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmMadtSubnames[Temp8]);
+ break;
+
+ case ACPI_DMT_SRAT:
+
+ /* SRAT subtable types */
+
+ Temp8 = *Target;
+ if (Temp8 > ACPI_SRAT_TYPE_RESERVED)
+ {
+ Temp8 = ACPI_SRAT_TYPE_RESERVED;
+ }
+
+ AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmSratSubnames[Temp8]);
+ break;
+
+ case ACPI_DMT_EXIT:
+ return;
+
+ default:
+ ACPI_ERROR ((AE_INFO,
+ "**** Invalid table opcode [%X] ****\n", Info->Opcode));
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCheckAscii
+ *
+ * PARAMETERS: Name - Ascii string
+ * Count - Number of characters to check
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Ensure that the requested number of characters are printable
+ * Ascii characters. Sets non-printable and null chars to <space>.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmCheckAscii (
+ UINT8 *Name,
+ UINT32 Count)
+{
+ UINT32 i;
+
+
+ for (i = 0; i < Count; i++)
+ {
+ if (!Name[i] || !isprint (Name[i]))
+ {
+ Name[i] = ' ';
+ }
+ }
+}
--- /dev/null
+++ sys/contrib/dev/acpica/common/adfile.c
@@ -0,0 +1,398 @@
+/******************************************************************************
+ *
+ * Module Name: adfile - Application-level disassembler file support routines
+ * $Revision: 1.3 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acapps.h>
+
+#include <stdio.h>
+#include <string.h>
+
+
+#define _COMPONENT ACPI_TOOLS
+ ACPI_MODULE_NAME ("adfile")
+
+
+char FilenameBuf[20];
+
+/******************************************************************************
+ *
+ * FUNCTION: AfGenerateFilename
+ *
+ * PARAMETERS: Prefix - prefix string
+ * TableId - The table ID
+ *
+ * RETURN: Pointer to the completed string
+ *
+ * DESCRIPTION: Build an output filename from an ACPI table ID string
+ *
+ ******************************************************************************/
+
+char *
+AdGenerateFilename (
+ char *Prefix,
+ char *TableId)
+{
+ ACPI_NATIVE_UINT i;
+ ACPI_NATIVE_UINT j;
+
+
+ for (i = 0; Prefix[i]; i++)
+ {
+ FilenameBuf[i] = Prefix[i];
+ }
+
+ FilenameBuf[i] = '_';
+ i++;
+
+ for (j = 0; j < 8 && (TableId[j] != ' ') && (TableId[j] != 0); i++, j++)
+ {
+ FilenameBuf[i] = TableId[j];
+ }
+
+ FilenameBuf[i] = 0;
+ strcat (FilenameBuf, ACPI_TABLE_FILE_SUFFIX);
+ return FilenameBuf;
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteBuffer
+ *
+ * PARAMETERS: Filename - name of file
+ * Buffer - data to write
+ * Length - length of data
+ *
+ * RETURN: Actual number of bytes written
+ *
+ * DESCRIPTION: Open a file and write out a single buffer
+ *
+ ******************************************************************************/
+
+ACPI_NATIVE_INT
+AdWriteBuffer (
+ char *Filename,
+ char *Buffer,
+ UINT32 Length)
+{
+ FILE *fp;
+ ACPI_SIZE Actual;
+
+
+ fp = fopen (Filename, "wb");
+ if (!fp)
+ {
+ printf ("Couldn't open %s\n", Filename);
+ return (-1);
+ }
+
+ Actual = fwrite (Buffer, (size_t) Length, 1, fp);
+ fclose (fp);
+ return ((ACPI_NATIVE_INT) Actual);
+}
+
+
+/******************************************************************************
+ *
+ * FUNCTION: AfWriteTable
+ *
+ * PARAMETERS: Table - pointer to the ACPI table
+ * Length - length of the table
+ * TableName - the table signature
+ * OemTableID - from the table header
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Dump the loaded tables to a file (or files)
+ *
+ ******************************************************************************/
+
+void
+AdWriteTable (
+ ACPI_TABLE_HEADER *Table,
+ UINT32 Length,
+ char *TableName,
+ char *OemTableId)
+{
+ char *Filename;
+
+
+ Filename = AdGenerateFilename (TableName, OemTableId);
+ AdWriteBuffer (Filename, (char *) Table, Length);
+
+ AcpiOsPrintf ("Table [%s] written to \"%s\"\n", TableName, Filename);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlGenerateFilename
+ *
+ * PARAMETERS: InputFilename - Original ASL source filename
+ * Suffix - New extension.
+ *
+ * RETURN: New filename containing the original base + the new suffix
+ *
+ * DESCRIPTION: Generate a new filename from the ASL source filename and a new
+ * extension. Used to create the *.LST, *.TXT, etc. files.
+ *
+ ******************************************************************************/
+
+char *
+FlGenerateFilename (
+ char *InputFilename,
+ char *Suffix)
+{
+ char *Position;
+ char *NewFilename;
+
+
+ /*
+ * Copy the original filename to a new buffer. Leave room for the worst case
+ * where we append the suffix, an added dot and the null terminator.
+ */
+ NewFilename = ACPI_ALLOCATE_ZEROED (
+ strlen (InputFilename) + strlen (Suffix) + 2);
+ strcpy (NewFilename, InputFilename);
+
+ /* Try to find the last dot in the filename */
+
+ Position = strrchr (NewFilename, '.');
+ if (Position)
+ {
+ /* Tack on the new suffix */
+
+ Position++;
+ *Position = 0;
+ strcat (Position, Suffix);
+ }
+ else
+ {
+ /* No dot, add one and then the suffix */
+
+ strcat (NewFilename, ".");
+ strcat (NewFilename, Suffix);
+ }
+
+ return NewFilename;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlStrdup
+ *
+ * DESCRIPTION: Local strdup function
+ *
+ ******************************************************************************/
+
+static char *
+FlStrdup (
+ char *String)
+{
+ char *NewString;
+
+
+ NewString = ACPI_ALLOCATE (strlen (String) + 1);
+ if (!NewString)
+ {
+ return (NULL);
+ }
+
+ strcpy (NewString, String);
+ return (NewString);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: FlSplitInputPathname
+ *
+ * PARAMETERS: InputFilename - The user-specified ASL source file to be
+ * compiled
+ * OutDirectoryPath - Where the directory path prefix is
+ * returned
+ * OutFilename - Where the filename part is returned
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Split the input path into a directory and filename part
+ * 1) Directory part used to open include files
+ * 2) Filename part used to generate output filenames
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlSplitInputPathname (
+ char *InputPath,
+ char **OutDirectoryPath,
+ char **OutFilename)
+{
+ char *Substring;
+ char *DirectoryPath;
+ char *Filename;
+
+
+ *OutDirectoryPath = NULL;
+ *OutFilename = NULL;
+
+ if (!InputPath)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the path to the input filename's directory */
+
+ DirectoryPath = FlStrdup (InputPath);
+ if (!DirectoryPath)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Substring = strrchr (DirectoryPath, '\\');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, '/');
+ if (!Substring)
+ {
+ Substring = strrchr (DirectoryPath, ':');
+ }
+ }
+
+ if (!Substring)
+ {
+ DirectoryPath[0] = 0;
+ Filename = FlStrdup (InputPath);
+ }
+ else
+ {
+ Filename = FlStrdup (Substring + 1);
+ *(Substring+1) = 0;
+ }
+
+ if (!Filename)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ *OutDirectoryPath = DirectoryPath;
+ *OutFilename = Filename;
+
+ return (AE_OK);
+}
+
+
--- /dev/null
+++ sys/contrib/dev/acpica/common/dmrestag.c
@@ -0,0 +1,990 @@
+/******************************************************************************
+ *
+ * Module Name: dmrestag - Add tags to resource descriptors (Application-level)
+ * $Revision: 1.11 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/amlcode.h>
+
+/* This module used for application-level code only */
+
+#define _COMPONENT ACPI_CA_DISASSEMBLER
+ ACPI_MODULE_NAME ("dmrestag")
+
+/* Local prototypes */
+
+static void
+AcpiDmUpdateResourceName (
+ ACPI_NAMESPACE_NODE *ResourceNode);
+
+static char *
+AcpiDmSearchTagList (
+ UINT32 BitIndex,
+ ACPI_RESOURCE_TAG *TagList);
+
+static char *
+AcpiDmGetResourceTag (
+ UINT32 BitIndex,
+ AML_RESOURCE *Resource,
+ UINT8 ResourceIndex);
+
+static char *
+AcpiGetTagPathname (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_NAMESPACE_NODE *ResourceNode,
+ UINT32 BitIndex);
+
+static ACPI_NAMESPACE_NODE *
+AcpiDmGetResourceNode (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ UINT32 BitIndex);
+
+static ACPI_STATUS
+AcpiDmAddResourceToNamespace (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context);
+
+static void
+AcpiDmAddResourcesToNamespace (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_PARSE_OBJECT *Op);
+
+
+/******************************************************************************
+ *
+ * Resource Tag tables
+ *
+ * These are the predefined tags that refer to elements of a resource
+ * descriptor. Each name and offset is defined in the ACPI specification.
+ *
+ * Each table entry contains the bit offset of the field and the associated
+ * name.
+ *
+ ******************************************************************************/
+
+static ACPI_RESOURCE_TAG AcpiDmIrqTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_INTERRUPT},
+ {( 3 * 8) + 0, ACPI_RESTAG_INTERRUPTTYPE},
+ {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTLEVEL},
+ {( 3 * 8) + 4, ACPI_RESTAG_INTERRUPTSHARE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmDmaTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_DMA},
+ {( 2 * 8) + 0, ACPI_RESTAG_XFERTYPE},
+ {( 2 * 8) + 2, ACPI_RESTAG_BUSMASTER},
+ {( 2 * 8) + 5, ACPI_RESTAG_DMATYPE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmIoTags[] =
+{
+ {( 1 * 8) + 0, ACPI_RESTAG_DECODE},
+ {( 2 * 8), ACPI_RESTAG_MINADDR},
+ {( 4 * 8), ACPI_RESTAG_MAXADDR},
+ {( 6 * 8), ACPI_RESTAG_ALIGNMENT},
+ {( 7 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmFixedIoTags[] =
+{
+ {( 1 * 8), ACPI_RESTAG_BASEADDRESS},
+ {( 3 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmMemory24Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_MINADDR},
+ {( 6 * 8), ACPI_RESTAG_MAXADDR},
+ {( 8 * 8), ACPI_RESTAG_ALIGNMENT},
+ {(10 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmRegisterTags[] =
+{
+ {( 3 * 8), ACPI_RESTAG_ADDRESSSPACE},
+ {( 4 * 8), ACPI_RESTAG_REGISTERBITWIDTH},
+ {( 5 * 8), ACPI_RESTAG_REGISTERBITOFFSET},
+ {( 6 * 8), ACPI_RESTAG_ACCESSSIZE},
+ {( 7 * 8), ACPI_RESTAG_ADDRESS},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmMemory32Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_MINADDR},
+ {( 8 * 8), ACPI_RESTAG_MAXADDR},
+ {(12 * 8), ACPI_RESTAG_ALIGNMENT},
+ {(16 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmFixedMemory32Tags[] =
+{
+ {( 3 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 4 * 8), ACPI_RESTAG_BASEADDRESS},
+ {( 8 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmInterruptTags[] =
+{
+ {( 3 * 8) + 1, ACPI_RESTAG_INTERRUPTTYPE},
+ {( 3 * 8) + 2, ACPI_RESTAG_INTERRUPTLEVEL},
+ {( 3 * 8) + 3, ACPI_RESTAG_INTERRUPTSHARE},
+ {( 5 * 8), ACPI_RESTAG_INTERRUPT},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress16Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {( 8 * 8), ACPI_RESTAG_MINADDR},
+ {(10 * 8), ACPI_RESTAG_MAXADDR},
+ {(12 * 8), ACPI_RESTAG_TRANSLATION},
+ {(14 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress32Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {(10 * 8), ACPI_RESTAG_MINADDR},
+ {(14 * 8), ACPI_RESTAG_MAXADDR},
+ {(18 * 8), ACPI_RESTAG_TRANSLATION},
+ {(22 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmAddress64Tags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 6 * 8), ACPI_RESTAG_GRANULARITY},
+ {(14 * 8), ACPI_RESTAG_MINADDR},
+ {(22 * 8), ACPI_RESTAG_MAXADDR},
+ {(30 * 8), ACPI_RESTAG_TRANSLATION},
+ {(38 * 8), ACPI_RESTAG_LENGTH},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmExtendedAddressTags[] =
+{
+ {( 4 * 8) + 1, ACPI_RESTAG_DECODE},
+ {( 4 * 8) + 2, ACPI_RESTAG_MINTYPE},
+ {( 4 * 8) + 3, ACPI_RESTAG_MAXTYPE},
+ {( 8 * 8), ACPI_RESTAG_GRANULARITY},
+ {(16 * 8), ACPI_RESTAG_MINADDR},
+ {(24 * 8), ACPI_RESTAG_MAXADDR},
+ {(32 * 8), ACPI_RESTAG_TRANSLATION},
+ {(40 * 8), ACPI_RESTAG_LENGTH},
+ {(48 * 8), ACPI_RESTAG_TYPESPECIFICATTRIBUTES},
+ {0, NULL}
+};
+
+/* Special-case tables for the type-specific flags */
+
+static ACPI_RESOURCE_TAG AcpiDmMemoryFlagTags[] =
+{
+ {( 5 * 8) + 0, ACPI_RESTAG_READWRITETYPE},
+ {( 5 * 8) + 1, ACPI_RESTAG_MEMTYPE},
+ {( 5 * 8) + 3, ACPI_RESTAG_MEMATTRIBUTES},
+ {( 5 * 8) + 5, ACPI_RESTAG_TYPE},
+ {0, NULL}
+};
+
+static ACPI_RESOURCE_TAG AcpiDmIoFlagTags[] =
+{
+ {( 5 * 8) + 0, ACPI_RESTAG_RANGETYPE},
+ {( 5 * 8) + 4, ACPI_RESTAG_TYPE},
+ {( 5 * 8) + 5, ACPI_RESTAG_TRANSTYPE},
+ {0, NULL}
+};
+
+
+/* Dispatch table used to obtain the correct tag table for a descriptor */
+
+static ACPI_RESOURCE_TAG *AcpiGbl_ResourceTags [] =
+{
+ /* Small descriptors */
+
+ NULL, /* 0x00, Reserved */
+ NULL, /* 0x01, Reserved */
+ NULL, /* 0x02, Reserved */
+ NULL, /* 0x03, Reserved */
+ AcpiDmIrqTags, /* 0x04, ACPI_RESOURCE_NAME_IRQ_FORMAT */
+ AcpiDmDmaTags, /* 0x05, ACPI_RESOURCE_NAME_DMA_FORMAT */
+ NULL, /* 0x06, ACPI_RESOURCE_NAME_START_DEPENDENT */
+ NULL, /* 0x07, ACPI_RESOURCE_NAME_END_DEPENDENT */
+ AcpiDmIoTags, /* 0x08, ACPI_RESOURCE_NAME_IO_PORT */
+ AcpiDmFixedIoTags, /* 0x09, ACPI_RESOURCE_NAME_FIXED_IO_PORT */
+ NULL, /* 0x0A, Reserved */
+ NULL, /* 0x0B, Reserved */
+ NULL, /* 0x0C, Reserved */
+ NULL, /* 0x0D, Reserved */
+ NULL, /* 0x0E, ACPI_RESOURCE_NAME_SMALL_VENDOR */
+ NULL, /* 0x0F, ACPI_RESOURCE_NAME_END_TAG (not used) */
+
+ /* Large descriptors */
+
+ NULL, /* 0x00, Reserved */
+ AcpiDmMemory24Tags, /* 0x01, ACPI_RESOURCE_NAME_MEMORY_24 */
+ AcpiDmRegisterTags, /* 0x02, ACPI_RESOURCE_NAME_GENERIC_REGISTER */
+ NULL, /* 0x03, Reserved */
+ NULL, /* 0x04, ACPI_RESOURCE_NAME_LARGE_VENDOR */
+ AcpiDmMemory32Tags, /* 0x05, ACPI_RESOURCE_NAME_MEMORY_32 */
+ AcpiDmFixedMemory32Tags, /* 0x06, ACPI_RESOURCE_NAME_FIXED_MEMORY_32 */
+ AcpiDmAddress32Tags, /* 0x07, ACPI_RESOURCE_NAME_DWORD_ADDRESS_SPACE */
+ AcpiDmAddress16Tags, /* 0x08, ACPI_RESOURCE_NAME_WORD_ADDRESS_SPACE */
+ AcpiDmInterruptTags, /* 0x09, ACPI_RESOURCE_NAME_EXTENDED_XRUPT */
+ AcpiDmAddress64Tags, /* 0x0A, ACPI_RESOURCE_NAME_QWORD_ADDRESS_SPACE */
+ AcpiDmExtendedAddressTags /* 0x0B, ACPI_RESOURCE_NAME_EXTENDED_ADDRESS_SPACE */
+};
+
+
+/*
+ * Globals used to generate unique resource descriptor names. We use names that
+ * start with underscore and a prefix letter that is not used by other ACPI
+ * reserved names. To this, we append hex 0x00 through 0xFF. These 5 prefixes
+ * allow for 5*256 = 1280 unique names, probably sufficient for any single ASL
+ * file. If this becomes too small, we can use alpha+numerals for a total
+ * of 5*36*36 = 6480.
+ */
+#define ACPI_NUM_RES_PREFIX 5
+
+static UINT32 AcpiGbl_NextResourceId = 0;
+static UINT8 AcpiGbl_NextPrefix = 0;
+static UINT8 AcpiGbl_Prefix[ACPI_NUM_RES_PREFIX] =
+ {'Y','Z','J','K','X'};
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCheckResourceReference
+ *
+ * PARAMETERS: Op - Parse Op for the AML opcode
+ * WalkState - Current walk state (with valid scope)
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert a reference to a resource descriptor to a symbolic
+ * reference if possible
+ *
+ * NOTE: Bit index is used to transparently handle both resource bit
+ * fields and byte fields.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmCheckResourceReference (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState)
+{
+ ACPI_STATUS Status;
+ ACPI_PARSE_OBJECT *BufferNameOp;
+ ACPI_PARSE_OBJECT *IndexOp;
+ ACPI_NAMESPACE_NODE *BufferNode;
+ ACPI_NAMESPACE_NODE *ResourceNode;
+ const ACPI_OPCODE_INFO *OpInfo;
+ char *Pathname;
+ UINT32 BitIndex;
+
+
+ /* We are only interested in the CreateXxxxField opcodes */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ if (OpInfo->Type != AML_TYPE_CREATE_FIELD)
+ {
+ return;
+ }
+
+ /* Get the buffer term operand */
+
+ BufferNameOp = AcpiPsGetDepthNext (NULL, Op);
+
+ /* Must be a named buffer, not an arg or local or method call */
+
+ if (BufferNameOp->Common.AmlOpcode != AML_INT_NAMEPATH_OP)
+ {
+ return;
+ }
+
+ /* Get the Index term, must be an integer constant to convert */
+
+ IndexOp = BufferNameOp->Common.Next;
+ OpInfo = AcpiPsGetOpcodeInfo (IndexOp->Common.AmlOpcode);
+ if (OpInfo->ObjectType != ACPI_TYPE_INTEGER)
+ {
+ return;
+ }
+
+ /* Get the bit offset of the descriptor within the buffer */
+
+ if ((Op->Common.AmlOpcode == AML_CREATE_BIT_FIELD_OP) ||
+ (Op->Common.AmlOpcode == AML_CREATE_FIELD_OP))
+ {
+ /* Index operand is a bit offset */
+
+ BitIndex = (UINT32) IndexOp->Common.Value.Integer;
+ }
+ else
+ {
+ /* Index operand is a byte offset, convert to bits */
+
+ BitIndex = (UINT32) ACPI_MUL_8 (IndexOp->Common.Value.Integer);
+ }
+
+ /* Lookup the buffer in the namespace */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ BufferNameOp->Common.Value.String, ACPI_TYPE_BUFFER,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState,
+ &BufferNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ /* Validate object type, we must have a buffer */
+
+ if (BufferNode->Type != ACPI_TYPE_BUFFER)
+ {
+ return;
+ }
+
+ /* Find the resource descriptor node corresponding to the index */
+
+ ResourceNode = AcpiDmGetResourceNode (BufferNode, BitIndex);
+ if (!ResourceNode)
+ {
+ return;
+ }
+
+ /* Translate the Index to a resource tag pathname */
+
+ Pathname = AcpiGetTagPathname (BufferNode, ResourceNode, BitIndex);
+ if (Pathname)
+ {
+ /* Complete the conversion of the Index to a symbol */
+
+ IndexOp->Common.AmlOpcode = AML_INT_NAMEPATH_OP;
+ IndexOp->Common.Value.String = Pathname;
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetResourceNode
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * BitIndex - Index into the resource descriptor
+ *
+ * RETURN: Namespace node for the resource descriptor. NULL if not found
+ *
+ * DESCRIPTION: Find a resource descriptor that corresponds to the bit index
+ *
+ ******************************************************************************/
+
+static ACPI_NAMESPACE_NODE *
+AcpiDmGetResourceNode (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ UINT32 BitIndex)
+{
+ ACPI_NAMESPACE_NODE *Node;
+ UINT32 ByteIndex = ACPI_DIV_8 (BitIndex);
+
+
+ /*
+ * Child list contains an entry for each resource descriptor. Find
+ * the descriptor that corresponds to the Index.
+ *
+ * If there are no children, this is not a resource template
+ */
+ Node = BufferNode->Child;
+ while (Node)
+ {
+ /*
+ * Check if the Index falls within this resource.
+ *
+ * Value contains the resource offset, Object contains the resource
+ * length (both in bytes)
+ */
+ if ((ByteIndex >= Node->Value) &&
+ (ByteIndex < (Node->Value + Node->Length)))
+ {
+ return (Node);
+ }
+
+ /* List is circular, this flag marks the end */
+
+ if (Node->Flags & ANOBJ_END_OF_PEER_LIST)
+ {
+ return (NULL);
+ }
+
+ Node = Node->Peer;
+ }
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiGetTagPathname
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * ResourceNode - Node for a resource descriptor
+ * BitIndex - Index into the resource descriptor
+ *
+ * RETURN: Full pathname for a resource tag. NULL if no match.
+ * Path is returned in AML (packed) format.
+ *
+ * DESCRIPTION: Convert a BitIndex into a symbolic resource tag (full pathname)
+ *
+ ******************************************************************************/
+
+static char *
+AcpiGetTagPathname (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_NAMESPACE_NODE *ResourceNode,
+ UINT32 BitIndex)
+{
+ ACPI_STATUS Status;
+ UINT32 ResourceBitIndex;
+ UINT8 ResourceTableIndex;
+ ACPI_SIZE RequiredSize;
+ char *Pathname;
+ AML_RESOURCE *Aml;
+ ACPI_PARSE_OBJECT *Op;
+ char *InternalPath;
+ char *Tag;
+
+
+ /* Get the Op that contains the actual buffer data */
+
+ Op = BufferNode->Op->Common.Value.Arg;
+ Op = Op->Common.Next;
+ if (!Op)
+ {
+ return (NULL);
+ }
+
+ /* Get the individual resource descriptor and validate it */
+
+ Aml = ACPI_CAST_PTR (AML_RESOURCE,
+ &Op->Named.Data[ResourceNode->Value]);
+
+ Status = AcpiUtValidateResource (Aml, &ResourceTableIndex);
+ if (ACPI_FAILURE (Status))
+ {
+ return (NULL);
+ }
+
+ /* Get offset into this descriptor (from offset into entire buffer) */
+
+ ResourceBitIndex = BitIndex - ACPI_MUL_8 (ResourceNode->Value);
+
+ /* Get the tag associated with this resource descriptor and offset */
+
+ Tag = AcpiDmGetResourceTag (ResourceBitIndex, Aml, ResourceTableIndex);
+ if (!Tag)
+ {
+ return (NULL);
+ }
+
+ /*
+ * Now that we know that we have a reference that can be converted to a
+ * symbol, change the name of the resource to a unique name.
+ */
+ AcpiDmUpdateResourceName (ResourceNode);
+
+ /* Get the full pathname to the parent buffer */
+
+ RequiredSize = AcpiNsGetPathnameLength (BufferNode);
+ Pathname = ACPI_ALLOCATE_ZEROED (RequiredSize + ACPI_PATH_SEGMENT_LENGTH);
+ if (!Pathname)
+ {
+ return (NULL);
+ }
+
+ AcpiNsBuildExternalPath (BufferNode, RequiredSize, Pathname);
+
+ /*
+ * Create the full path to the resource and tag by: remove the buffer name,
+ * append the resource descriptor name, append a dot, append the tag name.
+ *
+ * TBD: Always using the full path is a bit brute force, the path can be
+ * often be optimized with carats (if the original buffer namepath is a
+ * single nameseg). This doesn't really matter, because these paths do not
+ * end up in the final compiled AML, it's just an appearance issue for the
+ * disassembled code.
+ */
+ Pathname[ACPI_STRLEN (Pathname) - ACPI_NAME_SIZE] = 0;
+ ACPI_STRNCAT (Pathname, ResourceNode->Name.Ascii, ACPI_NAME_SIZE);
+ ACPI_STRCAT (Pathname, ".");
+ ACPI_STRNCAT (Pathname, Tag, ACPI_NAME_SIZE);
+
+ /* Internalize the namepath to AML format */
+
+ AcpiNsInternalizeName (Pathname, &InternalPath);
+ ACPI_FREE (Pathname);
+ return (InternalPath);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmUpdateResourceName
+ *
+ * PARAMETERS: ResourceNode - Node for a resource descriptor
+ *
+ * RETURN: Stores new name in the ResourceNode
+ *
+ * DESCRIPTION: Create a new, unique name for a resource descriptor. Used by
+ * both the disassembly of the descriptor itself and any symbolic
+ * references to the descriptor. Ignored if a unique name has
+ * already been assigned to the resource.
+ *
+ * NOTE: Single threaded, suitable for applications only!
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmUpdateResourceName (
+ ACPI_NAMESPACE_NODE *ResourceNode)
+{
+ char Name[ACPI_NAME_SIZE];
+
+
+ /* Ignore if a unique name has already been assigned */
+
+ if (ResourceNode->Name.Integer != ACPI_DEFAULT_RESNAME)
+ {
+ return;
+ }
+
+ /* Generate a new ACPI name for the descriptor */
+
+ Name[0] = '_';
+ Name[1] = AcpiGbl_Prefix[AcpiGbl_NextPrefix];
+ Name[2] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 4);
+ Name[3] = AcpiUtHexToAsciiChar (AcpiGbl_NextResourceId, 0);
+
+ /* Update globals for next name */
+
+ AcpiGbl_NextResourceId++;
+ if (AcpiGbl_NextResourceId >= 256)
+ {
+ AcpiGbl_NextResourceId = 0;
+ AcpiGbl_NextPrefix++;
+ if (AcpiGbl_NextPrefix > ACPI_NUM_RES_PREFIX)
+ {
+ AcpiGbl_NextPrefix = 0;
+ }
+ }
+
+ /* Change the resource descriptor name */
+
+ ResourceNode->Name.Integer = *(UINT32 *) Name;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmGetResourceTag
+ *
+ * PARAMETERS: BitIndex - Index into the resource descriptor
+ * Resource - Pointer to the raw resource data
+ * ResourceIndex - Index correspoinding to the resource type
+ *
+ * RETURN: Pointer to the resource tag (ACPI_NAME). NULL if no match.
+ *
+ * DESCRIPTION: Convert a BitIndex into a symbolic resource tag.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiDmGetResourceTag (
+ UINT32 BitIndex,
+ AML_RESOURCE *Resource,
+ UINT8 ResourceIndex)
+{
+ ACPI_RESOURCE_TAG *TagList;
+ char *Tag = NULL;
+
+
+ /* Get the tag list for this resource descriptor type */
+
+ TagList = AcpiGbl_ResourceTags[ResourceIndex];
+ if (!TagList)
+ {
+ /* There are no tags for this resource type */
+
+ return (NULL);
+ }
+
+ /*
+ * Handle the type-specific flags field for the address descriptors.
+ * Kindof brute force, but just blindly search for an index match.
+ */
+ switch (Resource->DescriptorType)
+ {
+ case ACPI_RESOURCE_NAME_ADDRESS16:
+ case ACPI_RESOURCE_NAME_ADDRESS32:
+ case ACPI_RESOURCE_NAME_ADDRESS64:
+ case ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64:
+
+ if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_MEMORY_RANGE)
+ {
+ Tag = AcpiDmSearchTagList (BitIndex, AcpiDmMemoryFlagTags);
+ }
+ else if (Resource->Address.ResourceType == ACPI_ADDRESS_TYPE_IO_RANGE)
+ {
+ Tag = AcpiDmSearchTagList (BitIndex, AcpiDmIoFlagTags);
+ }
+
+ /* If we found a match, all done. Else, drop to normal search below */
+
+ if (Tag)
+ {
+ return (Tag);
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ /* Search the tag list for this descriptor type */
+
+ Tag = AcpiDmSearchTagList (BitIndex, TagList);
+ return (Tag);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmSearchTagList
+ *
+ * PARAMETERS: BitIndex - Index into the resource descriptor
+ * TagList - List to search
+ *
+ * RETURN: Pointer to a tag (ACPI_NAME). NULL if no match found.
+ *
+ * DESCRIPTION: Search a tag list for a match to the input BitIndex. Matches
+ * a fixed offset to a symbolic resource tag name.
+ *
+ ******************************************************************************/
+
+static char *
+AcpiDmSearchTagList (
+ UINT32 BitIndex,
+ ACPI_RESOURCE_TAG *TagList)
+{
+
+ /*
+ * Walk the null-terminated tag list to find a matching bit offset.
+ * We are looking for an exact match.
+ */
+ for ( ; TagList->Tag; TagList++)
+ {
+ if (BitIndex == TagList->BitIndex)
+ {
+ return (TagList->Tag);
+ }
+ }
+
+ /* A matching offset was not found */
+
+ return (NULL);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindResources
+ *
+ * PARAMETERS: Root - Root of the parse tree
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add all ResourceTemplate declarations to the namespace. Each
+ * resource descriptor in each template is given a node -- used
+ * for later conversion of resource references to symbolic refs.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFindResources (
+ ACPI_PARSE_OBJECT *Root)
+{
+ ACPI_PARSE_OBJECT *Op = Root;
+ ACPI_PARSE_OBJECT *Parent;
+
+
+ /* Walk the entire parse tree */
+
+ while (Op)
+ {
+ /* We are interested in Buffer() declarations */
+
+ if (Op->Common.AmlOpcode == AML_BUFFER_OP)
+ {
+ /* And only declarations of the form Name (XXXX, Buffer()... ) */
+
+ Parent = Op->Common.Parent;
+ if (Parent->Common.AmlOpcode == AML_NAME_OP)
+ {
+ /*
+ * If the buffer is a resource template, add the individual
+ * resource descriptors to the namespace, as children of the
+ * buffer node.
+ */
+ if (ACPI_SUCCESS (AcpiDmIsResourceTemplate (Op)))
+ {
+ Op->Common.DisasmOpcode = ACPI_DASM_RESOURCE;
+ AcpiDmAddResourcesToNamespace (Parent->Common.Node, Op);
+ }
+ }
+ }
+
+ Op = AcpiPsGetDepthNext (Root, Op);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddResourcesToNamespace
+ *
+ * PARAMETERS: BufferNode - Node for the parent buffer
+ * Op - Parse op for the buffer
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Add an entire resource template to the namespace. Each
+ * resource descriptor is added as a namespace node.
+ *
+ ******************************************************************************/
+
+static void
+AcpiDmAddResourcesToNamespace (
+ ACPI_NAMESPACE_NODE *BufferNode,
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *NextOp;
+
+
+ /* Get to the ByteData list */
+
+ NextOp = Op->Common.Value.Arg;
+ NextOp = NextOp->Common.Next;
+ if (!NextOp)
+ {
+ return;
+ }
+
+ /* Set Node and Op to point to each other */
+
+ BufferNode->Op = Op;
+ Op->Common.Node = BufferNode;
+
+ /*
+ * Insert each resource into the namespace
+ * NextOp contains the Aml pointer and the Aml length
+ */
+ AcpiUtWalkAmlResources ((UINT8 *) NextOp->Named.Data,
+ (ACPI_SIZE) NextOp->Common.Value.Integer,
+ AcpiDmAddResourceToNamespace, BufferNode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmAddResourceToNamespace
+ *
+ * PARAMETERS: ACPI_WALK_AML_CALLBACK
+ * BufferNode - Node for the parent buffer
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Add one resource descriptor to the namespace as a child of the
+ * parent buffer. The same name is used for each descriptor. This
+ * is changed later to a unique name if the resource is actually
+ * referenced by an AML operator.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmAddResourceToNamespace (
+ UINT8 *Aml,
+ UINT32 Length,
+ UINT32 Offset,
+ UINT8 ResourceIndex,
+ void *Context)
+{
+ ACPI_STATUS Status;
+ ACPI_GENERIC_STATE ScopeInfo;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ /* TBD: Don't need to add descriptors that have no tags defined? */
+
+ /* Add the resource to the namespace, as child of the buffer */
+
+ ScopeInfo.Scope.Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, Context);
+ Status = AcpiNsLookup (&ScopeInfo, "_TMP", ACPI_TYPE_LOCAL_RESOURCE,
+ ACPI_IMODE_LOAD_PASS2,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_PREFIX_IS_SCOPE,
+ NULL, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ return (AE_OK);
+ }
+
+ /* Set the name to the default, changed later if resource is referenced */
+
+ Node->Name.Integer = ACPI_DEFAULT_RESNAME;
+
+ /* Save the offset of the descriptor (within the original buffer) */
+
+ Node->Value = Offset;
+ Node->Length = Length;
+ return (AE_OK);
+}
+
Index: getopt.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/common/getopt.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/common/getopt.c -L sys/contrib/dev/acpica/common/getopt.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/common/getopt.c
+++ sys/contrib/dev/acpica/common/getopt.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: getopt
- * $Revision: 7 $
+ * $Revision: 1.10 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
--- /dev/null
+++ sys/contrib/dev/acpica/common/adwalk.c
@@ -0,0 +1,1001 @@
+/******************************************************************************
+ *
+ * Module Name: adwalk - Application-level disassembler parse tree walk routines
+ * $Revision: 1.6 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acdebug.h>
+#include <contrib/dev/acpica/acdisasm.h>
+#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acapps.h>
+
+
+#define _COMPONENT ACPI_TOOLS
+ ACPI_MODULE_NAME ("adwalk")
+
+/*
+ * aslmap - opcode mappings and reserved method names
+ */
+ACPI_OBJECT_TYPE
+AslMapNamedOpcodeToDataType (
+ UINT16 Opcode);
+
+/* Local prototypes */
+
+static ACPI_STATUS
+AcpiDmFindOrphanDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmDumpDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmXrefDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmCommonAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+AcpiDmLoadDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static UINT32
+AcpiDmInspectPossibleArgs (
+ UINT32 CurrentOpArgCount,
+ UINT32 TargetCount,
+ ACPI_PARSE_OBJECT *Op);
+
+static ACPI_STATUS
+AcpiDmResourceDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpTree
+ *
+ * PARAMETERS: Origin - Starting object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse tree walk to format and output the nodes
+ *
+ ******************************************************************************/
+
+void
+AcpiDmDumpTree (
+ ACPI_PARSE_OBJECT *Origin)
+{
+ ACPI_OP_WALK_INFO Info;
+
+
+ if (!Origin)
+ {
+ return;
+ }
+
+ AcpiOsPrintf ("/*\nAML Parse Tree\n\n");
+ Info.Flags = 0;
+ Info.Count = 0;
+ Info.Level = 0;
+ Info.WalkState = NULL;
+ AcpiDmWalkParseTree (Origin, AcpiDmDumpDescending, NULL, &Info);
+ AcpiOsPrintf ("*/\n\n");
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindOrphanMethods
+ *
+ * PARAMETERS: Origin - Starting object
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Parse tree walk to find "orphaned" method invocations -- methods
+ * that are not resolved in the namespace
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFindOrphanMethods (
+ ACPI_PARSE_OBJECT *Origin)
+{
+ ACPI_OP_WALK_INFO Info;
+
+
+ if (!Origin)
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = NULL;
+ AcpiDmWalkParseTree (Origin, AcpiDmFindOrphanDescending, NULL, &Info);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFinishNamespaceLoad
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Load all namespace items that are created within control
+ * methods. Used before namespace cross reference
+ *
+ ******************************************************************************/
+
+void
+AcpiDmFinishNamespaceLoad (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmLoadDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCrossReferenceNamespace
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Cross reference the namespace to create externals
+ *
+ ******************************************************************************/
+
+void
+AcpiDmCrossReferenceNamespace (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmXrefDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmConvertResourceIndexes
+ *
+ * PARAMETERS: ParseTreeRoot - Root of the parse tree
+ * NamespaceRoot - Root of the internal namespace
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Convert fixed-offset references to resource descriptors to
+ * symbolic references. Should only be called after namespace has
+ * been cross referenced.
+ *
+ ******************************************************************************/
+
+void
+AcpiDmConvertResourceIndexes (
+ ACPI_PARSE_OBJECT *ParseTreeRoot,
+ ACPI_NAMESPACE_NODE *NamespaceRoot)
+{
+ ACPI_STATUS Status;
+ ACPI_OP_WALK_INFO Info;
+ ACPI_WALK_STATE *WalkState;
+
+
+ if (!ParseTreeRoot)
+ {
+ return;
+ }
+
+ /* Create and initialize a new walk state */
+
+ WalkState = AcpiDsCreateWalkState (0, ParseTreeRoot, NULL, NULL);
+ if (!WalkState)
+ {
+ return;
+ }
+
+ Status = AcpiDsScopeStackPush (NamespaceRoot, NamespaceRoot->Type, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ Info.Flags = 0;
+ Info.Level = 0;
+ Info.WalkState = WalkState;
+ AcpiDmWalkParseTree (ParseTreeRoot, AcpiDmResourceDescendingOp,
+ AcpiDmCommonAscendingOp, &Info);
+ ACPI_FREE (WalkState);
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmDumpDescending
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Format and print contents of one parse Op.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmDumpDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ char *Path;
+
+
+ if (!Op)
+ {
+ return (AE_OK);
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ Info->Count++;
+
+ /* Most of the information (count, level, name) here */
+
+ AcpiOsPrintf ("% 5d [%2.2d] ", Info->Count, Level);
+ AcpiDmIndent (Level);
+ AcpiOsPrintf ("%-28s", AcpiPsGetOpcodeName (Op->Common.AmlOpcode));
+
+ /* Extra info is helpful */
+
+ switch (Op->Common.AmlOpcode)
+ {
+ case AML_BYTE_OP:
+ case AML_WORD_OP:
+ case AML_DWORD_OP:
+ AcpiOsPrintf ("%X", (UINT32) Op->Common.Value.Integer);
+ break;
+
+ case AML_INT_NAMEPATH_OP:
+ if (Op->Common.Value.String)
+ {
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, Op->Common.Value.String,
+ NULL, &Path);
+ AcpiOsPrintf ("%s %p", Path, Op->Common.Node);
+ ACPI_FREE (Path);
+ }
+ else
+ {
+ AcpiOsPrintf ("[NULL]");
+ }
+ break;
+
+ case AML_NAME_OP:
+ case AML_METHOD_OP:
+ case AML_DEVICE_OP:
+ case AML_INT_NAMEDFIELD_OP:
+ AcpiOsPrintf ("%4.4s", &Op->Named.Name);
+ break;
+ }
+
+ AcpiOsPrintf ("\n");
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmFindOrphanDescending
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check namepath Ops for orphaned method invocations
+ *
+ * Note: Experimental.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmFindOrphanDescending (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_PARSE_OBJECT *ChildOp;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_PARSE_OBJECT *ParentOp;
+ UINT32 ArgCount;
+
+
+ if (!Op)
+ {
+ return (AE_OK);
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ switch (Op->Common.AmlOpcode)
+ {
+#ifdef ACPI_UNDER_DEVELOPMENT
+ case AML_ADD_OP:
+ ChildOp = Op->Common.Value.Arg;
+ if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !ChildOp->Common.Node)
+ {
+ AcpiNsExternalizeName (ACPI_UINT32_MAX, ChildOp->Common.Value.String,
+ NULL, &Path);
+ AcpiOsPrintf ("/* %-16s A-NAMEPATH: %s */\n", Op->Common.AmlOpName, Path);
+ ACPI_FREE (Path);
+
+ NextOp = Op->Common.Next;
+ if (!NextOp)
+ {
+ /* This NamePath has no args, assume it is an integer */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ ArgCount = AcpiDmInspectPossibleArgs (3, 1, NextOp);
+ AcpiOsPrintf ("/* A-CHILDREN: %d Actual %d */\n", ArgCount, AcpiDmCountChildren (Op));
+
+ if (ArgCount < 1)
+ {
+ /* One Arg means this is just a Store(Name,Target) */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+ }
+ break;
+#endif
+
+ case AML_STORE_OP:
+
+ ChildOp = Op->Common.Value.Arg;
+ if ((ChildOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP) &&
+ !ChildOp->Common.Node)
+ {
+ NextOp = Op->Common.Next;
+ if (!NextOp)
+ {
+ /* This NamePath has no args, assume it is an integer */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ ArgCount = AcpiDmInspectPossibleArgs (2, 1, NextOp);
+ if (ArgCount <= 1)
+ {
+ /* One Arg means this is just a Store(Name,Target) */
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ return (AE_OK);
+ }
+
+ AcpiDmAddToExternalList (ChildOp->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+ }
+ break;
+
+ case AML_INT_NAMEPATH_OP:
+
+ /* Must examine parent to see if this namepath is an argument */
+
+ ParentOp = Op->Common.Parent;
+ OpInfo = AcpiPsGetOpcodeInfo (ParentOp->Common.AmlOpcode);
+
+ if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
+ (OpInfo->Class != AML_CLASS_CREATE) &&
+ (ParentOp->Common.AmlOpcode != AML_INT_METHODCALL_OP) &&
+ !Op->Common.Node)
+ {
+ ArgCount = AcpiDmInspectPossibleArgs (0, 0, Op->Common.Next);
+
+ /*
+ * Check if namepath is a predicate for if/while or lone parameter to
+ * a return.
+ */
+ if (ArgCount == 0)
+ {
+ if (((ParentOp->Common.AmlOpcode == AML_IF_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_WHILE_OP) ||
+ (ParentOp->Common.AmlOpcode == AML_RETURN_OP)) &&
+
+ /* And namepath is the first argument */
+ (ParentOp->Common.Value.Arg == Op))
+ {
+ AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_INTEGER, 0);
+ break;
+ }
+ }
+
+ /*
+ * This is a standalone namestring (not a parameter to another
+ * operator) - it *must* be a method invocation, nothing else is
+ * grammatically possible.
+ */
+ AcpiDmAddToExternalList (Op->Common.Value.String, ACPI_TYPE_METHOD, ArgCount);
+
+ }
+ break;
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmLoadDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending handler for namespace control method object load
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmLoadDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+ char *Path = NULL;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ /* Only interested in operators that create new names */
+
+ if (!(OpInfo->Flags & AML_NAMED) &&
+ !(OpInfo->Flags & AML_CREATE))
+ {
+ goto Exit;
+ }
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ /* For all named operators, get the new name */
+
+ Path = (char *) Op->Named.Path;
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* New name is the last child */
+
+ NextOp = Op->Common.Value.Arg;
+
+ while (NextOp->Common.Next)
+ {
+ NextOp = NextOp->Common.Next;
+ }
+ Path = NextOp->Common.Value.String;
+ }
+
+ if (!Path)
+ {
+ goto Exit;
+ }
+
+ /* Insert the name into the namespace */
+
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_LOAD_PASS2, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+
+ Op->Common.Node = Node;
+
+
+Exit:
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmXrefDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Descending handler for namespace cross reference
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmXrefDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+ char *Path = NULL;
+ ACPI_PARSE_OBJECT *NextOp;
+ ACPI_NAMESPACE_NODE *Node;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ if ((!(OpInfo->Flags & AML_NAMED)) &&
+ (!(OpInfo->Flags & AML_CREATE)) &&
+ (Op->Common.AmlOpcode != AML_INT_NAMEPATH_OP))
+ {
+ goto Exit;
+ }
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ if ((Op->Common.AmlOpcode == AML_ALIAS_OP) ||
+ (Op->Common.AmlOpcode == AML_SCOPE_OP))
+ {
+ /*
+ * Only these two operators refer to an existing name,
+ * first argument
+ */
+ Path = (char *) Op->Named.Path;
+ }
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* Referenced Buffer Name is the first child */
+
+ NextOp = Op->Common.Value.Arg;
+ if (NextOp->Common.AmlOpcode == AML_INT_NAMEPATH_OP)
+ {
+ Path = NextOp->Common.Value.String;
+ }
+ }
+ else
+ {
+ Path = Op->Common.Value.String;
+ }
+
+ if (!Path)
+ {
+ goto Exit;
+ }
+
+ /*
+ * Lookup the name in the namespace. Name must exist at this point, or it
+ * is an invalid reference.
+ *
+ * The namespace is also used as a lookup table for references to resource
+ * descriptors and the fields within them.
+ */
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT | ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_NOT_FOUND)
+ {
+ AcpiDmAddToExternalList (Path, (UINT8) ObjectType, 0);
+
+ /*
+ * We could install this into the namespace, but we catch duplicate
+ * externals when they are added to the list.
+ */
+#if 0
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
+ ACPI_IMODE_LOAD_PASS1, ACPI_NS_DONT_OPEN_SCOPE,
+ WalkState, &Node);
+#endif
+ }
+ }
+ else
+ {
+ Op->Common.Node = Node;
+ }
+
+
+Exit:
+ /* Open new scope if necessary */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmResourceDescendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Process one parse op during symbolic resource index conversion.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmResourceDescendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_WALK_STATE *WalkState;
+ ACPI_OBJECT_TYPE ObjectType;
+ ACPI_STATUS Status;
+
+
+ WalkState = Info->WalkState;
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /* Open new scope if necessary */
+
+ ObjectType = OpInfo->ObjectType;
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ if (Op->Common.Node)
+ {
+
+ Status = AcpiDsScopeStackPush (Op->Common.Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return (Status);
+ }
+ }
+ }
+
+ /*
+ * Check if this operator contains a reference to a resource descriptor.
+ * If so, convert the reference into a symbolic reference.
+ */
+ AcpiDmCheckResourceReference (Op, WalkState);
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmCommonAscendingOp
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Ascending handler for combined parse/namespace walks. Closes
+ * scope if necessary.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+AcpiDmCommonAscendingOp (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+ ACPI_OP_WALK_INFO *Info = Context;
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_OBJECT_TYPE ObjectType;
+
+
+ /* Close scope if necessary */
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+ ObjectType = OpInfo->ObjectType;
+ ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ (void) AcpiDsScopeStackPop (Info->WalkState);
+ }
+
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiDmInspectPossibleArgs
+ *
+ * PARAMETERS: CurrentOpArgCount - Which arg of the current op was the
+ * possible method invocation found
+ * TargetCount - Number of targets (0,1,2) for this op
+ * Op - Parse op
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Examine following args and next ops for possible arguments
+ * for an unrecognized method invocation.
+ *
+ ******************************************************************************/
+
+static UINT32
+AcpiDmInspectPossibleArgs (
+ UINT32 CurrentOpArgCount,
+ UINT32 TargetCount,
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ UINT32 i;
+ UINT32 Last = 0;
+ UINT32 Lookahead;
+
+
+ Lookahead = (ACPI_METHOD_NUM_ARGS + TargetCount) - CurrentOpArgCount;
+
+ /* Lookahead for the maximum number of possible arguments */
+
+ for (i = 0; i < Lookahead; i++)
+ {
+ if (!Op)
+ {
+ break;
+ }
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Common.AmlOpcode);
+
+ /*
+ * Any one of these operators is "very probably" not a method arg
+ */
+ if ((Op->Common.AmlOpcode == AML_STORE_OP) ||
+ (Op->Common.AmlOpcode == AML_NOTIFY_OP))
+ {
+ break;
+ }
+
+ if ((OpInfo->Class != AML_CLASS_EXECUTE) &&
+ (OpInfo->Class != AML_CLASS_CONTROL))
+ {
+ Last = i+1;
+ }
+
+ Op = Op->Common.Next;
+ }
+
+ return (Last);
+}
+
+
Index: aslfold.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslfold.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslfold.c -L sys/contrib/dev/acpica/compiler/aslfold.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslfold.c
+++ sys/contrib/dev/acpica/compiler/aslfold.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslfold - Constant folding
- * $Revision: 9 $
+ * $Revision: 1.20 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,16 +116,36 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/amlcode.h>
-#include "acdispat.h"
-#include "acparser.h"
+#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/acparser.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslfold")
+/* Local prototypes */
+
+static ACPI_STATUS
+OpcAmlEvaluationWalk1 (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+OpcAmlEvaluationWalk2 (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+OpcAmlCheckForConstant (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
/*******************************************************************************
*
@@ -139,7 +159,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OpcAmlEvaluationWalk1 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -186,7 +206,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OpcAmlEvaluationWalk2 (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -232,7 +252,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OpcAmlCheckForConstant (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -254,11 +274,13 @@
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
- DbgPrint (ASL_PARSE_OUTPUT, "**** Valid Target, cannot reduce ****\n");
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "**** Valid Target, cannot reduce ****\n");
}
else
{
- DbgPrint (ASL_PARSE_OUTPUT, "**** Not a Type 3/4/5 opcode ****\n");
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "**** Not a Type 3/4/5 opcode ****\n");
}
if (WalkState->WalkType == ACPI_WALK_CONST_OPTIONAL)
@@ -276,11 +298,13 @@
*/
if (Op->Asl.CompileFlags & NODE_IS_TARGET)
{
- AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op, Op->Asl.ParseOpName);
+ AslError (ASL_ERROR, ASL_MSG_INVALID_TARGET, Op,
+ Op->Asl.ParseOpName);
}
else
{
- AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op, Op->Asl.ParseOpName);
+ AslError (ASL_ERROR, ASL_MSG_INVALID_CONSTANT_OP, Op,
+ Op->Asl.ParseOpName);
}
return (AE_TYPE);
@@ -340,9 +364,8 @@
return (AE_OK);
}
- /*
- * Set the walk type based on the reduction used for this op
- */
+ /* Set the walk type based on the reduction used for this op */
+
if (Op->Asl.CompileFlags & NODE_IS_TERM_ARG)
{
/* Op is a TermArg, constant folding is merely optional */
@@ -374,8 +397,10 @@
WalkState->CallerReturnDesc = &ObjDesc;
WalkState->WalkType = WalkType;
- /* Examine the entire subtree -- all nodes must be constants or type 3/4/5 opcodes */
-
+ /*
+ * Examine the entire subtree -- all nodes must be constants
+ * or type 3/4/5 opcodes
+ */
Status = TrWalkParseTree (Op, ASL_WALK_VISIT_DOWNWARD,
OpcAmlCheckForConstant, NULL, WalkState);
@@ -414,10 +439,10 @@
OriginalParentOp = Op->Common.Parent;
Op->Common.Parent = RootOp;
- /*
- * Hand off the subtree to the AML interpreter
- */
- Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE, OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
+ /* Hand off the subtree to the AML interpreter */
+
+ Status = TrWalkParseTree (Op, ASL_WALK_VISIT_TWICE,
+ OpcAmlEvaluationWalk1, OpcAmlEvaluationWalk2, WalkState);
Op->Common.Parent = OriginalParentOp;
/* TBD: we really *should* release the RootOp node */
@@ -436,7 +461,10 @@
{
/* We could not resolve the subtree for some reason */
- AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op, Op->Asl.ParseOpName);
+ AslCoreSubsystemError (Op, Status,
+ "Failure during constant evaluation", FALSE);
+ AslError (ASL_ERROR, ASL_MSG_CONSTANT_EVALUATION, Op,
+ Op->Asl.ParseOpName);
/* Set the subtree value to ZERO anyway. Eliminates further errors */
@@ -446,7 +474,8 @@
}
else
{
- AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op, Op->Asl.ParseOpName);
+ AslError (ASL_OPTIMIZATION, ASL_MSG_CONSTANT_FOLDED, Op,
+ Op->Asl.ParseOpName);
/*
* Because we know we executed type 3/4/5 opcodes above, we know that
@@ -460,7 +489,8 @@
Op->Common.Value.Integer = ObjDesc->Integer.Value;
OpcSetOptimalIntegerSize (Op);
- DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (INTEGER) %8.8X%8.8X\n",
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "Constant expression reduced to (INTEGER) %8.8X%8.8X\n",
ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
break;
@@ -472,7 +502,8 @@
Op->Asl.AmlLength = ACPI_STRLEN (ObjDesc->String.Pointer) + 1;
Op->Common.Value.String = ObjDesc->String.Pointer;
- DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (STRING) %s\n",
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "Constant expression reduced to (STRING) %s\n",
Op->Common.Value.String);
break;
@@ -482,6 +513,7 @@
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
+ Op->Asl.CompileFlags = NODE_AML_PACKAGE;
UtSetParseOpName (Op);
/* Child node is the buffer length */
@@ -509,7 +541,8 @@
Op->Asl.Next = RootOp;
Op = RootOp;
- DbgPrint (ASL_PARSE_OUTPUT, "Constant expression reduced to (BUFFER) length %X\n",
+ DbgPrint (ASL_PARSE_OUTPUT,
+ "Constant expression reduced to (BUFFER) length %X\n",
ObjDesc->Buffer.Length);
break;
Index: aslanalyze.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslanalyze.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslanalyze.c -L sys/contrib/dev/acpica/compiler/aslanalyze.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslanalyze.c
+++ sys/contrib/dev/acpica/compiler/aslanalyze.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslanalyze.c - check for semantic errors
- * $Revision: 84 $
+ * $Revision: 1.115 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,16 +116,123 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "acparser.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/amlcode.h>
#include <ctype.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslanalyze")
+/* Local prototypes */
+
+static UINT32
+AnMapArgTypeToBtype (
+ UINT32 ArgType);
+
+static UINT32
+AnMapEtypeToBtype (
+ UINT32 Etype);
+
+static void
+AnFormatBtype (
+ char *Buffer,
+ UINT32 Btype);
+
+static UINT32
+AnGetBtype (
+ ACPI_PARSE_OBJECT *Op);
+
+static UINT32
+AnCheckForReservedName (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name);
+
+static void
+AnCheckForReservedMethod (
+ ACPI_PARSE_OBJECT *Op,
+ ASL_METHOD_INFO *MethodInfo);
+
+static UINT32
+AnMapObjTypeToBtype (
+ ACPI_PARSE_OBJECT *Op);
+
+static BOOLEAN
+AnLastStatementIsReturn (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+AnCheckMethodReturnValue (
+ ACPI_PARSE_OBJECT *Op,
+ const ACPI_OPCODE_INFO *OpInfo,
+ ACPI_PARSE_OBJECT *ArgOp,
+ UINT32 RequiredBtypes,
+ UINT32 ThisNodeBtype);
+
+static BOOLEAN
+AnIsInternalMethod (
+ ACPI_PARSE_OBJECT *Op);
+
+static UINT32
+AnGetInternalMethodReturnType (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnIsInternalMethod
+ *
+ * PARAMETERS: Op - Current op
+ *
+ * RETURN: Boolean
+ *
+ * DESCRIPTION: Check for an internal control method.
+ *
+ ******************************************************************************/
+
+static BOOLEAN
+AnIsInternalMethod (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
+ (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
+ {
+ return (TRUE);
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AnGetInternalMethodReturnType
+ *
+ * PARAMETERS: Op - Current op
+ *
+ * RETURN: Btype
+ *
+ * DESCRIPTION: Get the return type of an internal method
+ *
+ ******************************************************************************/
+
+static UINT32
+AnGetInternalMethodReturnType (
+ ACPI_PARSE_OBJECT *Op)
+{
+
+ if ((!ACPI_STRCMP (Op->Asl.ExternalName, "\\_OSI")) ||
+ (!ACPI_STRCMP (Op->Asl.ExternalName, "_OSI")))
+ {
+ return (ACPI_BTYPE_STRING);
+ }
+
+ return (0);
+}
+
/*******************************************************************************
*
@@ -137,12 +244,12 @@
* RETURN: The corresponding Bit-encoded types
*
* DESCRIPTION: Convert an encoded ARGI required argument type code into a
- * bitfield type code. Implements the implicit source conversion
+ * bitfield type code. Implements the implicit source conversion
* rules.
*
******************************************************************************/
-UINT32
+static UINT32
AnMapArgTypeToBtype (
UINT32 ArgType)
{
@@ -202,9 +309,12 @@
case ARGI_DATAOBJECT:
- /* Buffer, string, package or reference to a Op - Used only by SizeOf operator*/
-
- return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER | ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
+ /*
+ * Buffer, string, package or reference to a Op -
+ * Used only by SizeOf operator
+ */
+ return (ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
+ ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE);
case ARGI_COMPLEXOBJ:
@@ -215,8 +325,15 @@
case ARGI_REF_OR_STRING:
return (ACPI_BTYPE_STRING | ACPI_BTYPE_REFERENCE);
- case ARGI_REGION_OR_FIELD:
- return (ACPI_BTYPE_REGION | ACPI_BTYPE_FIELD_UNIT);
+ case ARGI_REGION_OR_BUFFER:
+
+ /* Used by Load() only. Allow buffers in addition to regions/fields */
+
+ return (ACPI_BTYPE_REGION | ACPI_BTYPE_BUFFER | ACPI_BTYPE_FIELD_UNIT);
+
+ case ARGI_DATAREFOBJ:
+ return (ACPI_BTYPE_INTEGER |ACPI_BTYPE_STRING | ACPI_BTYPE_BUFFER |
+ ACPI_BTYPE_PACKAGE | ACPI_BTYPE_REFERENCE | ACPI_BTYPE_DDB_HANDLE);
default:
break;
@@ -235,14 +352,14 @@
* RETURN: Btype corresponding to the Etype
*
* DESCRIPTION: Convert an encoded ACPI type to a bitfield type applying the
- * operand conversion rules. In other words, returns the type(s)
+ * operand conversion rules. In other words, returns the type(s)
* this Etype is implicitly converted to during interpretation.
*
******************************************************************************/
-UINT32
+static UINT32
AnMapEtypeToBtype (
- UINT32 Etype)
+ UINT32 Etype)
{
@@ -323,41 +440,6 @@
/*******************************************************************************
*
- * FUNCTION: AnMapBtypeToEtype
- *
- * PARAMETERS: Btype - Bitfield of ACPI types
- *
- * RETURN: The Etype corresponding the the Btype
- *
- * DESCRIPTION: Convert a bitfield type to an encoded type
- *
- ******************************************************************************/
-
-UINT32
-AnMapBtypeToEtype (
- UINT32 Btype)
-{
- UINT32 i;
- UINT32 Etype;
-
-
- if (Btype == 0)
- {
- return 0;
- }
-
- Etype = 1;
- for (i = 1; i < Btype; i *= 2)
- {
- Etype++;
- }
-
- return (Etype);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AnFormatBtype
*
* PARAMETERS: Btype - Bitfield of ACPI types
@@ -369,13 +451,13 @@
*
******************************************************************************/
-void
+static void
AnFormatBtype (
- char *Buffer,
- UINT32 Btype)
+ char *Buffer,
+ UINT32 Btype)
{
- UINT32 Type;
- BOOLEAN First = TRUE;
+ UINT32 Type;
+ BOOLEAN First = TRUE;
*Buffer = 0;
@@ -386,7 +468,7 @@
return;
}
- for (Type = 1; Type < ACPI_TYPE_EXTERNAL_MAX; Type++)
+ for (Type = 1; Type <= ACPI_TYPE_EXTERNAL_MAX; Type++)
{
if (Btype & 0x00000001)
{
@@ -437,7 +519,7 @@
*
******************************************************************************/
-UINT32
+static UINT32
AnGetBtype (
ACPI_PARSE_OBJECT *Op)
{
@@ -461,6 +543,11 @@
}
ThisNodeBtype = AnMapEtypeToBtype (Node->Type);
+ if (!ThisNodeBtype)
+ {
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
+ "could not map type");
+ }
/*
* Since it was a named reference, enable the
@@ -470,11 +557,19 @@
if (Op->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
- ReferencedNode = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+ ReferencedNode = Node->Op;
if (!ReferencedNode)
{
- printf ("No back ptr to Op: type %X\n", Node->Type);
- return ACPI_UINT32_MAX;
+ /* Check for an internal method */
+
+ if (AnIsInternalMethod (Op))
+ {
+ return (AnGetInternalMethodReturnType (Op));
+ }
+
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
+ "null Op pointer");
+ return ACPI_UINT32_MAX;
}
if (ReferencedNode->Asl.CompileFlags & NODE_METHOD_TYPED)
@@ -509,13 +604,7 @@
*
******************************************************************************/
-#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000
-#define ACPI_NOT_RESERVED_NAME ACPI_UINT32_MAX
-#define ACPI_PREDEFINED_NAME (ACPI_UINT32_MAX - 1)
-#define ACPI_EVENT_RESERVED_NAME (ACPI_UINT32_MAX - 2)
-#define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3)
-
-UINT32
+static UINT32
AnCheckForReservedName (
ACPI_PARSE_OBJECT *Op,
char *Name)
@@ -525,7 +614,8 @@
if (Name[0] == 0)
{
- AcpiOsPrintf ("Found a null name, external = %s\n", Op->Asl.ExternalName);
+ AcpiOsPrintf ("Found a null name, external = %s\n",
+ Op->Asl.ExternalName);
}
/* All reserved names are prefixed with a single underscore */
@@ -539,16 +629,18 @@
for (i = 0; ReservedMethods[i].Name; i++)
{
- if (!ACPI_STRNCMP (Name, ReservedMethods[i].Name, ACPI_NAME_SIZE))
+ if (ACPI_COMPARE_NAME (Name, ReservedMethods[i].Name))
{
if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
{
- AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName);
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op,
+ Op->Asl.ExternalName);
return (ACPI_PREDEFINED_NAME);
}
else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME)
{
- AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op, Op->Asl.ExternalName);
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_WORD, Op,
+ Op->Asl.ExternalName);
return (ACPI_PREDEFINED_NAME);
}
@@ -595,11 +687,12 @@
}
/*
- * The name didn't match any of the known reserved names. Flag it as a
+ * The name didn't match any of the known reserved names. Flag it as a
* warning, since the entire namespace starting with an underscore is
* reserved by the ACPI spec.
*/
- AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op, Op->Asl.ExternalName);
+ AslError (ASL_WARNING, ASL_MSG_UNKNOWN_RESERVED_NAME, Op,
+ Op->Asl.ExternalName);
return (ACPI_NOT_RESERVED_NAME);
}
@@ -619,7 +712,7 @@
*
******************************************************************************/
-void
+static void
AnCheckForReservedMethod (
ACPI_PARSE_OBJECT *Op,
ASL_METHOD_INFO *MethodInfo)
@@ -649,7 +742,7 @@
if (MethodInfo->NumArguments != 0)
{
- sprintf (MsgBuffer, " %s requires %d",
+ sprintf (MsgBuffer, "%s requires %d",
Op->Asl.ExternalName, 0);
AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer);
@@ -665,17 +758,19 @@
if (MethodInfo->NumArguments != ReservedMethods[Index].NumArguments)
{
- sprintf (MsgBuffer, " %s requires %d",
+ sprintf (MsgBuffer, "%s requires %d",
ReservedMethods[Index].Name,
ReservedMethods[Index].NumArguments);
if (MethodInfo->NumArguments > ReservedMethods[Index].NumArguments)
{
- AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op, MsgBuffer);
+ AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_HI, Op,
+ MsgBuffer);
}
else
{
- AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op, MsgBuffer);
+ AslError (ASL_WARNING, ASL_MSG_RESERVED_ARG_COUNT_LO, Op,
+ MsgBuffer);
}
}
@@ -691,7 +786,19 @@
}
-UINT32
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapObjTypeToBtype
+ *
+ * PARAMETERS: Op - A parse node
+ *
+ * RETURN: A Btype
+ *
+ * DESCRIPTION: Map object to the associated "Btype"
+ *
+ ******************************************************************************/
+
+static UINT32
AnMapObjTypeToBtype (
ACPI_PARSE_OBJECT *Op)
{
@@ -757,7 +864,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
+ * DESCRIPTION: Descending callback for the analysis walk. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
@@ -780,10 +887,7 @@
ACPI_PARSE_OBJECT *ArgNode;
ACPI_PARSE_OBJECT *NextType;
ACPI_PARSE_OBJECT *NextParamType;
- char ActualArgs = 0;
-
-
- ACPI_FUNCTION_NAME ("AnMethodAnalysisWalkBegin");
+ UINT8 ActualArgs = 0;
switch (Op->Asl.ParseOpcode)
@@ -792,9 +896,8 @@
TotalMethods++;
- /*
- * Create and init method info
- */
+ /* Create and init method info */
+
MethodInfo = UtLocalCalloc (sizeof (ASL_METHOD_INFO));
MethodInfo->Next = WalkInfo->MethodStack;
MethodInfo->Op = Op;
@@ -808,7 +911,8 @@
/* Get the NumArguments node */
Next = Next->Asl.Next;
- MethodInfo->NumArguments = (UINT8) (((UINT8) Next->Asl.Value.Integer) & 0x07);
+ MethodInfo->NumArguments = (UINT8)
+ (((UINT8) Next->Asl.Value.Integer) & 0x07);
/* Get the SerializeRule and SyncLevel nodes, ignored here */
@@ -849,7 +953,8 @@
}
else
{
- MethodInfo->ValidArgTypes[ActualArgs] = AnMapObjTypeToBtype (NextType);
+ MethodInfo->ValidArgTypes[ActualArgs] =
+ AnMapObjTypeToBtype (NextType);
NextType->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
}
@@ -904,9 +1009,11 @@
if (!MethodInfo)
{
- /* Probably was an error in the method declaration, no additional error here */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ /*
+ * Probably was an error in the method declaration,
+ * no additional error here
+ */
+ ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
}
@@ -946,9 +1053,11 @@
if (!MethodInfo)
{
- /* Probably was an error in the method declaration, no additional error here */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ /*
+ * Probably was an error in the method declaration,
+ * no additional error here
+ */
+ ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
}
@@ -989,9 +1098,11 @@
if (!MethodInfo)
{
- /* Probably was an error in the method declaration, no additional error here */
-
- ACPI_DEBUG_PRINT ((ACPI_DB_WARN, "%p, No parent method\n", Op));
+ /*
+ * Probably was an error in the method declaration,
+ * no additional error here
+ */
+ ACPI_WARNING ((AE_INFO, "%p, No parent method", Op));
return (AE_ERROR);
}
@@ -1031,7 +1142,10 @@
case PARSEOP_STALL:
- if (Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX)
+ /* We can range check if the argument is an integer */
+
+ if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
+ (Op->Asl.Child->Asl.Value.Integer > ACPI_UINT8_MAX))
{
AslError (ASL_ERROR, ASL_MSG_INVALID_TIME, Op, NULL);
}
@@ -1069,12 +1183,12 @@
* This reserved name must be a control method because
* it must have arguments
*/
- AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op, "with arguments");
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
+ "with arguments");
}
- /*
- * Typechecking for _HID
- */
+ /* Typechecking for _HID */
+
else if (!ACPI_STRCMP (METHOD_NAME__HID, ReservedMethods[i].Name))
{
/* Examine the second operand to typecheck it */
@@ -1086,7 +1200,8 @@
{
/* _HID must be a string or an integer */
- AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Next, "String or Integer");
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_OPERAND_TYPE, Next,
+ "String or Integer");
}
if (Next->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
@@ -1100,14 +1215,14 @@
{
if (!isalnum (Next->Asl.Value.String[i]))
{
- AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING, Next, Next->Asl.Value.String);
+ AslError (ASL_ERROR, ASL_MSG_ALPHANUMERIC_STRING,
+ Next, Next->Asl.Value.String);
break;
}
}
}
}
}
-
break;
@@ -1125,15 +1240,15 @@
*
* PARAMETERS: Op - A method parse node
*
- * RETURN: TRUE if last statement is an ASL RETURN. False otherwise
+ * RETURN: TRUE if last statement is an ASL RETURN. False otherwise
*
* DESCRIPTION: Walk down the list of top level statements within a method
- * to find the last one. Check if that last statement is in
+ * to find the last one. Check if that last statement is in
* fact a RETURN statement.
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
AnLastStatementIsReturn (
ACPI_PARSE_OBJECT *Op)
{
@@ -1167,7 +1282,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
@@ -1189,7 +1304,8 @@
if (!MethodInfo)
{
printf ("No method info for method! [%s]\n", Op->Asl.Namepath);
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, "No method info for this method");
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op,
+ "No method info for this method");
CmCleanupAndExit ();
return (AE_AML_INTERNAL);
}
@@ -1215,26 +1331,27 @@
{
/*
* No return statement, and execution can possibly exit
- * via this path. This is equivalent to Return ()
+ * via this path. This is equivalent to Return ()
*/
MethodInfo->NumReturnNoValue++;
}
/*
* Check for case where some return statements have a return value
- * and some do not. Exit without a return statement is a return with
+ * and some do not. Exit without a return statement is a return with
* no value
*/
if (MethodInfo->NumReturnNoValue &&
MethodInfo->NumReturnWithValue)
{
- AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op, Op->Asl.ExternalName);
+ AslError (ASL_WARNING, ASL_MSG_RETURN_TYPES, Op,
+ Op->Asl.ExternalName);
}
/*
* If there are any RETURN() statements with no value, or there is a
* control path that allows the method to exit without a return value,
- * we mark the method as a method that does not return a value. This
+ * we mark the method as a method that does not return a value. This
* knowledge can be used to check method invocations that expect a
* returned value.
*/
@@ -1255,7 +1372,7 @@
* and correct number of arguments
*/
AnCheckForReservedMethod (Op, MethodInfo);
- ACPI_MEM_FREE (MethodInfo);
+ ACPI_FREE (MethodInfo);
break;
@@ -1266,12 +1383,15 @@
* method is terminated here with the Return() statement.
*/
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
- Op->Asl.ParentMethod = MethodInfo->Op; /* Used in the "typing" pass later */
+
+ /* Used in the "typing" pass later */
+
+ Op->Asl.ParentMethod = MethodInfo->Op;
/*
* If there is a peer node after the return statement, then this
- * node is unreachable code -- i.e., it won't be executed because of the
- * preceeding Return() statement.
+ * node is unreachable code -- i.e., it won't be executed because of
+ * the preceeding Return() statement.
*/
if (Op->Asl.Next)
{
@@ -1287,7 +1407,7 @@
(Op->Asl.Next->Asl.ParseOpcode == PARSEOP_ELSE))
{
/*
- * This IF has a corresponding ELSE. The IF block has no exit,
+ * This IF has a corresponding ELSE. The IF block has no exit,
* (it contains an unconditional Return)
* mark the ELSE block to remember this fact.
*/
@@ -1303,7 +1423,7 @@
{
/*
* This ELSE block has no exit and the corresponding IF block
- * has no exit either. Therefore, the parent node has no exit.
+ * has no exit either. Therefore, the parent node has no exit.
*/
Op->Asl.Parent->Asl.CompileFlags |= NODE_HAS_NO_EXIT;
}
@@ -1357,8 +1477,8 @@
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for typing walk. Complete method
- * return analysis. Check methods for :
+ * DESCRIPTION: Ascending callback for typing walk. Complete the method
+ * return analysis. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
@@ -1392,17 +1512,24 @@
(ThisNodeBtype == (ACPI_UINT32_MAX -1)))
{
/*
- * The method is untyped at this time (typically a forward reference).
- * We must recursively type the method here
+ * The called method is untyped at this time (typically a
+ * forward reference).
+ *
+ * Check for a recursive method call first.
*/
- TrWalkParseTree (ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Op->Asl.Child->Asl.Node->Object),
+ if (Op->Asl.ParentMethod != Op->Asl.Child->Asl.Node->Op)
+ {
+ /* We must type the method here */
+
+ TrWalkParseTree (Op->Asl.Child->Asl.Node->Op,
ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
AnMethodTypingWalkEnd, NULL);
- ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+ ThisNodeBtype = AnGetBtype (Op->Asl.Child);
+ }
}
- /* Returns a value, get it's type */
+ /* Returns a value, save the value type */
if (Op->Asl.ParentMethod)
{
@@ -1436,7 +1563,7 @@
*
******************************************************************************/
-void
+static void
AnCheckMethodReturnValue (
ACPI_PARSE_OBJECT *Op,
const ACPI_OPCODE_INFO *OpInfo,
@@ -1453,26 +1580,23 @@
/* Examine the parent op of this method */
- OwningOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+ OwningOp = Node->Op;
if (OwningOp->Asl.CompileFlags & NODE_METHOD_NO_RETVAL)
{
- /*
- * Method NEVER returns a value
- */
+ /* Method NEVER returns a value */
+
AslError (ASL_ERROR, ASL_MSG_NO_RETVAL, Op, Op->Asl.ExternalName);
}
else if (OwningOp->Asl.CompileFlags & NODE_METHOD_SOME_NO_RETVAL)
{
- /*
- * Method SOMETIMES returns a value, SOMETIMES not
- */
+ /* Method SOMETIMES returns a value, SOMETIMES not */
+
AslError (ASL_WARNING, ASL_MSG_SOME_NO_RETVAL, Op, Op->Asl.ExternalName);
}
else if (!(ThisNodeBtype & RequiredBtypes))
{
- /*
- * Method returns a value, but the type is wrong
- */
+ /* Method returns a value, but the type is wrong */
+
AnFormatBtype (StringBuffer, ThisNodeBtype);
AnFormatBtype (StringBuffer2, RequiredBtypes);
@@ -1485,8 +1609,9 @@
*/
if (ThisNodeBtype != 0)
{
- sprintf (MsgBuffer, "Method returns [%s], %s operator requires [%s]",
- StringBuffer, OpInfo->Name, StringBuffer2);
+ sprintf (MsgBuffer,
+ "Method returns [%s], %s operator requires [%s]",
+ StringBuffer, OpInfo->Name, StringBuffer2);
AslError (ASL_ERROR, ASL_MSG_INVALID_TYPE, ArgOp, MsgBuffer);
}
@@ -1502,7 +1627,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
+ * DESCRIPTION: Descending callback for the analysis walk. Check methods for:
* 1) Initialized local variables
* 2) Valid arguments
* 3) Return types
@@ -1528,7 +1653,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
@@ -1593,6 +1718,13 @@
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
+ /* Check for an internal method */
+
+ if (AnIsInternalMethod (ArgOp))
+ {
+ return (AE_OK);
+ }
+
/* The lone arg is a method call, check it */
RequiredBtypes = AnMapArgTypeToBtype (ARGI_INTEGER);
@@ -1606,7 +1738,8 @@
{
return (AE_OK);
}
- AnCheckMethodReturnValue (Op, OpInfo, ArgOp, RequiredBtypes, ThisNodeBtype);
+ AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
+ RequiredBtypes, ThisNodeBtype);
}
return (AE_OK);
@@ -1758,9 +1891,15 @@
if (ArgOp->Asl.ParseOpcode == PARSEOP_METHODCALL)
{
+ if (AnIsInternalMethod (ArgOp))
+ {
+ return (AE_OK);
+ }
+
/* Check a method call for a valid return value */
- AnCheckMethodReturnValue (Op, OpInfo, ArgOp, RequiredBtypes, ThisNodeBtype);
+ AnCheckMethodReturnValue (Op, OpInfo, ArgOp,
+ RequiredBtypes, ThisNodeBtype);
}
/*
@@ -1796,16 +1935,81 @@
/*******************************************************************************
*
+ * FUNCTION: AnIsResultUsed
+ *
+ * PARAMETERS: Op - Parent op for the operator
+ *
+ * RETURN: TRUE if result from this operation is actually consumed
+ *
+ * DESCRIPTION: Determine if the function result value from an operator is
+ * used.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AnIsResultUsed (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Parent;
+
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_INCREMENT:
+ case PARSEOP_DECREMENT:
+
+ /* These are standalone operators, no return value */
+
+ return (TRUE);
+
+ default:
+ break;
+ }
+
+ /* Examine parent to determine if the return value is used */
+
+ Parent = Op->Asl.Parent;
+ switch (Parent->Asl.ParseOpcode)
+ {
+ /* If/While - check if the operator is the predicate */
+
+ case PARSEOP_IF:
+ case PARSEOP_WHILE:
+
+ /* First child is the predicate */
+
+ if (Parent->Asl.Child == Op)
+ {
+ return (TRUE);
+ }
+ return (FALSE);
+
+ /* Not used if one of these is the parent */
+
+ case PARSEOP_METHOD:
+ case PARSEOP_DEFINITIONBLOCK:
+ case PARSEOP_ELSE:
+
+ return (FALSE);
+
+ default:
+ /* Any other type of parent means that the result is used */
+
+ return (TRUE);
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: AnOtherSemanticAnalysisWalkBegin
*
* PARAMETERS: ASL_WALK_CALLBACK
*
* RETURN: Status
*
- * DESCRIPTION: Descending callback for the analysis walk. Check methods for :
- * 1) Initialized local variables
- * 2) Valid arguments
- * 3) Return types
+ * DESCRIPTION: Descending callback for the analysis walk. Checks for
+ * miscellaneous issues in the code.
*
******************************************************************************/
@@ -1815,6 +2019,130 @@
UINT32 Level,
void *Context)
{
+ ACPI_PARSE_OBJECT *ArgNode;
+ ACPI_PARSE_OBJECT *PrevArgNode = NULL;
+ const ACPI_OPCODE_INFO *OpInfo;
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+
+ /*
+ * Determine if an execution class operator actually does something by
+ * checking if it has a target and/or the function return value is used.
+ * (Target is optional, so a standalone statement can actually do nothing.)
+ */
+ if ((OpInfo->Class == AML_CLASS_EXECUTE) &&
+ (OpInfo->Flags & AML_HAS_RETVAL) &&
+ (!AnIsResultUsed (Op)))
+ {
+ if (OpInfo->Flags & AML_HAS_TARGET)
+ {
+ /*
+ * Find the target node, it is always the last child. If the traget
+ * is not specified in the ASL, a default node of type Zero was
+ * created by the parser.
+ */
+ ArgNode = Op->Asl.Child;
+ while (ArgNode->Asl.Next)
+ {
+ PrevArgNode = ArgNode;
+ ArgNode = ArgNode->Asl.Next;
+ }
+
+ /* Divide() is the only weird case, it has two targets */
+
+ if (Op->Asl.AmlOpcode == AML_DIVIDE_OP)
+ {
+ if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) &&
+ (PrevArgNode->Asl.ParseOpcode == PARSEOP_ZERO))
+ {
+ AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
+ }
+ }
+ else if (ArgNode->Asl.ParseOpcode == PARSEOP_ZERO)
+ {
+ AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
+ }
+ }
+ else
+ {
+ /*
+ * Has no target and the result is not used. Only a couple opcodes
+ * can have this combination.
+ */
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_ACQUIRE:
+ case PARSEOP_WAIT:
+ break;
+
+ default:
+ AslError (ASL_WARNING, ASL_MSG_RESULT_NOT_USED, Op, Op->Asl.ExternalName);
+ break;
+ }
+ }
+ }
+
+
+ /*
+ * Semantic checks for individual ASL operators
+ */
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_ACQUIRE:
+ case PARSEOP_WAIT:
+ /*
+ * Emit a warning if the timeout parameter for these operators is not
+ * ACPI_WAIT_FOREVER, and the result value from the operator is not
+ * checked, meaning that a timeout could happen, but the code
+ * would not know about it.
+ */
+
+ /* First child is the namepath, 2nd child is timeout */
+
+ ArgNode = Op->Asl.Child;
+ ArgNode = ArgNode->Asl.Next;
+
+ /*
+ * Check for the WAIT_FOREVER case - defined by the ACPI spec to be
+ * 0xFFFF or greater
+ */
+ if (((ArgNode->Asl.ParseOpcode == PARSEOP_WORDCONST) ||
+ (ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER)) &&
+ (ArgNode->Asl.Value.Integer >= (ACPI_INTEGER) ACPI_WAIT_FOREVER))
+ {
+ break;
+ }
+
+ /*
+ * The operation could timeout. If the return value is not used
+ * (indicates timeout occurred), issue a warning
+ */
+ if (!AnIsResultUsed (Op))
+ {
+ AslError (ASL_WARNING, ASL_MSG_TIMEOUT, ArgNode, Op->Asl.ExternalName);
+ }
+ break;
+
+ case PARSEOP_CREATEFIELD:
+ /*
+ * Check for a zero Length (NumBits) operand. NumBits is the 3rd operand
+ */
+ ArgNode = Op->Asl.Child;
+ ArgNode = ArgNode->Asl.Next;
+ ArgNode = ArgNode->Asl.Next;
+
+ if ((ArgNode->Asl.ParseOpcode == PARSEOP_ZERO) ||
+ ((ArgNode->Asl.ParseOpcode == PARSEOP_INTEGER) &&
+ (ArgNode->Asl.Value.Integer == 0)))
+ {
+ AslError (ASL_ERROR, ASL_MSG_NON_ZERO, ArgNode, NULL);
+ }
+ break;
+
+ default:
+ break;
+ }
return AE_OK;
}
@@ -1828,7 +2156,7 @@
*
* RETURN: Status
*
- * DESCRIPTION: Ascending callback for analysis walk. Complete method
+ * DESCRIPTION: Ascending callback for analysis walk. Complete method
* return analysis.
*
******************************************************************************/
@@ -1843,3 +2171,41 @@
return AE_OK;
}
+
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: AnMapBtypeToEtype
+ *
+ * PARAMETERS: Btype - Bitfield of ACPI types
+ *
+ * RETURN: The Etype corresponding the the Btype
+ *
+ * DESCRIPTION: Convert a bitfield type to an encoded type
+ *
+ ******************************************************************************/
+
+UINT32
+AnMapBtypeToEtype (
+ UINT32 Btype)
+{
+ UINT32 i;
+ UINT32 Etype;
+
+
+ if (Btype == 0)
+ {
+ return 0;
+ }
+
+ Etype = 1;
+ for (i = 1; i < Btype; i *= 2)
+ {
+ Etype++;
+ }
+
+ return (Etype);
+}
+#endif
+
Index: aslmap.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslmap.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslmap.c -L sys/contrib/dev/acpica/compiler/aslmap.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslmap.c
+++ sys/contrib/dev/acpica/compiler/aslmap.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslmap - parser to AML opcode mapping table
- * $Revision: 76 $
+ * $Revision: 1.87 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,9 +116,9 @@
*****************************************************************************/
-#include "aslcompiler.h"
-#include "amlcode.h"
-#include "acparser.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acparser.h>
#define _COMPONENT ACPI_COMPILER
@@ -172,6 +172,56 @@
/*******************************************************************************
*
+ * FUNCTION: MpDisplayReservedNames
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Print the table above
+ *
+ ******************************************************************************/
+
+void
+MpDisplayReservedNames (
+ void)
+{
+ UINT32 i;
+
+ printf ("Reserved name information\n\n");
+
+ for (i = 0; ReservedMethods[i].Name; i++)
+ {
+ printf ("%s ", ReservedMethods[i].Name);
+
+ if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
+ {
+ printf ("Reserved scope name\n");
+ }
+ else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME)
+ {
+ printf ("Resource data type reserved field name\n");
+ }
+ else
+ {
+ printf ("Method with %d arguments, ",
+ ReservedMethods[i].NumArguments);
+
+ if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE)
+ {
+ printf ("must return a value\n");
+ }
+ else
+ {
+ printf ("no return value\n");
+ }
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
* DATA STRUCTURE: ReservedMethods
*
* DESCRIPTION: Contains all reserved methods and names as defined in the
@@ -258,7 +308,7 @@
{"_EJ3", 1, 0},
{"_EJ4", 1, 0},
{"_EJD", 0, ASL_RSVD_RETURN_VALUE},
- {"_ERR", 2, ASL_RSVD_RETURN_VALUE},
+ {"_ERR", 3, ASL_RSVD_RETURN_VALUE},
{"_FDE", 0, ASL_RSVD_RETURN_VALUE},
{"_FDI", 0, ASL_RSVD_RETURN_VALUE},
{"_FDM", 1, 0},
@@ -371,6 +421,7 @@
{"_SWS", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_TC1", 0, ASL_RSVD_RETURN_VALUE},
{"_TC2", 0, ASL_RSVD_RETURN_VALUE},
+ {"_TDL", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0b */
{"_TMP", 0, ASL_RSVD_RETURN_VALUE},
{"_TPC", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_TPT", 1, 0}, /* Acpi 3.0 */
@@ -395,60 +446,14 @@
{"_UPP", 0, ASL_RSVD_RETURN_VALUE}, /* Acpi 3.0 */
{"_VPO", 0, ASL_RSVD_RETURN_VALUE},
{"_WAK", 1, ASL_RSVD_RETURN_VALUE},
+ {"_WDG", 0, ASL_RSVD_RETURN_VALUE}, /* MS Extension */
+ {"_WED", 1, ASL_RSVD_RETURN_VALUE}, /* MS Extension */
{NULL, 0, 0},
};
/*******************************************************************************
*
- * FUNCTION: MpDisplayReservedNames
- *
- * PARAMETERS: None
- *
- * RETURN: None
- *
- * DESCRIPTION: Print the table above
- *
- ******************************************************************************/
-
-void
-MpDisplayReservedNames (
- void)
-{
- UINT32 i;
-
- printf ("Reserved name information\n\n");
-
- for (i = 0; ReservedMethods[i].Name; i++)
- {
- printf ("%s ", ReservedMethods[i].Name);
-
- if (ReservedMethods[i].Flags & ASL_RSVD_SCOPE)
- {
- printf ("Reserved scope name\n");
- }
- else if (ReservedMethods[i].Flags & ASL_RSVD_RESOURCE_NAME)
- {
- printf ("Resource data type reserved field name\n");
- }
- else
- {
- printf ("Method with %d arguments, ", ReservedMethods[i].NumArguments);
- if (ReservedMethods[i].Flags & ASL_RSVD_RETURN_VALUE)
- {
- printf ("must return a value\n");
- }
- else
- {
- printf ("no return value\n");
- }
- }
- }
-}
-
-
-/*******************************************************************************
- *
* DATA STRUCTURE: AslKeywordMapping
*
* DESCRIPTION: Maps the ParseOpcode to the actual AML opcode. The parse
@@ -549,6 +554,7 @@
/* ELSE */ OP_TABLE_ENTRY (AML_ELSE_OP, 0, NODE_AML_PACKAGE, 0),
/* ELSEIF */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, NODE_AML_PACKAGE, 0),
/* ENDDEPENDENTFN */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
+/* ENDTAG */ OP_TABLE_ENTRY (AML_DEFAULT_ARG_OP, 0, 0, 0),
/* ERRORNODE */ OP_TABLE_ENTRY (AML_NOOP_OP, 0, 0, 0),
/* EVENT */ OP_TABLE_ENTRY (AML_EVENT_OP, 0, 0, 0),
/* EXTENDEDIO */ OP_TABLE_ENTRY (AML_BYTE_OP, 0, 0, 0),
@@ -647,6 +653,7 @@
/* OBJECTTYPE_OPR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_REGION, 0, 0),
/* OBJECTTYPE_PKG */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PACKAGE, 0, 0),
/* OBJECTTYPE_POW */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_POWER, 0, 0),
+/* OBJECTTYPE_PRO */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_PROCESSOR, 0, 0),
/* OBJECTTYPE_STR */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_STRING, 0, 0),
/* OBJECTTYPE_THZ */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_THERMAL, 0, 0),
/* OBJECTTYPE_UNK */ OP_TABLE_ENTRY (AML_BYTE_OP, ACPI_TYPE_ANY, 0, 0),
@@ -706,7 +713,7 @@
/* THERMALZONE */ OP_TABLE_ENTRY (AML_THERMAL_ZONE_OP, 0, NODE_AML_PACKAGE, 0),
/* TIMER */ OP_TABLE_ENTRY (AML_TIMER_OP, 0, 0, ACPI_BTYPE_INTEGER),
/* TOBCD */ OP_TABLE_ENTRY (AML_TO_BCD_OP, 0, 0, ACPI_BTYPE_INTEGER),
-/* TOBUFFER */ OP_TABLE_ENTRY (AML_TO_BUFFER_OP, 0, 0, ACPI_BTYPE_COMPUTE_DATA),
+/* TOBUFFER */ OP_TABLE_ENTRY (AML_TO_BUFFER_OP, 0, 0, ACPI_BTYPE_BUFFER),
/* TODECIMALSTRING */ OP_TABLE_ENTRY (AML_TO_DECSTRING_OP, 0, 0, ACPI_BTYPE_STRING),
/* TOHEXSTRING */ OP_TABLE_ENTRY (AML_TO_HEXSTRING_OP, 0, 0, ACPI_BTYPE_STRING),
/* TOINTEGER */ OP_TABLE_ENTRY (AML_TO_INTEGER_OP, 0, 0, ACPI_BTYPE_INTEGER),
Index: aslglobal.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslglobal.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslglobal.h -L sys/contrib/dev/acpica/compiler/aslglobal.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslglobal.h
+++ sys/contrib/dev/acpica/compiler/aslglobal.h
@@ -3,7 +3,7 @@
/******************************************************************************
*
* Module Name: aslglobal.h - Global variable definitions
- * $Revision: 44 $
+ * $Revision: 1.56 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -125,6 +125,8 @@
* Global variables. Defined in aslmain.c only, externed in all other files
*/
+#undef ASL_EXTERN
+
#ifdef _DECLARE_GLOBALS
#define ASL_EXTERN
#define ASL_INIT_GLOBAL(a,b) (a)=(b)
@@ -145,7 +147,7 @@
extern char hex[];
#define ASL_LINE_BUFFER_SIZE 512
-#define ASL_MSG_BUFFER_SIZE (ASL_LINE_BUFFER_SIZE * 2)
+#define ASL_MSG_BUFFER_SIZE 4096
#define HEX_TABLE_LINE_SIZE 8
#define HEX_LISTING_LINE_SIZE 16
@@ -169,6 +171,7 @@
/* Option flags */
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_Acpi2, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_UseDefaultAmlFilename, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NsOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DebugFlag, FALSE);
@@ -178,7 +181,6 @@
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_C_IncludeOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ListingFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IgnoreErrors, FALSE);
-ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GenerateExternals, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_SourceOutputFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ParseOnlyFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE);
@@ -190,6 +192,8 @@
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_ReferenceOptimizationFlag, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayRemarks, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisplayOptimizations, FALSE);
+ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNING);
+
#define HEX_OUTPUT_NONE 0
#define HEX_OUTPUT_C 1
@@ -202,6 +206,7 @@
ASL_EXTERN ASL_FILE_INFO Gbl_Files [ASL_NUM_FILES];
ASL_EXTERN char *Gbl_DirectoryPath;
+ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_ExternalFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_IncludeFilename, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_OutputFilenamePrefix, NULL);
ASL_EXTERN char *Gbl_CurrentInputFilename;
@@ -226,6 +231,7 @@
/* Misc */
ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_RevisionOverride, 0);
+ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_TempCount, 0);
ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*RootNode, NULL);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TableLength, 0);
ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_SourceLine, 0);
@@ -234,7 +240,6 @@
ASL_EXTERN ACPI_PARSE_OBJECT ASL_INIT_GLOBAL (*Gbl_NodeCacheLast, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheNext, NULL);
ASL_EXTERN char ASL_INIT_GLOBAL (*Gbl_StringCacheLast, NULL);
-ASL_EXTERN UINT32 ASL_INIT_GLOBAL (Gbl_TempCount, 0);
ASL_EXTERN ACPI_PARSE_OBJECT *Gbl_FirstLevelInsertionNode;
@@ -254,8 +259,13 @@
ASL_EXTERN ASL_ANALYSIS_WALK_INFO AnalysisWalkInfo;
ASL_EXTERN ACPI_TABLE_HEADER TableHeader;
extern const ASL_RESERVED_INFO ReservedMethods[];
-ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[21];
+/* Event timing */
+
+#define ASL_NUM_EVENTS 19
+ASL_EXTERN ASL_EVENT_INFO AslGbl_Events[ASL_NUM_EVENTS];
+ASL_EXTERN UINT8 AslGbl_NextEvent;
+ASL_EXTERN UINT8 AslGbl_NamespaceEvent;
/* Scratch buffers */
Index: aslcompile.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslcompile.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslcompile.c -L sys/contrib/dev/acpica/compiler/aslcompile.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslcompile.c
+++ sys/contrib/dev/acpica/compiler/aslcompile.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslcompile - top level compile module
- * $Revision: 73 $
+ * $Revision: 1.97 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,11 +116,22 @@
*****************************************************************************/
#include <stdio.h>
-#include "aslcompiler.h"
+#include <time.h>
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslcompile")
+/* Local prototypes */
+
+static void
+CmFlushSourceCode (
+ void);
+
+static ACPI_STATUS
+FlCheckForAscii (
+ ASL_FILE_INFO *FileInfo);
+
/*******************************************************************************
*
@@ -141,9 +152,8 @@
char *Prefix = "";
- /*
- * Set line prefix depending on the destination file type
- */
+ /* Set line prefix depending on the destination file type */
+
switch (FileId)
{
case ASL_FILE_ASM_SOURCE_OUTPUT:
@@ -176,15 +186,35 @@
break;
}
- /* Compiler signon with copyright */
-
+ /*
+ * Compiler signon with copyright
+ */
FlPrintFile (FileId,
- "%s\n%s%s\n%s%s version %X [%s]\n%s%s\n%sSupports ACPI Specification Revision 2.0c\n%s\n",
+ "%s\n%s%s\n%s",
Prefix,
Prefix, IntelAcpiCA,
- Prefix, CompilerId, ACPI_CA_VERSION, __DATE__,
+ Prefix);
+
+ /* Running compiler or disassembler? */
+
+ if (Gbl_DisasmFlag)
+ {
+ FlPrintFile (FileId,
+ "%s", DisassemblerId);
+ }
+ else
+ {
+ FlPrintFile (FileId,
+ "%s", CompilerId);
+ }
+
+ /* Version, build date, copyright, compliance */
+
+ FlPrintFile (FileId,
+ " version %X [%s]\n%s%s\n%s%s\n%s\n",
+ (UINT32) ACPI_CA_VERSION, __DATE__,
Prefix, CompilerCopyright,
- Prefix,
+ Prefix, CompilerCompliance,
Prefix);
}
@@ -210,9 +240,8 @@
char *Prefix = "";
- /*
- * Set line prefix depending on the destination file type
- */
+ /* Set line prefix depending on the destination file type */
+
switch (FileId)
{
case ASL_FILE_ASM_SOURCE_OUTPUT:
@@ -281,8 +310,9 @@
*
******************************************************************************/
-void
-CmFlushSourceCode (void)
+static void
+CmFlushSourceCode (
+ void)
{
char Buffer;
@@ -298,54 +328,183 @@
/*******************************************************************************
*
+ * FUNCTION: FlConsume*
+ *
+ * PARAMETERS: FileInfo - Points to an open input file
+ *
+ * RETURN: Number of lines consumed
+ *
+ * DESCRIPTION: Step over both types of comment during check for ascii chars
+ *
+ ******************************************************************************/
+
+void
+FlConsumeAnsiComment (
+ ASL_FILE_INFO *FileInfo,
+ ASL_FILE_STATUS *Status)
+{
+ UINT8 Byte;
+ BOOLEAN ClosingComment = FALSE;
+
+
+ while (fread (&Byte, 1, 1, FileInfo->Handle))
+ {
+ /* Scan until comment close is found */
+
+ if (ClosingComment)
+ {
+ if (Byte == '/')
+ {
+ return;
+ }
+
+ if (Byte != '*')
+ {
+ /* Reset */
+
+ ClosingComment = FALSE;
+ }
+ }
+ else if (Byte == '*')
+ {
+ ClosingComment = TRUE;
+ }
+
+ /* Maintain line count */
+
+ if (Byte == 0x0A)
+ {
+ Status->Line++;
+ }
+
+ Status->Offset++;
+ }
+}
+
+
+void
+FlConsumeNewComment (
+ ASL_FILE_INFO *FileInfo,
+ ASL_FILE_STATUS *Status)
+{
+ UINT8 Byte;
+
+
+ while (fread (&Byte, 1, 1, FileInfo->Handle))
+ {
+ Status->Offset++;
+
+ /* Comment ends at newline */
+
+ if (Byte == 0x0A)
+ {
+ Status->Line++;
+ return;
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: FlCheckForAscii
*
* PARAMETERS: FileInfo - Points to an open input file
*
- * RETURN: Status (0 = OK)
+ * RETURN: Status
*
- * DESCRIPTION: Verify that the input file is entirely ASCII.
+ * DESCRIPTION: Verify that the input file is entirely ASCII. Ignores characters
+ * within comments. Note: does not handle nested comments and does
+ * not handle comment delimiters within string literals. However,
+ * on the rare chance this happens and an invalid character is
+ * missed, the parser will catch the error by failing in some
+ * spectactular manner.
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
FlCheckForAscii (
ASL_FILE_INFO *FileInfo)
{
UINT8 Byte;
ACPI_SIZE BadBytes = 0;
- ACPI_SIZE Offset = 0;
+ BOOLEAN OpeningComment = FALSE;
+ ASL_FILE_STATUS Status;
+ Status.Line = 1;
+ Status.Offset = 0;
+
/* Read the entire file */
while (fread (&Byte, 1, 1, FileInfo->Handle))
{
+ /* Ignore comment fields (allow non-ascii within) */
+
+ if (OpeningComment)
+ {
+ /* Check for second comment open delimiter */
+
+ if (Byte == '*')
+ {
+ FlConsumeAnsiComment (FileInfo, &Status);
+ }
+
+ if (Byte == '/')
+ {
+ FlConsumeNewComment (FileInfo, &Status);
+ }
+
+ /* Reset */
+
+ OpeningComment = FALSE;
+ }
+ else if (Byte == '/')
+ {
+ OpeningComment = TRUE;
+ }
+
/* Check for an ASCII character */
if (!isascii (Byte))
{
if (BadBytes < 10)
{
- AcpiOsPrintf ("Non-ASCII character: 0x%2.2X at offset 0x%X\n", Byte, Offset);
+ AcpiOsPrintf (
+ "Non-ASCII character [0x%2.2X] found in line %u, file offset 0x%.2X\n",
+ Byte, Status.Line, Status.Offset);
}
+
BadBytes++;
}
- Offset++;
+
+ /* Update line counter */
+
+ else if (Byte == 0x0A)
+ {
+ Status.Line++;
+ }
+
+ Status.Offset++;
}
+ /* Seek back to the beginning of the source file */
+
+ fseek (FileInfo->Handle, 0, SEEK_SET);
+
/* Were there any non-ASCII characters in the file? */
if (BadBytes)
{
- AcpiOsPrintf ("%d non-ASCII characters found in input file, appears to be binary\n", BadBytes);
+ AcpiOsPrintf (
+ "%u non-ASCII characters found in input source text, could be a binary file\n",
+ BadBytes);
AslError (ASL_ERROR, ASL_MSG_NON_ASCII, NULL, FileInfo->Filename);
return (AE_BAD_CHARACTER);
}
- /* File is OK, seek back to the beginning */
+ /* File is OK */
- fseek (FileInfo->Handle, 0, SEEK_SET);
return (AE_OK);
}
@@ -363,14 +522,16 @@
******************************************************************************/
int
-CmDoCompile (void)
+CmDoCompile (
+ void)
{
ACPI_STATUS Status;
- UINT32 i = 0;
+ UINT8 FullCompile;
+ UINT8 Event;
- UtBeginEvent (12, "Total Compile time");
- UtBeginEvent (i, "Initialize");
+ FullCompile = UtBeginEvent ("*** Total Compile time ***");
+ Event = UtBeginEvent ("Open input and output files");
/* Open the required input and output files */
@@ -381,7 +542,7 @@
return -1;
}
- /* Ensure that the input file is 100% ASCII text */
+ /* Check for 100% ASCII source file (comments are ignored) */
Status = FlCheckForAscii (&Gbl_Files[ASL_FILE_INPUT]);
if (ACPI_FAILURE (Status))
@@ -396,17 +557,17 @@
AePrintErrorLog (ASL_FILE_STDERR);
return -1;
}
-
- UtEndEvent (i++);
+ UtEndEvent (Event);
/* Build the parse tree */
- UtBeginEvent (i, "Parse source code and build parse tree");
+ Event = UtBeginEvent ("Parse source code and build parse tree");
AslCompilerparse();
- UtEndEvent (i++);
+ UtEndEvent (Event);
/* Flush out any remaining source after parse tree is complete */
+ Event = UtBeginEvent ("Flush source input");
CmFlushSourceCode ();
/* Did the parse tree get successfully constructed? */
@@ -417,45 +578,68 @@
return -1;
}
+ /* Optional parse tree dump, compiler debug output only */
+
+ LsDumpParseTree ();
+
OpcGetIntegerWidth (RootNode);
+ UtEndEvent (Event);
/* Pre-process parse tree for any operator transforms */
- UtBeginEvent (i, "Generate AML opcodes");
+ Event = UtBeginEvent ("Parse tree transforms");
DbgPrint (ASL_DEBUG_OUTPUT, "\nParse tree transforms\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, TrAmlTransformWalk, NULL, NULL);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
+ TrAmlTransformWalk, NULL, NULL);
+ UtEndEvent (Event);
/* Generate AML opcodes corresponding to the parse tokens */
+ Event = UtBeginEvent ("Generate AML opcodes");
DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating AML opcodes\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, OpcAmlOpcodeWalk, NULL);
- UtEndEvent (i++);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
+ OpcAmlOpcodeWalk, NULL);
+ UtEndEvent (Event);
/*
* Now that the input is parsed, we can open the AML output file.
* Note: by default, the name of this file comes from the table descriptor
* within the input file.
*/
+ Event = UtBeginEvent ("Open AML output file");
Status = FlOpenAmlOutputFile (Gbl_OutputFilenamePrefix);
if (ACPI_FAILURE (Status))
{
AePrintErrorLog (ASL_FILE_STDERR);
return -1;
}
+ UtEndEvent (Event);
/* Interpret and generate all compile-time constants */
- UtBeginEvent (i, "Constant folding via AML interpreter");
- DbgPrint (ASL_DEBUG_OUTPUT, "\nInterpreting compile-time constant expressions\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, OpcAmlConstantWalk, NULL, NULL);
- UtEndEvent (i++);
+ Event = UtBeginEvent ("Constant folding via AML interpreter");
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "\nInterpreting compile-time constant expressions\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
+ OpcAmlConstantWalk, NULL, NULL);
+ UtEndEvent (Event);
+
+ /* Update AML opcodes if necessary, after constant folding */
+
+ Event = UtBeginEvent ("Updating AML opcodes after constant folding");
+ DbgPrint (ASL_DEBUG_OUTPUT,
+ "\nUpdating AML opcodes after constant folding\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD,
+ NULL, OpcAmlOpcodeUpdateWalk, NULL);
+ UtEndEvent (Event);
/* Calculate all AML package lengths */
- UtBeginEvent (i, "Generate AML package lengths");
+ Event = UtBeginEvent ("Generate AML package lengths");
DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL);
- UtEndEvent (i++);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
+ LnPackageLengthWalk, NULL);
+ UtEndEvent (Event);
if (Gbl_ParseOnlyFlag)
{
@@ -477,89 +661,111 @@
/* Namespace loading */
- UtBeginEvent (i, "Create ACPI Namespace");
+ Event = UtBeginEvent ("Create ACPI Namespace");
Status = LdLoadNamespace (RootNode);
- UtEndEvent (i++);
+ UtEndEvent (Event);
if (ACPI_FAILURE (Status))
{
return -1;
}
- /* Namespace lookup */
+ /* Namespace cross-reference */
- UtBeginEvent (i, "Cross reference parse tree and Namespace");
+ AslGbl_NamespaceEvent = UtBeginEvent ("Cross reference parse tree and Namespace");
Status = LkCrossReferenceNamespace ();
- UtEndEvent (i++);
- UtEndEvent (i++);
if (ACPI_FAILURE (Status))
{
return -1;
}
+ /* Namespace - Check for non-referenced objects */
+
+ LkFindUnreferencedObjects ();
+ UtEndEvent (AslGbl_NamespaceEvent);
+
/*
* Semantic analysis. This can happen only after the
* namespace has been loaded and cross-referenced.
*
* part one - check control methods
*/
- UtBeginEvent (i, "Analyze control method return types");
+ Event = UtBeginEvent ("Analyze control method return types");
AnalysisWalkInfo.MethodStack = NULL;
DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method analysis\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnMethodAnalysisWalkBegin,
- AnMethodAnalysisWalkEnd, &AnalysisWalkInfo);
- UtEndEvent (i++);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
+ AnMethodAnalysisWalkBegin,
+ AnMethodAnalysisWalkEnd, &AnalysisWalkInfo);
+ UtEndEvent (Event);
/* Semantic error checking part two - typing of method returns */
- UtBeginEvent (i, "Determine object types returned by methods");
- DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing \n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnMethodTypingWalkBegin,
- AnMethodTypingWalkEnd, NULL);
- UtEndEvent (i++);
+ Event = UtBeginEvent ("Determine object types returned by methods");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Method typing\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
+ AnMethodTypingWalkBegin,
+ AnMethodTypingWalkEnd, NULL);
+ UtEndEvent (Event);
/* Semantic error checking part three - operand type checking */
- UtBeginEvent (i, "Analyze AML operand types");
- DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking \n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnOperandTypecheckWalkBegin,
- AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
- UtEndEvent (i++);
+ Event = UtBeginEvent ("Analyze AML operand types");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - Operand type checking\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
+ AnOperandTypecheckWalkBegin,
+ AnOperandTypecheckWalkEnd, &AnalysisWalkInfo);
+ UtEndEvent (Event);
/* Semantic error checking part four - other miscellaneous checks */
- UtBeginEvent (i, "Miscellaneous analysis");
- DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous \n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE, AnOtherSemanticAnalysisWalkBegin,
- AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo);
- UtEndEvent (i++);
+ Event = UtBeginEvent ("Miscellaneous analysis");
+ DbgPrint (ASL_DEBUG_OUTPUT, "\nSemantic analysis - miscellaneous\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_TWICE,
+ AnOtherSemanticAnalysisWalkBegin,
+ AnOtherSemanticAnalysisWalkEnd, &AnalysisWalkInfo);
+ UtEndEvent (Event);
/* Calculate all AML package lengths */
- UtBeginEvent (i, "Finish AML package length generation");
+ Event = UtBeginEvent ("Finish AML package length generation");
DbgPrint (ASL_DEBUG_OUTPUT, "\nGenerating Package lengths\n\n");
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnInitLengthsWalk, NULL);
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL, LnPackageLengthWalk, NULL);
- UtEndEvent (i++);
-
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
+ LnInitLengthsWalk, NULL);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_UPWARD, NULL,
+ LnPackageLengthWalk, NULL);
+ UtEndEvent (Event);
/* Code generation - emit the AML */
- UtBeginEvent (i, "Generate AML code and write output files");
+ Event = UtBeginEvent ("Generate AML code and write output files");
CgGenerateAmlOutput ();
- UtEndEvent (i++);
+ UtEndEvent (Event);
- UtBeginEvent (i, "Write optional output files");
+ Event = UtBeginEvent ("Write optional output files");
CmDoOutputFiles ();
- UtEndEvent (i++);
+ UtEndEvent (Event);
- UtEndEvent (13);
+ UtEndEvent (FullCompile);
CmCleanupAndExit ();
return 0;
}
+
+/*******************************************************************************
+ *
+ * FUNCTION: CmDoOutputFiles
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Create all "listing" type files
+ *
+ ******************************************************************************/
+
void
-CmDoOutputFiles (void)
+CmDoOutputFiles (
+ void)
{
/* Create listings and hex files */
@@ -569,7 +775,51 @@
/* Dump the namespace to the .nsp file if requested */
- LsDisplayNamespace ();
+ (void) LsDisplayNamespace ();
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: CmDumpEvent
+ *
+ * PARAMETERS: Event - A compiler event struct
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Dump a compiler event struct
+ *
+ ******************************************************************************/
+
+static void
+CmDumpEvent (
+ ASL_EVENT_INFO *Event)
+{
+ UINT32 Delta;
+ UINT32 USec;
+ UINT32 MSec;
+
+ if (!Event->Valid)
+ {
+ return;
+ }
+
+ /* Delta will be in 100-nanosecond units */
+
+ Delta = (UINT32) (Event->EndTime - Event->StartTime);
+
+ USec = Delta / 10;
+ MSec = Delta / 10000;
+
+ /* Round milliseconds up */
+
+ if ((USec - (MSec * 1000)) >= 500)
+ {
+ MSec++;
+ }
+
+ DbgPrint (ASL_DEBUG_OUTPUT, "%8u usec %8u msec - %s\n",
+ USec, MSec, Event->EventName);
}
@@ -586,7 +836,8 @@
******************************************************************************/
void
-CmCleanupAndExit (void)
+CmCleanupAndExit (
+ void)
{
UINT32 i;
@@ -600,30 +851,19 @@
}
DbgPrint (ASL_DEBUG_OUTPUT, "\n\nElapsed time for major events\n\n");
- for (i = 0; i < 13; i++)
+ for (i = 0; i < AslGbl_NextEvent; i++)
{
- if (AslGbl_Events[i].Valid)
- {
- DbgPrint (ASL_DEBUG_OUTPUT, "%8lu ms - %s\n",
- AslGbl_Events[i].EndTime -
- AslGbl_Events[i].StartTime,
- AslGbl_Events[i].EventName);
- }
+ CmDumpEvent (&AslGbl_Events[i]);
}
if (Gbl_CompileTimesFlag)
{
printf ("\nElapsed time for major events\n\n");
- for (i = 0; i < 13; i++)
+ for (i = 0; i < AslGbl_NextEvent; i++)
{
- if (AslGbl_Events[i].Valid)
- {
- printf ("%8lu ms : %s\n",
- AslGbl_Events[i].EndTime -
- AslGbl_Events[i].StartTime,
- AslGbl_Events[i].EventName);
- }
+ CmDumpEvent (&AslGbl_Events[i]);
}
+
printf ("\nMiscellaneous compile statistics\n\n");
printf ("%11u : %s\n", TotalParseNodes, "Parse nodes");
printf ("%11u : %s\n", Gbl_NsLookupCount, "Namespace searches");
@@ -638,10 +878,12 @@
if (Gbl_NsLookupCount)
{
DbgPrint (ASL_DEBUG_OUTPUT, "\n\nMiscellaneous compile statistics\n\n");
- DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches", Gbl_NsLookupCount);
- DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Time per search",
- ((UINT32) (AslGbl_Events[7].EndTime - AslGbl_Events[7].StartTime) * 1000) /
- Gbl_NsLookupCount);
+ DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d\n", "Total Namespace searches",
+ Gbl_NsLookupCount);
+ DbgPrint (ASL_DEBUG_OUTPUT, "%32s : %d usec\n", "Time per search",
+ ((UINT32) (AslGbl_Events[AslGbl_NamespaceEvent].EndTime -
+ AslGbl_Events[AslGbl_NamespaceEvent].StartTime) /
+ 10) / Gbl_NsLookupCount);
}
/* Close all open files */
@@ -656,22 +898,31 @@
*/
if (!Gbl_SourceOutputFlag)
{
- unlink (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
+ remove (Gbl_Files[ASL_FILE_SOURCE_OUTPUT].Filename);
}
/* Delete AML file if there are errors */
if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
{
- unlink (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
+ remove (Gbl_Files[ASL_FILE_AML_OUTPUT].Filename);
}
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
- printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT);
+ printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
}
UtDisplaySummary (ASL_FILE_STDOUT);
+
+ /*
+ * Return non-zero exit code if there have been errors, unless the
+ * global ignore error flag has been set
+ */
+ if ((Gbl_ExceptionCount[ASL_ERROR] > 0) && (!Gbl_IgnoreErrors))
+ {
+ exit (1);
+ }
exit (0);
}
Index: asltransform.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/asltransform.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/asltransform.c -L sys/contrib/dev/acpica/compiler/asltransform.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/asltransform.c
+++ sys/contrib/dev/acpica/compiler/asltransform.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asltransform - Parse tree transforms
- * $Revision: 25 $
+ * $Revision: 1.42 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,66 +116,103 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asltransform")
+/* Local prototypes */
+
+static void
+TrTransformSubtree (
+ ACPI_PARSE_OBJECT *Op);
+
+static char *
+TrAmlGetNextTempName (
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 *TempCount);
+
+static void
+TrAmlInitLineNumbers (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *Neighbor);
+
+static void
+TrAmlInitNode (
+ ACPI_PARSE_OBJECT *Op,
+ UINT16 ParseOpcode);
+
+static void
+TrAmlSetSubtreeParent (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *Parent);
+
+static void
+TrAmlInsertPeer (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_PARSE_OBJECT *NewPeer);
+
+static void
+TrDoDefinitionBlock (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+TrDoSwitch (
+ ACPI_PARSE_OBJECT *StartNode);
+
/*******************************************************************************
*
* FUNCTION: TrAmlGetNextTempName
*
- * PARAMETERS: NamePath - Where a pointer to the temp name is returned
+ * PARAMETERS: Op - Current parse op
+ * TempCount - Current temporary counter. Was originally
+ * per-module; Currently per method, could be
+ * expanded to per-scope.
*
- * RETURN: A pointer to the second character of the name
+ * RETURN: A pointer to name (allocated here).
*
* DESCRIPTION: Generate an ACPI name of the form _T_x. These names are
- * reserved for use by the ASL compiler.
+ * reserved for use by the ASL compiler. (_T_0 through _T_Z)
*
******************************************************************************/
-char *
+static char *
TrAmlGetNextTempName (
- char **NamePath)
+ ACPI_PARSE_OBJECT *Op,
+ UINT8 *TempCount)
{
char *TempName;
- if (Gbl_TempCount > (9+26+26))
+ if (*TempCount >= (10+26)) /* 0-35 valid: 0-9 and A-Z for TempName[3] */
{
/* Too many temps */
- /* TBD: issue eror message */
- *NamePath = "ERROR";
- return ("Error");
+
+ AslError (ASL_ERROR, ASL_MSG_TOO_MANY_TEMPS, Op, NULL);
+ return (NULL);
}
- TempName = UtLocalCalloc (6);
+ TempName = UtLocalCalloc (5);
- if (Gbl_TempCount < 9)
- {
- TempName[4] = (char) (Gbl_TempCount + 0x30);
- }
- else if (Gbl_TempCount < (9 + 26))
+ if (*TempCount < 10) /* 0-9 */
{
- TempName[4] = (char) (Gbl_TempCount + 0x41);
+ TempName[3] = (char) (*TempCount + '0');
}
- else
+ else /* 10-35: A-Z */
{
- TempName[4] = (char) (Gbl_TempCount + 0x61);
+ TempName[3] = (char) (*TempCount + ('A' - 10));
}
- Gbl_TempCount++;
+ (*TempCount)++;
- /* First four characters are always "\_T_" */
+ /* First three characters are always "_T_" */
- TempName[0] = '\\';
- TempName[1] = '_';
- TempName[2] = 'T';
- TempName[3] = '_';
+ TempName[0] = '_';
+ TempName[1] = 'T';
+ TempName[2] = '_';
- *NamePath = TempName;
- return (&TempName[1]);
+ return (TempName);
}
@@ -183,7 +220,7 @@
*
* FUNCTION: TrAmlInitLineNumbers
*
- * PARAMETERS: Op - Op to be initialized
+ * PARAMETERS: Op - Op to be initialized
* Neighbor - Op used for initialization values
*
* RETURN: None
@@ -192,7 +229,7 @@
*
******************************************************************************/
-void
+static void
TrAmlInitLineNumbers (
ACPI_PARSE_OBJECT *Op,
ACPI_PARSE_OBJECT *Neighbor)
@@ -210,7 +247,7 @@
*
* FUNCTION: TrAmlInitNode
*
- * PARAMETERS: Op - Op to be initialized
+ * PARAMETERS: Op - Op to be initialized
* ParseOpcode - Opcode for this node
*
* RETURN: None
@@ -219,7 +256,7 @@
*
******************************************************************************/
-void
+static void
TrAmlInitNode (
ACPI_PARSE_OBJECT *Op,
UINT16 ParseOpcode)
@@ -234,7 +271,7 @@
*
* FUNCTION: TrAmlSetSubtreeParent
*
- * PARAMETERS: Op - First node in a list of peer nodes
+ * PARAMETERS: Op - First node in a list of peer nodes
* Parent - Parent of the subtree
*
* RETURN: None
@@ -243,7 +280,7 @@
*
******************************************************************************/
-void
+static void
TrAmlSetSubtreeParent (
ACPI_PARSE_OBJECT *Op,
ACPI_PARSE_OBJECT *Parent)
@@ -264,7 +301,7 @@
*
* FUNCTION: TrAmlInsertPeer
*
- * PARAMETERS: Op - First node in a list of peer nodes
+ * PARAMETERS: Op - First node in a list of peer nodes
* NewPeer - Peer node to insert
*
* RETURN: None
@@ -273,7 +310,7 @@
*
******************************************************************************/
-void
+static void
TrAmlInsertPeer (
ACPI_PARSE_OBJECT *Op,
ACPI_PARSE_OBJECT *NewPeer)
@@ -323,7 +360,7 @@
*
******************************************************************************/
-void
+static void
TrTransformSubtree (
ACPI_PARSE_OBJECT *Op)
{
@@ -343,6 +380,15 @@
TrDoSwitch (Op);
break;
+ case PARSEOP_METHOD:
+
+ /*
+ * TBD: Zero the tempname (_T_x) count. Probably shouldn't be a global,
+ * however
+ */
+ Gbl_TempCount = 0;
+ break;
+
default:
/* Nothing to do here for other opcodes */
break;
@@ -364,7 +410,7 @@
*
******************************************************************************/
-void
+static void
TrDoDefinitionBlock (
ACPI_PARSE_OBJECT *Op)
{
@@ -376,6 +422,18 @@
for (i = 0; i < 5; i++)
{
Next = Next->Asl.Next;
+ if (i == 0)
+ {
+ /*
+ * This is the table signature. Only the DSDT can be assumed
+ * to be at the root of the namespace; Therefore, namepath
+ * optimization can only be performed on the DSDT.
+ */
+ if (!ACPI_COMPARE_NAME (Next->Asl.Value.String, ACPI_SIG_DSDT))
+ {
+ Gbl_ReferenceOptimizationFlag = FALSE;
+ }
+ }
}
Gbl_FirstLevelInsertionNode = Next;
@@ -396,7 +454,7 @@
*
******************************************************************************/
-void
+static void
TrDoSwitch (
ACPI_PARSE_OBJECT *StartNode)
{
@@ -411,19 +469,43 @@
ACPI_PARSE_OBJECT *NewOp;
ACPI_PARSE_OBJECT *NewOp2;
char *PredicateValueName;
- char *PredicateValuePath;
+ UINT16 Index;
+ UINT32 Btype;
+
+ /* Start node is the Switch() node */
CurrentParentNode = StartNode;
- PredicateValueName = TrAmlGetNextTempName (&PredicateValuePath);
- /* First child is the predicate */
+ /* Create a new temp name of the form _T_x */
+
+ PredicateValueName = TrAmlGetNextTempName (StartNode, &Gbl_TempCount);
+ if (!PredicateValueName)
+ {
+ return;
+ }
+
+ /* First child is the Switch() predicate */
Next = StartNode->Asl.Child;
- Peer = Next->Asl.Next;
+
+ /*
+ * Examine the return type of the Switch Value -
+ * must be Integer/Buffer/String
+ */
+ Index = (UINT16) (Next->Asl.ParseOpcode - ASL_PARSE_OPCODE_BASE);
+ Btype = AslKeywordMapping[Index].AcpiBtype;
+ if ((Btype != ACPI_BTYPE_INTEGER) &&
+ (Btype != ACPI_BTYPE_STRING) &&
+ (Btype != ACPI_BTYPE_BUFFER))
+ {
+ AslError (ASL_WARNING, ASL_MSG_SWITCH_TYPE, Next, NULL);
+ Btype = ACPI_BTYPE_INTEGER;
+ }
/* CASE statements start at next child */
+ Peer = Next->Asl.Next;
while (Peer)
{
Next = Peer;
@@ -435,6 +517,10 @@
{
/* Add an ELSE to complete the previous CASE */
+ if (!Conditional)
+ {
+ return;
+ }
NewOp = TrCreateLeafNode (PARSEOP_ELSE);
NewOp->Asl.Parent = Conditional->Asl.Parent;
TrAmlInitLineNumbers (NewOp, NewOp->Asl.Parent);
@@ -451,14 +537,14 @@
Conditional->Asl.Child->Asl.Next = NULL;
Predicate = CaseOp->Asl.Child;
- if (Predicate->Asl.ParseOpcode == PARSEOP_PACKAGE)
+ if ((Predicate->Asl.ParseOpcode == PARSEOP_PACKAGE) ||
+ (Predicate->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE))
{
- AcpiOsPrintf ("Package\n");
-
/*
* Convert the package declaration to this form:
*
- * If (LNotEqual (Match (Package(){4}, MEQ, _Txx, MTR, 0, 0), Ones))
+ * If (LNotEqual (Match (Package(<size>){<data>},
+ * MEQ, _T_x, MTR, Zero, Zero), Ones))
*/
NewOp2 = TrCreateLeafNode (PARSEOP_MATCHTYPE_MEQ);
Predicate->Asl.Next = NewOp2;
@@ -466,7 +552,7 @@
NewOp = NewOp2;
NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
- (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValuePath));
+ (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
NewOp->Asl.Next = NewOp2;
TrAmlInitLineNumbers (NewOp2, Predicate);
@@ -514,21 +600,26 @@
else
{
/*
- * Change CaseOp() to: If (PredicateValue == CaseValue) {...}
+ * Integer and Buffer case.
+ *
+ * Change CaseOp() to: If (LEqual (SwitchValue, CaseValue)) {...}
+ * Note: SwitchValue is first to allow the CaseValue to be implicitly
+ * converted to the type of SwitchValue if necessary.
+ *
* CaseOp->Child is the case value
* CaseOp->Child->Peer is the beginning of the case block
*/
NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
- (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValuePath));
- Predicate->Asl.Next = NewOp;
+ (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
+ NewOp->Asl.Next = Predicate;
TrAmlInitLineNumbers (NewOp, Predicate);
NewOp2 = TrCreateLeafNode (PARSEOP_LEQUAL);
NewOp2->Asl.Parent = Conditional;
- NewOp2->Asl.Child = Predicate;
+ NewOp2->Asl.Child = NewOp;
TrAmlInitLineNumbers (NewOp2, Conditional);
- TrAmlSetSubtreeParent (Predicate, NewOp2);
+ TrAmlSetSubtreeParent (NewOp, NewOp2);
Predicate = NewOp2;
Predicate->Asl.Next = CaseBlock;
@@ -570,28 +661,28 @@
{
/*
* More than one Default
- * (Parser should catch this, should not get here)
+ * (Parser does not catch this, must check here)
*/
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Next,
- "Found more than one Default()");
+ AslError (ASL_ERROR, ASL_MSG_MULTIPLE_DEFAULT, Next, NULL);
}
+ else
+ {
+ /* Save the DEFAULT node for later, after CASEs */
- /* Save the DEFAULT node for later, after CASEs */
-
- DefaultOp = Next;
+ DefaultOp = Next;
+ }
}
else
{
/* Unknown peer opcode */
- printf ("Unknown parse opcode for switch statement: %s (%d)\n",
+ AcpiOsPrintf ("Unknown parse opcode for switch statement: %s (%d)\n",
Next->Asl.ParseOpName, Next->Asl.ParseOpcode);
}
}
- /*
- * Add the default case at the end of the if/else construct
- */
+ /* Add the default case at the end of the if/else construct */
+
if (DefaultOp)
{
/* If no CASE statements, this is an error - see below */
@@ -600,6 +691,10 @@
{
/* Convert the DEFAULT node to an ELSE */
+ if (!Conditional)
+ {
+ return;
+ }
TrAmlInitNode (DefaultOp, PARSEOP_ELSE);
DefaultOp->Asl.Parent = Conditional->Asl.Parent;
@@ -614,35 +709,96 @@
AslError (ASL_ERROR, ASL_MSG_NO_CASES, StartNode, NULL);
}
+
/*
- * Add a NAME node for the temp integer
+ * Create a Name(_T_x, ...) statement. This statement must appear at the
+ * method level, in case a loop surrounds the switch statement and could
+ * cause the name to be created twice (error).
*/
- NewOp = TrCreateLeafNode (PARSEOP_NAME);
- NewOp->Asl.Parent = Gbl_FirstLevelInsertionNode->Asl.Parent;
+
+ /* Create the Name node */
+
+ Predicate = StartNode->Asl.Child;
+ NewOp = TrCreateLeafNode (PARSEOP_NAME);
+
+ /* Find the parent method */
+
+ Next = StartNode;
+ while ((Next->Asl.ParseOpcode != PARSEOP_METHOD) &&
+ (Next->Asl.ParseOpcode != PARSEOP_DEFINITIONBLOCK))
+ {
+ Next = Next->Asl.Parent;
+ }
+
NewOp->Asl.CompileFlags |= NODE_COMPILER_EMITTED;
+ NewOp->Asl.Parent = Next;
+
+ /* Insert name after the method name and arguments */
+
+ Next = Next->Asl.Child;
+ Next = Next->Asl.Next;
+ Next = Next->Asl.Next;
+ Next = Next->Asl.Next;
+ Next = Next->Asl.Next;
+ Next = Next->Asl.Next;
+
+ TrAmlInsertPeer (Next, NewOp);
+ TrAmlInitLineNumbers (NewOp, Next);
- NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
- (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
+ /* Create the NameSeg child for the Name node */
+
+ NewOp2 = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
+ (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
+ NewOp2->Asl.CompileFlags |= NODE_IS_NAME_DECLARATION;
NewOp->Asl.Child = NewOp2;
- NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_INTEGER, (ACPI_INTEGER) 0);
- TrAmlSetSubtreeParent (NewOp2, NewOp);
+ /* Create the initial value for the Name. Btype was already validated above */
+
+ switch (Btype)
+ {
+ case ACPI_BTYPE_INTEGER:
+ NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_ZERO,
+ (ACPI_INTEGER) 0);
+ break;
- /* Insert this node at the global level of the ASL */
+ case ACPI_BTYPE_STRING:
+ NewOp2->Asl.Next = TrCreateValuedLeafNode (PARSEOP_STRING_LITERAL,
+ (ACPI_INTEGER) "");
+ break;
+
+ case ACPI_BTYPE_BUFFER:
+ (void) TrLinkPeerNode (NewOp2, TrCreateValuedLeafNode (PARSEOP_BUFFER,
+ (ACPI_INTEGER) 0));
+ Next = NewOp2->Asl.Next;
+ (void) TrLinkChildren (Next, 1, TrCreateValuedLeafNode (PARSEOP_ZERO,
+ (ACPI_INTEGER) 1));
+ (void) TrLinkPeerNode (Next->Asl.Child,
+ TrCreateValuedLeafNode (PARSEOP_DEFAULT_ARG, (ACPI_INTEGER) 0));
- TrAmlInsertPeer (Gbl_FirstLevelInsertionNode, NewOp);
- TrAmlInitLineNumbers (NewOp, Gbl_FirstLevelInsertionNode);
- TrAmlInitLineNumbers (NewOp2, Gbl_FirstLevelInsertionNode);
- TrAmlInitLineNumbers (NewOp2->Asl.Next, Gbl_FirstLevelInsertionNode);
+ TrAmlSetSubtreeParent (Next->Asl.Child, Next);
+ break;
+
+ default:
+ break;
+ }
+
+ TrAmlSetSubtreeParent (NewOp2, NewOp);
/*
- * Change the SWITCH node to a STORE (predicate value, _Txx)
+ * Transform the Switch() into a Store() node which will be used to save the
+ * Switch() value. The store is of the form: Store (Value, _T_x)
+ * where _T_x is the temp variable.
*/
TrAmlInitNode (StartNode, PARSEOP_STORE);
+ StartNode->Asl.Child = NULL;
+
+ /* Complete the Store subtree */
+
+ StartNode->Asl.Child = Predicate;
+ Predicate->Asl.Parent = StartNode;
- Predicate = StartNode->Asl.Child;
- NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESTRING,
- (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValuePath));
+ NewOp = TrCreateValuedLeafNode (PARSEOP_NAMESEG,
+ (ACPI_INTEGER) ACPI_TO_INTEGER (PredicateValueName));
NewOp->Asl.Parent = StartNode;
Predicate->Asl.Next = NewOp;
}
Index: aslcompiler.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslcompiler.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslcompiler.h -L sys/contrib/dev/acpica/compiler/aslcompiler.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslcompiler.h
+++ sys/contrib/dev/acpica/compiler/aslcompiler.h
@@ -1,8 +1,8 @@
/******************************************************************************
*
- * Module Name: aslcompiler.h - common include file
- * $Revision: 130 $
+ * Module Name: aslcompiler.h - common include file for iASL
+ * $Revision: 1.148 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -139,84 +139,15 @@
#include <ctype.h>
-#include "acpi.h"
-#include "amlresrc.h"
-#include "acdebug.h"
-#include "asltypes.h"
-#include "aslglobal.h"
-
-
-/*
- * Compiler versions and names
- */
-
-#define CompilerCreatorRevision ACPI_CA_VERSION
-
-#define IntelAcpiCA "Intel ACPI Component Architecture"
-#define CompilerId "ASL Optimizing Compiler / AML Disassembler"
-#define CompilerCopyright "Copyright (C) 2000 - 2004 Intel Corporation"
-#define CompilerCompliance "ACPI 2.0c"
-#define CompilerName "iasl"
-#define CompilerCreatorId "INTL"
-
-
-/* Configuration constants */
-
-#define ASL_MAX_ERROR_COUNT 200
-#define ASL_NODE_CACHE_SIZE 1024
-#define ASL_STRING_CACHE_SIZE 32768
-
-#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS
-#define ASL_YYTNAME_START 3
-
-/*
- * Macros
- */
-
-#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (ASL_RESOURCE_DESC, m)
-#define ASL_PTR_DIFF(a,b) ((UINT8 *)(b) - (UINT8 *)(a))
-#define ASL_PTR_ADD(a,b) ((UINT8 *)(a) = ((UINT8 *)(a) + (b)))
-#define ASL_GET_CHILD_NODE(a) (a)->Asl.Child
-#define ASL_GET_PEER_NODE(a) (a)->Asl.Next
-#define OP_TABLE_ENTRY(a,b,c,d) {b,d,a,c}
-
-
-#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */
-
-
-/* Internal AML opcodes */
-
-#define AML_RAW_DATA_BYTE (UINT16) 0xAA01 /* write one raw byte */
-#define AML_RAW_DATA_WORD (UINT16) 0xAA02 /* write 2 raw bytes */
-#define AML_RAW_DATA_DWORD (UINT16) 0xAA04 /* write 4 raw bytes */
-#define AML_RAW_DATA_QWORD (UINT16) 0xAA08 /* write 8 raw bytes */
-#define AML_RAW_DATA_BUFFER (UINT16) 0xAA0B /* raw buffer with length */
-#define AML_RAW_DATA_CHAIN (UINT16) 0xAA0C /* chain of raw buffers */
-#define AML_PACKAGE_LENGTH (UINT16) 0xAA10
-#define AML_UNASSIGNED_OPCODE (UINT16) 0xEEEE
-#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD
-
-
-/* filename suffixes for output files */
-
-#define FILE_SUFFIX_AML_CODE "aml"
-#define FILE_SUFFIX_LISTING "lst"
-#define FILE_SUFFIX_HEX_DUMP "hex"
-#define FILE_SUFFIX_DEBUG "txt"
-#define FILE_SUFFIX_SOURCE "src"
-#define FILE_SUFFIX_NAMESPACE "nsp"
-#define FILE_SUFFIX_ASM_SOURCE "asm"
-#define FILE_SUFFIX_C_SOURCE "c"
-#define FILE_SUFFIX_DISASSEMBLY "dsl"
-#define FILE_SUFFIX_ASM_INCLUDE "inc"
-#define FILE_SUFFIX_C_INCLUDE "h"
-
-
-/* Misc */
-
-#define ASL_EXTERNAL_METHOD 255
-#define ASL_ABORT TRUE
-#define ASL_NO_ABORT FALSE
+#include <contrib/dev/acpica/acpi.h>
+#include <contrib/dev/acpica/amlresrc.h>
+#include <contrib/dev/acpica/acdebug.h>
+
+/* Compiler headers */
+
+#include <contrib/dev/acpica/compiler/asldefine.h>
+#include <contrib/dev/acpica/compiler/asltypes.h>
+#include <contrib/dev/acpica/compiler/aslglobal.h>
/*******************************************************************************
@@ -225,13 +156,9 @@
*
******************************************************************************/
-
-void
-end_stmt (void);
-
-
-/* parser */
-
+/*
+ * parser - generated from flex/bison, lex/yacc, etc.
+ */
int
AslCompilerparse(
void);
@@ -241,10 +168,6 @@
void);
int
-AslCompilererror(
- char *s);
-
-int
AslCompilerlex(
void);
@@ -265,8 +188,10 @@
FILE *InputFile,
char *Filename);
-/* aslmain */
+/*
+ * aslcompile - compile mainline
+ */
void
AslCompilerSignon (
UINT32 FileId);
@@ -275,38 +200,74 @@
AslCompilerFileHeader (
UINT32 FileId);
+int
+CmDoCompile (
+ void);
+
void
-AslDoSourceOutputFile (
- char *Buffer);
+CmDoOutputFiles (
+ void);
-#define ASL_DEBUG_OUTPUT 0
-#define ASL_PARSE_OUTPUT 1
-#define ASL_TREE_OUTPUT 2
+void
+CmCleanupAndExit (
+ void);
-void
-DbgPrint (
- UINT32 Type,
- char *Format,
- ...);
+/*
+ * aslanalyze - semantic analysis
+ */
+ACPI_STATUS
+AnOtherSemanticAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
-void
-ErrorContext (void);
+ACPI_STATUS
+AnOtherSemanticAnalysisWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
-/* aslcompile */
+ACPI_STATUS
+AnOperandTypecheckWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
-int
-CmDoCompile (void);
+ACPI_STATUS
+AnOperandTypecheckWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
-void
-CmDoOutputFiles (void);
+ACPI_STATUS
+AnMethodAnalysisWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
-void
-CmCleanupAndExit (void);
+ACPI_STATUS
+AnMethodAnalysisWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+ACPI_STATUS
+AnMethodTypingWalkBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+ACPI_STATUS
+AnMethodTypingWalkEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
-/* aslerror */
+/*
+ * aslerror - error handling/reporting
+ */
void
AslError (
UINT8 Level,
@@ -321,6 +282,10 @@
char *ExtraMessage,
BOOLEAN Abort);
+int
+AslCompilererror(
+ char *s);
+
void
AslCommonError (
UINT8 Level,
@@ -342,24 +307,17 @@
AePrintErrorLog (
UINT32 FileId);
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
- UINT32 Flags,
- ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress);
-
+ void);
-/* asllisting */
-
-void
-LsWriteListingHexBytes (
- UINT8 *Buffer,
- UINT32 Length,
- UINT32 FileId);
+/*
+ * asllisting - generate all "listing" type files
+ */
void
-LsWriteNodeToListing (
- ACPI_PARSE_OBJECT *Op,
- UINT32 FileId);
+LsDoListings (
+ void);
void
LsWriteNodeToAsmListing (
@@ -371,38 +329,26 @@
UINT32 FileId);
void
-LsFinishSourceListing (
- UINT32 FileId);
-
-void
-LsFlushListingBuffer (
- UINT32 FileId);
-
-void
LsDoHexOutput (
void);
void
-LsDoHexOutputC (
+LsDumpParseTree (
void);
-void
-LsDoHexOutputAsm (
- void);
-
-void
-LsPushNode (
- char *Filename);
-
-ASL_LISTING_NODE *
-LsPopNode (
- void);
+/*
+ * aslfold - constant folding
+ */
+ACPI_STATUS
+OpcAmlConstantWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
/*
* aslopcodes - generate AML opcodes
*/
-
ACPI_STATUS
OpcAmlOpcodeWalk (
ACPI_PARSE_OBJECT *Op,
@@ -410,7 +356,7 @@
void *Context);
ACPI_STATUS
-OpcAmlConstantWalk (
+OpcAmlOpcodeUpdateWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
void *Context);
@@ -427,59 +373,27 @@
OpcGetIntegerWidth (
ACPI_PARSE_OBJECT *Op);
+
/*
* asloperands - generate AML operands for the AML opcodes
*/
+ACPI_PARSE_OBJECT *
+UtGetArg (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Argn);
void
OpnGenerateAmlOperands (
ACPI_PARSE_OBJECT *Op);
void
-OpnDoField (
- ACPI_PARSE_OBJECT *Op);
-
-void
-OpnDoBankField (
- ACPI_PARSE_OBJECT *Op);
-
-void
-OpnDoBuffer (
- ACPI_PARSE_OBJECT *Op);
-
-void
-OpnDoDefinitionBlock (
- ACPI_PARSE_OBJECT *Op);
-
-void
-OpnDoFieldCommon (
- ACPI_PARSE_OBJECT *FieldOp,
- ACPI_PARSE_OBJECT *Op);
-
-void
-OpnDoIndexField (
- ACPI_PARSE_OBJECT *Op);
-
-void
-OpnDoLoadTable (
- ACPI_PARSE_OBJECT *Op);
-
-void
-OpnDoMethod (
- ACPI_PARSE_OBJECT *Op);
-
-void
OpnDoPackage (
ACPI_PARSE_OBJECT *Op);
-void
-OpnDoRegion (
- ACPI_PARSE_OBJECT *Op);
/*
* aslopt - optmization
*/
-
void
OptOptimizeNamePath (
ACPI_PARSE_OBJECT *Op,
@@ -490,35 +404,16 @@
/*
- * aslresource - resource template generation
+ * aslcodegen - code generation
*/
-
-void
-RsDoResourceTemplate (
- ACPI_PARSE_OBJECT *Op);
-
-
-void
-CgGenerateAmlOutput (void);
-
-void
-CgGenerateListing (
- UINT32 FileId);
-
void
-LsDoListings (void);
-
-void
-CgGenerateAmlLengths (
- ACPI_PARSE_OBJECT *Op);
-
-ACPI_STATUS
-CgOpenOutputFile (
- char *InputFilename);
-
+CgGenerateAmlOutput (
+ void);
-/* asllength */
+/*
+ * asllength - calculate/adjust AML package lengths
+ */
ACPI_STATUS
LnPackageLengthWalk (
ACPI_PARSE_OBJECT *Op,
@@ -531,37 +426,26 @@
UINT32 Level,
void *Context);
-
-ACPI_STATUS
-CgAmlWriteWalk (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-void
-CgGenerateOutput(
- void);
-
-void
-CgCloseTable (void);
-
-
void
-CgWriteNode (
+CgGenerateAmlLengths (
ACPI_PARSE_OBJECT *Op);
+
/*
- * aslmap
+ * aslmap - opcode mappings and reserved method names
*/
-
ACPI_OBJECT_TYPE
AslMapNamedOpcodeToDataType (
UINT16 Opcode);
+void
+MpDisplayReservedNames (
+ void);
+
+
/*
* asltransform - parse tree transformations
*/
-
ACPI_STATUS
TrAmlTransformWalk (
ACPI_PARSE_OBJECT *Op,
@@ -569,22 +453,9 @@
void *Context);
-void
-TrTransformSubtree (
- ACPI_PARSE_OBJECT *Op);
-
-void
-TrDoSwitch (
- ACPI_PARSE_OBJECT *Op);
-
-void
-TrDoDefinitionBlock (
- ACPI_PARSE_OBJECT *Op);
-
/*
* asltree - parse tree support
*/
-
ACPI_STATUS
TrWalkParseTree (
ACPI_PARSE_OBJECT *Op,
@@ -593,11 +464,6 @@
ASL_WALK_CALLBACK AscendingCallback,
void *Context);
-ACPI_PARSE_OBJECT *
-TrAllocateNode (
- UINT32 ParseOpcode);
-
-
/* Values for "Visitation" parameter above */
#define ASL_WALK_VISIT_DOWNWARD 0x01
@@ -605,9 +471,13 @@
#define ASL_WALK_VISIT_TWICE (ASL_WALK_VISIT_DOWNWARD | ASL_WALK_VISIT_UPWARD)
-char *
-TrAddNode (
- void *Thing);
+ACPI_PARSE_OBJECT *
+TrAllocateNode (
+ UINT32 ParseOpcode);
+
+void
+TrReleaseNode (
+ ACPI_PARSE_OBJECT *Op);
ACPI_PARSE_OBJECT *
TrUpdateNode (
@@ -640,7 +510,8 @@
ACPI_PARSE_OBJECT *Op);
void
-TrWalkTree (void);
+TrWalkTree (
+ void);
ACPI_PARSE_OBJECT *
TrLinkPeerNode (
@@ -662,72 +533,13 @@
UINT32 NumPeers,
...);
-void
-TrReleaseNode (
- ACPI_PARSE_OBJECT *Op);
-
-/* Analyze */
-
-ACPI_STATUS
-AnOtherSemanticAnalysisWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-AnOtherSemanticAnalysisWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-AnOperandTypecheckWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-AnOperandTypecheckWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-AnMethodAnalysisWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-AnMethodAnalysisWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-AnMethodTypingWalkBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-AnMethodTypingWalkEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
/*
* aslfiles - File I/O support
*/
-
void
-AslAbort (void);
-
-FILE *
-FlOpenLocalFile (
- char *LocalName,
- char *Mode);
+AslAbort (
+ void);
void
FlOpenIncludeFile (
@@ -738,12 +550,6 @@
UINT32 FileId,
UINT8 ErrorId);
-void
-FlOpenFile (
- UINT32 FileId,
- char *Filename,
- char *Mode);
-
ACPI_STATUS
FlReadFile (
UINT32 FileId,
@@ -776,10 +582,6 @@
ACPI_PARSE_OBJECT *Op);
ACPI_STATUS
-FlParseInputPathname (
- char *InputFilename);
-
-ACPI_STATUS
FlOpenInputFile (
char *InputFilename);
@@ -791,74 +593,57 @@
FlOpenMiscOutputFiles (
char *InputFilename);
-void
-MpDisplayReservedNames (
- void);
-
-
-/* Load */
+/*
+ * asload - load namespace in prep for cross reference
+ */
ACPI_STATUS
LdLoadNamespace (
ACPI_PARSE_OBJECT *RootOp);
+/*
+ * asllookup - namespace cross reference
+ */
ACPI_STATUS
-LdNamespace1Begin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-ACPI_STATUS
-LdNamespace1End (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
-
-
-/* Lookup */
-
-ACPI_STATUS
-LkCrossReferenceNamespace (void);
-
-ACPI_STATUS
-LkNamespaceLocateBegin (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
+LkCrossReferenceNamespace (
+ void);
-ACPI_STATUS
-LkNamespaceLocateEnd (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Level,
- void *Context);
+void
+LkFindUnreferencedObjects (
+ void);
ACPI_STATUS
LsDisplayNamespace (
void);
-ACPI_STATUS
-LsCompareOneNamespaceObject (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Context,
- void **ReturnValue);
+/*
+ * aslutils - common compiler utilites
+ */
+void
+DbgPrint (
+ UINT32 Type,
+ char *Format,
+ ...);
-/* Utils */
+/* Type values for above */
+
+#define ASL_DEBUG_OUTPUT 0
+#define ASL_PARSE_OUTPUT 1
+#define ASL_TREE_OUTPUT 2
void
UtDisplayConstantOpcodes (
void);
-void
+UINT8
UtBeginEvent (
- UINT32 Event,
char *Name);
void
UtEndEvent (
- UINT32 Event);
+ UINT8 Event);
void *
UtLocalCalloc (
@@ -875,7 +660,7 @@
UINT8
UtHexCharToValue (
- int hc);
+ int HexChar);
void
UtConvertByteToHex (
@@ -895,11 +680,6 @@
UtSetParseOpName (
ACPI_PARSE_OBJECT *Op);
-ACPI_PARSE_OBJECT *
-UtGetArg (
- ACPI_PARSE_OBJECT *Op,
- UINT32 Argn);
-
char *
UtGetStringBuffer (
UINT32 Length);
@@ -920,39 +700,19 @@
UINT32 LowValue,
UINT32 HighValue);
-ACPI_STATUS
-UtStrtoul64 (
- char *String,
- UINT32 Base,
- ACPI_INTEGER *RetInteger);
-
ACPI_INTEGER
UtDoConstant (
char *String);
-/* Find */
-
-void
-LnAdjustLengthToRoot (
- ACPI_PARSE_OBJECT *Op,
- UINT32 LengthDelta);
-
-
-#define NEXT_RESOURCE_DESC(a,b) (ASL_RESOURCE_DESC *) (((char *) (a)) + sizeof(b))
-
-#define DEFAULT_RESOURCE_DESC_SIZE (sizeof (ASL_RESOURCE_DESC) + sizeof (ASL_END_TAG_DESC))
-
-
/*
- * Resource utilities
+ * aslresource - Resource template generation utilities
*/
-
ASL_RESOURCE_NODE *
RsAllocateResourceNode (
UINT32 Size);
- void
+void
RsCreateBitField (
ACPI_PARSE_OBJECT *Op,
char *Name,
@@ -976,12 +736,18 @@
RsCompleteNodeAndGetNext (
ACPI_PARSE_OBJECT *Op);
+void
+RsCheckListForDuplicates (
+ ACPI_PARSE_OBJECT *Op);
+
ASL_RESOURCE_NODE *
RsDoOneResourceDescriptor (
ACPI_PARSE_OBJECT *DescriptorTypeOp,
UINT32 CurrentByteOffset,
UINT8 *State);
+/* Values for State above */
+
#define ACPI_RSTATE_NORMAL 0
#define ACPI_RSTATE_START_DEPENDENT 1
#define ACPI_RSTATE_DEPENDENT_LIST 2
@@ -991,28 +757,31 @@
ASL_RESOURCE_NODE **PreviousRnode,
ASL_RESOURCE_NODE *Rnode);
+void
+RsDoResourceTemplate (
+ ACPI_PARSE_OBJECT *Op);
+
/*
- * Small descriptors
+ * aslrestype1 - generate Small descriptors
*/
-
ASL_RESOURCE_NODE *
-RsDoDmaDescriptor (
+RsDoEndTagDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoEndDependentDescriptor (
+RsDoDmaDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoFixedIoDescriptor (
+RsDoEndDependentDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoInterruptDescriptor (
+RsDoFixedIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
@@ -1063,12 +832,12 @@
/*
- * Large descriptors
+ * aslrestype2 - generate Large descriptors
*/
-
-UINT32
-RsGetStringDataLength (
- ACPI_PARSE_OBJECT *InitializerOp);
+ASL_RESOURCE_NODE *
+RsDoInterruptDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
RsDoDwordIoDescriptor (
@@ -1081,6 +850,26 @@
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
+RsDoDwordSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoExtendedIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoExtendedMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoExtendedSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
RsDoQwordIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
@@ -1091,11 +880,21 @@
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
+RsDoQwordSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
RsDoWordIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
+RsDoWordSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
RsDoWordBusNumberDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
@@ -1110,6 +909,5 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
-
#endif /* __ASLCOMPILER_H */
--- /dev/null
+++ sys/contrib/dev/acpica/compiler/asldefine.h
@@ -0,0 +1,211 @@
+
+/******************************************************************************
+ *
+ * Module Name: asldefine.h - Common defines for the iASL compiler
+ * $Revision: 1.7 $
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
+ * All rights reserved.
+ *
+ * 2. License
+ *
+ * 2.1. This is your license from Intel Corp. under its intellectual property
+ * rights. You may have additional license terms from the party that provided
+ * you this software, covering your right to use that party's intellectual
+ * property rights.
+ *
+ * 2.2. Intel grants, free of charge, to any person ("Licensee") obtaining a
+ * copy of the source code appearing in this file ("Covered Code") an
+ * irrevocable, perpetual, worldwide license under Intel's copyrights in the
+ * base code distributed originally by Intel ("Original Intel Code") to copy,
+ * make derivatives, distribute, use and display any portion of the Covered
+ * Code in any form, with the right to sublicense such rights; and
+ *
+ * 2.3. Intel grants Licensee a non-exclusive and non-transferable patent
+ * license (with the right to sublicense), under only those claims of Intel
+ * patents that are infringed by the Original Intel Code, to make, use, sell,
+ * offer to sell, and import the Covered Code and derivative works thereof
+ * solely to the minimum extent necessary to exercise the above copyright
+ * license, and in no event shall the patent license extend to any additions
+ * to or modifications of the Original Intel Code. No other license or right
+ * is granted directly or by implication, estoppel or otherwise;
+ *
+ * The above copyright and patent license is granted only if the following
+ * conditions are met:
+ *
+ * 3. Conditions
+ *
+ * 3.1. Redistribution of Source with Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification with rights to further distribute source must include
+ * the above Copyright Notice, the above License, this list of Conditions,
+ * and the following Disclaimer and Export Compliance provision. In addition,
+ * Licensee must cause all Covered Code to which Licensee contributes to
+ * contain a file documenting the changes Licensee made to create that Covered
+ * Code and the date of any change. Licensee must include in that file the
+ * documentation of any changes made by any predecessor Licensee. Licensee
+ * must include a prominent statement that the modification is derived,
+ * directly or indirectly, from Original Intel Code.
+ *
+ * 3.2. Redistribution of Source with no Rights to Further Distribute Source.
+ * Redistribution of source code of any substantial portion of the Covered
+ * Code or modification without rights to further distribute source must
+ * include the following Disclaimer and Export Compliance provision in the
+ * documentation and/or other materials provided with distribution. In
+ * addition, Licensee may not authorize further sublicense of source of any
+ * portion of the Covered Code, and must include terms to the effect that the
+ * license from Licensee to its licensee is limited to the intellectual
+ * property embodied in the software Licensee provides to its licensee, and
+ * not to intellectual property embodied in modifications its licensee may
+ * make.
+ *
+ * 3.3. Redistribution of Executable. Redistribution in executable form of any
+ * substantial portion of the Covered Code or modification must reproduce the
+ * above Copyright Notice, and the following Disclaimer and Export Compliance
+ * provision in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * 3.4. Intel retains all right, title, and interest in and to the Original
+ * Intel Code.
+ *
+ * 3.5. Neither the name Intel nor any other trademark owned or controlled by
+ * Intel shall be used in advertising or otherwise to promote the sale, use or
+ * other dealings in products derived from or relating to the Covered Code
+ * without prior written authorization from Intel.
+ *
+ * 4. Disclaimer and Export Compliance
+ *
+ * 4.1. INTEL MAKES NO WARRANTY OF ANY KIND REGARDING ANY SOFTWARE PROVIDED
+ * HERE. ANY SOFTWARE ORIGINATING FROM INTEL OR DERIVED FROM INTEL SOFTWARE
+ * IS PROVIDED "AS IS," AND INTEL WILL NOT PROVIDE ANY SUPPORT, ASSISTANCE,
+ * INSTALLATION, TRAINING OR OTHER SERVICES. INTEL WILL NOT PROVIDE ANY
+ * UPDATES, ENHANCEMENTS OR EXTENSIONS. INTEL SPECIFICALLY DISCLAIMS ANY
+ * IMPLIED WARRANTIES OF MERCHANTABILITY, NONINFRINGEMENT AND FITNESS FOR A
+ * PARTICULAR PURPOSE.
+ *
+ * 4.2. IN NO EVENT SHALL INTEL HAVE ANY LIABILITY TO LICENSEE, ITS LICENSEES
+ * OR ANY OTHER THIRD PARTY, FOR ANY LOST PROFITS, LOST DATA, LOSS OF USE OR
+ * COSTS OF PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY INDIRECT,
+ * SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THIS AGREEMENT, UNDER ANY
+ * CAUSE OF ACTION OR THEORY OF LIABILITY, AND IRRESPECTIVE OF WHETHER INTEL
+ * HAS ADVANCE NOTICE OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS
+ * SHALL APPLY NOTWITHSTANDING THE FAILURE OF THE ESSENTIAL PURPOSE OF ANY
+ * LIMITED REMEDY.
+ *
+ * 4.3. Licensee shall not export, either directly or indirectly, any of this
+ * software or system incorporating such software without first obtaining any
+ * required license or other approval from the U. S. Department of Commerce or
+ * any other agency or department of the United States Government. In the
+ * event Licensee exports any such software from the United States or
+ * re-exports any such software from a foreign destination, Licensee shall
+ * ensure that the distribution and export/re-export of the software is in
+ * compliance with all laws, regulations, orders, or other restrictions of the
+ * U.S. Export Administration Regulations. Licensee agrees that neither it nor
+ * any of its subsidiaries will export/re-export any technical data, process,
+ * software, or service, directly or indirectly, to any country for which the
+ * United States government or any agency thereof requires an export license,
+ * other governmental approval, or letter of assurance, without first obtaining
+ * such license, approval or letter.
+ *
+ *****************************************************************************/
+
+
+#ifndef __ASLDEFINE_H
+#define __ASLDEFINE_H
+
+
+/*
+ * Compiler versions and names
+ */
+#define CompilerCreatorRevision ACPI_CA_VERSION
+
+#define IntelAcpiCA "Intel ACPI Component Architecture"
+#define CompilerId "ASL Optimizing Compiler"
+#define DisassemblerId "AML Disassembler"
+#define CompilerCopyright "Copyright (C) 2000 - 2007 Intel Corporation"
+#define CompilerCompliance "Supports ACPI Specification Revision 3.0a"
+#define CompilerName "iasl"
+#define CompilerCreatorId "INTL"
+
+
+/* Configuration constants */
+
+#define ASL_MAX_ERROR_COUNT 200
+#define ASL_NODE_CACHE_SIZE 1024
+#define ASL_STRING_CACHE_SIZE 32768
+
+#define ASL_FIRST_PARSE_OPCODE PARSEOP_ACCESSAS
+#define ASL_YYTNAME_START 3
+
+#define ASL_PARSE_OPCODE_BASE PARSEOP_ACCESSAS /* First Lex type */
+
+
+/*
+ * Macros
+ */
+#define ASL_RESDESC_OFFSET(m) ACPI_OFFSET (AML_RESOURCE, m)
+#define ASL_PTR_DIFF(a,b) ((UINT8 *)(b) - (UINT8 *)(a))
+#define ASL_PTR_ADD(a,b) ((UINT8 *)(a) = ((UINT8 *)(a) + (b)))
+#define ASL_GET_CHILD_NODE(a) (a)->Asl.Child
+#define ASL_GET_PEER_NODE(a) (a)->Asl.Next
+#define OP_TABLE_ENTRY(a,b,c,d) {b,d,a,c}
+
+
+/* Internal AML opcodes */
+
+#define AML_RAW_DATA_BYTE (UINT16) 0xAA01 /* write one raw byte */
+#define AML_RAW_DATA_WORD (UINT16) 0xAA02 /* write 2 raw bytes */
+#define AML_RAW_DATA_DWORD (UINT16) 0xAA04 /* write 4 raw bytes */
+#define AML_RAW_DATA_QWORD (UINT16) 0xAA08 /* write 8 raw bytes */
+#define AML_RAW_DATA_BUFFER (UINT16) 0xAA0B /* raw buffer with length */
+#define AML_RAW_DATA_CHAIN (UINT16) 0xAA0C /* chain of raw buffers */
+#define AML_PACKAGE_LENGTH (UINT16) 0xAA10
+#define AML_UNASSIGNED_OPCODE (UINT16) 0xEEEE
+#define AML_DEFAULT_ARG_OP (UINT16) 0xDDDD
+
+
+/* filename suffixes for output files */
+
+#define FILE_SUFFIX_AML_CODE "aml"
+#define FILE_SUFFIX_LISTING "lst"
+#define FILE_SUFFIX_HEX_DUMP "hex"
+#define FILE_SUFFIX_DEBUG "txt"
+#define FILE_SUFFIX_SOURCE "src"
+#define FILE_SUFFIX_NAMESPACE "nsp"
+#define FILE_SUFFIX_ASM_SOURCE "asm"
+#define FILE_SUFFIX_C_SOURCE "c"
+#define FILE_SUFFIX_DISASSEMBLY "dsl"
+#define FILE_SUFFIX_ASM_INCLUDE "inc"
+#define FILE_SUFFIX_C_INCLUDE "h"
+
+
+/* Misc */
+
+#define ASL_EXTERNAL_METHOD 255
+#define ASL_ABORT TRUE
+#define ASL_NO_ABORT FALSE
+
+
+/* Support for reserved method names */
+
+#define ACPI_VALID_RESERVED_NAME_MAX 0x80000000
+#define ACPI_NOT_RESERVED_NAME ACPI_UINT32_MAX
+#define ACPI_PREDEFINED_NAME (ACPI_UINT32_MAX - 1)
+#define ACPI_EVENT_RESERVED_NAME (ACPI_UINT32_MAX - 2)
+#define ACPI_COMPILER_RESERVED_NAME (ACPI_UINT32_MAX - 3)
+
+
+/* String to Integer conversion */
+
+#define NEGATIVE 1
+#define POSITIVE 0
+
+
+#endif /* ASLDEFINE.H */
+
Index: aslstubs.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslstubs.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslstubs.c -L sys/contrib/dev/acpica/compiler/aslstubs.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslstubs.c
+++ sys/contrib/dev/acpica/compiler/aslstubs.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslstubs - Stubs used to link to Aml interpreter
- * $Revision: 13 $
+ * $Revision: 1.20 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,9 +116,9 @@
*****************************************************************************/
#include <stdio.h>
-#include "aslcompiler.h"
-#include "acdispat.h"
-#include "actables.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/actables.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslstubs")
@@ -129,12 +129,19 @@
* Things like Events, Global Lock, etc. are not used
* by the compiler, so they are stubbed out here.
*/
-ACPI_STATUS
+ACPI_PHYSICAL_ADDRESS
AeLocalGetRootPointer (
- UINT32 Flags,
- ACPI_PHYSICAL_ADDRESS *RsdpPhysicalAddress)
+ void)
+{
+ return 0;
+}
+
+ACPI_STATUS
+AcpiDsMethodError (
+ ACPI_STATUS Status,
+ ACPI_WALK_STATE *WalkState)
{
- return AE_ERROR;
+ return (Status);
}
ACPI_STATUS
@@ -266,7 +273,7 @@
char *Signature,
char *OemId,
char *OemTableId,
- ACPI_TABLE_HEADER **TablePtr)
+ ACPI_NATIVE_UINT *TableIndex)
{
return (AE_SUPPORT);
}
Index: aslrestype2.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslrestype2.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslrestype2.c -L sys/contrib/dev/acpica/compiler/aslrestype2.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslrestype2.c
+++ sys/contrib/dev/acpica/compiler/aslrestype2.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslrestype2 - Long (type2) resource templates and descriptors
- * $Revision: 26 $
+ * $Revision: 1.51 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,12 +116,18 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslrestype2")
+/* Local prototypes */
+
+static UINT16
+RsGetStringDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp);
+
/*******************************************************************************
*
@@ -129,14 +135,14 @@
*
* PARAMETERS: InitializerOp - Start of a subtree of init nodes
*
- * RETURN: Valid string length if a string node is found
+ * RETURN: Valid string length if a string node is found (otherwise 0)
*
* DESCRIPTION: In a list of peer nodes, find the first one that contains a
* string and return the length of the string.
*
******************************************************************************/
-UINT32
+static UINT16
RsGetStringDataLength (
ACPI_PARSE_OBJECT *InitializerOp)
{
@@ -145,7 +151,7 @@
{
if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
{
- return (strlen (InitializerOp->Asl.Value.String) + 1);
+ return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1));
}
InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
}
@@ -173,113 +179,1211 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 StringLength = 0;
+ UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
+ UINT8 *OptionalFields;
UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
- StringLength);
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
Descriptor = Rnode->Buffer;
- Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
- Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
+ Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
+ Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
- Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Das.ResourceType));
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
+ Descriptor->Address32.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS32) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
+ break;
+
+ case 2: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
+ break;
+
+ case 4: /* Range Type */
+
+ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
+ break;
+
+ case 5: /* Address Granularity */
+
+ Descriptor->Address32.Granularity =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->Address32.Minimum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->Address32.Maximum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
+ break;
+
+ case 8: /* Translation Offset */
+
+ Descriptor->Address32.TranslationOffset =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
+ break;
+
+ case 9: /* Address Length */
+
+ Descriptor->Address32.AddressLength =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
+ break;
+
+ case 10: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ /* Found a valid ResourceSourceIndex */
+
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address32.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 11: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ /* Found a valid ResourceSource */
+
+ Descriptor->Address32.ResourceLength = (UINT16)
+ (Descriptor->Address32.ResourceLength + StringLength);
+
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
+ }
+ }
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
+ break;
+
+ case 12: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ case 13: /* Type */
+
+ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 4);
+ break;
+
+ case 14: /* Translation Type */
+
+ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoDwordMemoryDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "DwordMemory" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoDwordMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
+ Descriptor->Address32.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
/*
- * Process all child initialization nodes
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
*/
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
+ Descriptor->Address32.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS32) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
+ break;
+
+ case 2: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
+ break;
+
+ case 3: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
+ break;
+
+ case 4: /* Memory Type */
+
+ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 1);
+ break;
+
+ case 5: /* Read/Write Type */
+
+ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 0);
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->Address32.Granularity =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Address32.Minimum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Address32.Maximum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->Address32.TranslationOffset =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->Address32.AddressLength =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address32.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 12: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address32.ResourceLength = (UINT16)
+ (Descriptor->Address32.ResourceLength + StringLength);
+
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
+ }
+ }
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
+ break;
+
+ case 13: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+
+ case 14: /* Address Range */
+
+ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 3);
+ break;
+
+ case 15: /* Type */
+
+ RsSetFlagBits (&Descriptor->Address32.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoDwordSpaceDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "DwordSpace" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoDwordSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS32) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Address32.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS32;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS32);
+ Descriptor->Address32.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS32) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ Descriptor->Address32.ResourceType =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 1: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 2: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 1);
+ break;
+
+ case 3: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 2);
+ break;
+
+ case 4: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Address32.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Flags), 3);
+ break;
+
+ case 5: /* Type-Specific flags */
+
+ Descriptor->Address32.SpecificFlags =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->Address32.Granularity =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Granularity));
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Address32.Minimum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Address32.Maximum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->Address32.TranslationOffset =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->Address32.AddressLength =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.AddressLength));
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address32.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 12: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address32.ResourceLength = (UINT16)
+ (Descriptor->Address32.ResourceLength + StringLength);
+
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
+ }
+ }
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
+ break;
+
+ case 13: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST,
+ InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoExtendedIoDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "ExtendedIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoExtendedIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT16 StringLength = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
+ Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
+ Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
+
+ Descriptor->ExtAddress64.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
+ break;
+
+ case 2: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
+ break;
+
+ case 4: /* Range Type */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
+ break;
+
+ case 5: /* Address Granularity */
+
+ Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
+ break;
+
+ case 8: /* Translation Offset */
+
+ Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
+ break;
+
+ case 9: /* Address Length */
+
+ Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
+ break;
+
+ case 10: /* Type-Specific Attributes */
+
+ Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
+ break;
+
+ case 11: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ case 12: /* Type */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 4);
+ break;
+
+ case 13: /* Translation Type */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoExtendedMemoryDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "ExtendedMemory" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoExtendedMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT16 StringLength = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
+ Descriptor->ExtAddress64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
+ Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
+
+ Descriptor->ExtAddress64.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
+ break;
+
+ case 2: /* MinType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
+ break;
+
+ case 3: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
+ break;
+
+ case 4: /* Memory Type */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 1);
+ break;
+
+ case 5: /* Read/Write Type */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 0);
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
+ break;
+
+ case 11: /* Type-Specific Attributes */
+
+ Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
+ break;
+
+ case 12: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+
+ case 13: /* Address Range */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 3);
+ break;
+
+ case 14: /* Type */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoExtendedSpaceDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "ExtendedSpace" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoExtendedSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT16 StringLength = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->ExtAddress64.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_ADDRESS64;
+ Descriptor->ExtAddress64.RevisionID = AML_RESOURCE_EXTENDED_ADDRESS_REVISION;
+
+ Descriptor->ExtAddress64.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Resource Type */
+
+ Descriptor->ExtAddress64.ResourceType =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 1: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 2: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 1);
+ break;
+
+ case 3: /* MinType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 2);
+ break;
+
+ case 4: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->ExtAddress64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Flags), 3);
+ break;
+
+ case 5: /* Type-Specific flags */
+
+ Descriptor->ExtAddress64.SpecificFlags =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->ExtAddress64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Granularity));
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->ExtAddress64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->ExtAddress64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.AddressLength));
+ break;
+
+ case 11: /* Type-Specific Attributes */
+
+ Descriptor->ExtAddress64.TypeSpecific = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TYPESPECIFICATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.TypeSpecific));
+ break;
+
+ case 12: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoQwordIoDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a long "QwordIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoQwordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
+
+
+ InitializerOp = Op->Asl.Child;
+ StringLength = RsGetStringDataLength (InitializerOp);
+
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
+ Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS64) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
for (i = 0; InitializerOp; i++)
{
switch (i)
{
- case 0: /* Resource Type */
+ case 0: /* Resource Usage */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
break;
case 1: /* MinType */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
break;
case 2: /* MaxType */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
break;
case 3: /* DecodeType */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
break;
case 4: /* Range Type */
- RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
break;
case 5: /* Address Granularity */
- Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
- break;
+ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
+ break;
case 6: /* Address Min */
- Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
+ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
break;
case 7: /* Address Max */
- Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
+ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
break;
case 8: /* Translation Offset */
- Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
+ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
break;
case 9: /* Address Length */
- Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
+ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
break;
case 10: /* ResSourceIndex [Optional Field - BYTE] */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
OptionIndex++;
- Descriptor->Das.Length++;
+ Descriptor->Address64.ResourceLength++;
+ ResSourceIndex = TRUE;
}
break;
@@ -290,12 +1394,34 @@
{
if (StringLength)
{
- Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (Descriptor->Address64.ResourceLength + StringLength);
- strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
- InitializerOp->Asl.Value.String);
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
}
}
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
break;
case 12: /* ResourceTag */
@@ -305,16 +1431,16 @@
case 13: /* Type */
- RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 4);
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4);
break;
case 14: /* Translation Type */
- RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
break;
default:
@@ -326,16 +1452,15 @@
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Das.DescriptorType))
- + OptionIndex + StringLength;
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
+ OptionIndex + StringLength;
return (Rnode);
}
/*******************************************************************************
*
- * FUNCTION: RsDoDwordMemoryDescriptor
+ * FUNCTION: RsDoQwordMemoryDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
* CurrentByteOffset - Offset into the resource template AML
@@ -343,129 +1468,133 @@
*
* RETURN: Completed resource node
*
- * DESCRIPTION: Construct a long "DwordMemory" descriptor
+ * DESCRIPTION: Construct a long "QwordMemory" descriptor
*
******************************************************************************/
ASL_RESOURCE_NODE *
-RsDoDwordMemoryDescriptor (
+RsDoQwordMemoryDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 StringLength = 0;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (ASL_DWORD_ADDRESS_DESC) +
- StringLength);
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
- Descriptor->Das.DescriptorType = ACPI_RDESC_TYPE_DWORD_ADDRESS_SPACE;
- Descriptor->Das.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
+ Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
+ Descriptor->Address64.ResourceType = ACPI_ADDRESS_TYPE_MEMORY_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
- Descriptor->Das.Length = (UINT16) (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Das.ResourceType));
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS64) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
- case 0: /* Resource Type */
+ case 0: /* Resource Usage */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 0, 1);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
break;
case 1: /* DecodeType */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 1);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
break;
case 2: /* MinType */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 2);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
break;
case 3: /* MaxType */
- RsSetFlagBits (&Descriptor->Das.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Flags), 3);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
break;
case 4: /* Memory Type */
- RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 1);
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 1);
break;
case 5: /* Read/Write Type */
- RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 0);
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
break;
case 6: /* Address Granularity */
- Descriptor->Das.Granularity = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.Granularity));
+ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
break;
case 7: /* Min Address */
- Descriptor->Das.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMin));
+ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
break;
case 8: /* Max Address */
- Descriptor->Das.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressMax));
+ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
break;
case 9: /* Translation Offset */
- Descriptor->Das.TranslationOffset = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.TranslationOffset));
+ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
break;
case 10: /* Address Length */
- Descriptor->Das.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.AddressLength));
+ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
break;
case 11: /* ResSourceIndex [Optional Field - BYTE] */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- Descriptor->Das.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
OptionIndex++;
- Descriptor->Das.Length++;
+ Descriptor->Address64.ResourceLength++;
+ ResSourceIndex = TRUE;
}
break;
@@ -476,12 +1605,34 @@
{
if (StringLength)
{
- Descriptor->Das.Length = (UINT16) (Descriptor->Das.Length + StringLength);
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (Descriptor->Address64.ResourceLength + StringLength);
- strcpy ((char *) &Descriptor->Das.OptionalFields[OptionIndex],
- InitializerOp->Asl.Value.String);
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
}
}
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
break;
case 13: /* ResourceTag */
@@ -492,16 +1643,16 @@
case 14: /* Address Range */
- RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 3);
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3);
break;
case 15: /* Type */
- RsSetFlagBits (&Descriptor->Das.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Das.SpecificFlags), 5);
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
break;
default:
@@ -513,16 +1664,15 @@
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- Rnode->BufferLength = (ASL_RESDESC_OFFSET (Das.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Das.DescriptorType))
- + OptionIndex + StringLength;
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
+ OptionIndex + StringLength;
return (Rnode);
}
/*******************************************************************************
*
- * FUNCTION: RsDoQwordIoDescriptor
+ * FUNCTION: RsDoQwordSpaceDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
* CurrentByteOffset - Offset into the resource template AML
@@ -530,156 +1680,173 @@
*
* RETURN: Completed resource node
*
- * DESCRIPTION: Construct a long "QwordIO" descriptor
+ * DESCRIPTION: Construct a long "QwordSpace" descriptor
*
******************************************************************************/
ASL_RESOURCE_NODE *
-RsDoQwordIoDescriptor (
+RsDoQwordSpaceDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 StringLength = 0;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
- StringLength);
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS64) + 1 + StringLength);
Descriptor = Rnode->Buffer;
- Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
- Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
+ Descriptor->Address64.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS64;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
- Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Qas.ResourceType));
- /*
- * Process all child initialization nodes
- */
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS64);
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS64) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Resource Type */
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
+ Descriptor->Address64.ResourceType =
+ (UINT8) InitializerOp->Asl.Value.Integer;
break;
- case 1: /* MinType */
+ case 1: /* Resource Usage */
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
break;
- case 2: /* MaxType */
+ case 2: /* DecodeType */
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
break;
- case 3: /* DecodeType */
+ case 3: /* MinType */
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
break;
- case 4: /* Range Type */
+ case 4: /* MaxType */
- RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
break;
- case 5: /* Address Granularity */
+ case 5: /* Type-Specific flags */
- Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
- break;
+ Descriptor->Address64.SpecificFlags =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
- case 6: /* Address Min */
+ case 6: /* Address Granularity */
- Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
+ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
break;
- case 7: /* Address Max */
+ case 7: /* Min Address */
- Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
+ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
break;
- case 8: /* Translation Offset */
+ case 8: /* Max Address */
- Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
+ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
break;
- case 9: /* Address Length */
+ case 9: /* Translation Offset */
- Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
+ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
break;
- case 10: /* ResSourceIndex [Optional Field - BYTE] */
+ case 10: /* Address Length */
+
+ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
OptionIndex++;
- Descriptor->Qas.Length++;
+ Descriptor->Address64.ResourceLength++;
+ ResSourceIndex = TRUE;
}
break;
- case 11: /* ResSource [Optional Field - STRING] */
+ case 12: /* ResSource [Optional Field - STRING] */
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
(InitializerOp->Asl.Value.String))
{
if (StringLength)
{
- Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (Descriptor->Address64.ResourceLength + StringLength);
- strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
- InitializerOp->Asl.Value.String);
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
}
}
- break;
- case 12: /* ResourceTag */
-
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- case 13: /* Type */
-
- RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 4);
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
break;
- case 14: /* Translation Type */
+ case 13: /* ResourceTag */
- RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
+ UtAttachNamepathToOwner (Op, InitializerOp);
break;
default:
@@ -691,16 +1858,15 @@
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Qas.DescriptorType))
- + OptionIndex + StringLength;
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
+ OptionIndex + StringLength;
return (Rnode);
}
/*******************************************************************************
*
- * FUNCTION: RsDoQwordMemoryDescriptor
+ * FUNCTION: RsDoWordIoDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
* CurrentByteOffset - Offset into the resource template AML
@@ -708,164 +1874,183 @@
*
* RETURN: Completed resource node
*
- * DESCRIPTION: Construct a long "QwordMemory" descriptor
+ * DESCRIPTION: Construct a long "WordIO" descriptor
*
******************************************************************************/
ASL_RESOURCE_NODE *
-RsDoQwordMemoryDescriptor (
+RsDoWordIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 StringLength = 0;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (ASL_QWORD_ADDRESS_DESC) +
- StringLength);
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
Descriptor = Rnode->Buffer;
- Descriptor->Qas.DescriptorType = ACPI_RDESC_TYPE_QWORD_ADDRESS_SPACE;
- Descriptor->Qas.ResourceType = ACPI_RESOURCE_TYPE_MEMORY_RANGE;
+ Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
+ Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_IO_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
- Descriptor->Qas.Length = (UINT16) (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Qas.ResourceType));
- /*
- * Process all child initialization nodes
- */
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS16) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
+
for (i = 0; InitializerOp; i++)
{
switch (i)
{
- case 0: /* Resource Type */
-
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 0, 1);
- break;
+ case 0: /* Resource Usage */
- case 1: /* DecodeType */
-
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 1);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
break;
- case 2: /* MinType */
+ case 1: /* MinType */
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 2);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
break;
- case 3: /* MaxType */
+ case 2: /* MaxType */
- RsSetFlagBits (&Descriptor->Qas.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Flags), 3);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
break;
- case 4: /* Memory Type */
+ case 3: /* DecodeType */
- RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 1);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
break;
- case 5: /* Read/Write Type */
+ case 4: /* Range Type */
- RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 0);
+ RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0);
break;
- case 6: /* Address Granularity */
+ case 5: /* Address Granularity */
- Descriptor->Qas.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.Granularity));
+ Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
break;
- case 7: /* Min Address */
+ case 6: /* Address Min */
- Descriptor->Qas.AddressMin = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMin));
+ Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
break;
- case 8: /* Max Address */
+ case 7: /* Address Max */
- Descriptor->Qas.AddressMax = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressMax));
+ Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
break;
- case 9: /* Translation Offset */
+ case 8: /* Translation Offset */
- Descriptor->Qas.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.TranslationOffset));
+ Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
break;
- case 10: /* Address Length */
+ case 9: /* Address Length */
- Descriptor->Qas.AddressLength = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.AddressLength));
+ Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
break;
- case 11: /* ResSourceIndex [Optional Field - BYTE] */
+ case 10: /* ResSourceIndex [Optional Field - BYTE] */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- Descriptor->Qas.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
OptionIndex++;
- Descriptor->Qas.Length++;
+ Descriptor->Address16.ResourceLength++;
+ ResSourceIndex = TRUE;
}
break;
- case 12: /* ResSource [Optional Field - STRING] */
+ case 11: /* ResSource [Optional Field - STRING] */
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
(InitializerOp->Asl.Value.String))
{
if (StringLength)
{
- Descriptor->Qas.Length = (UINT16) (Descriptor->Qas.Length + StringLength);
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (Descriptor->Address16.ResourceLength + StringLength);
- strcpy ((char *) &Descriptor->Qas.OptionalFields[OptionIndex],
- InitializerOp->Asl.Value.String);
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
}
}
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
break;
- case 13: /* ResourceTag */
+ case 12: /* ResourceTag */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
+ case 13: /* Type */
- case 14: /* Address Range */
-
- RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MEMATTRIBUTES,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 3);
+ RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4);
break;
- case 15: /* Type */
+ case 14: /* Translation Type */
- RsSetFlagBits (&Descriptor->Qas.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Qas.SpecificFlags), 5);
+ RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5);
break;
default:
@@ -877,16 +2062,15 @@
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- Rnode->BufferLength = (ASL_RESDESC_OFFSET (Qas.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Qas.DescriptorType))
- + OptionIndex + StringLength;
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
+ OptionIndex + StringLength;
return (Rnode);
}
/*******************************************************************************
*
- * FUNCTION: RsDoWordIoDescriptor
+ * FUNCTION: RsDoWordBusNumberDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
* CurrentByteOffset - Offset into the resource template AML
@@ -894,157 +2078,167 @@
*
* RETURN: Completed resource node
*
- * DESCRIPTION: Construct a long "WordIO" descriptor
+ * DESCRIPTION: Construct a long "WordBusNumber" descriptor
*
******************************************************************************/
ASL_RESOURCE_NODE *
-RsDoWordIoDescriptor (
+RsDoWordBusNumberDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 StringLength = 0;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
- StringLength);
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
Descriptor = Rnode->Buffer;
- Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
- Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_IO_RANGE;
+ Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
+ Descriptor->Address16.ResourceType = ACPI_ADDRESS_TYPE_BUS_NUMBER_RANGE;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
- Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Was.ResourceType));
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS16) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
- case 0: /* Resource Type */
+ case 0: /* Resource Usage */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
break;
case 1: /* MinType */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
break;
case 2: /* MaxType */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
break;
case 3: /* DecodeType */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
- break;
-
- case 4: /* Range Type */
-
- RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ASL_RESNAME_RANGETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 0);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
break;
- case 5: /* Address Granularity */
+ case 4: /* Address Granularity */
- Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
+ Descriptor->Address16.Granularity =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
break;
- case 6: /* Address Min */
+ case 5: /* Min Address */
- Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
+ Descriptor->Address16.Minimum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
break;
- case 7: /* Address Max */
+ case 6: /* Max Address */
- Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
+ Descriptor->Address16.Maximum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
break;
- case 8: /* Translation Offset */
+ case 7: /* Translation Offset */
- Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
+ Descriptor->Address16.TranslationOffset =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
break;
- case 9: /* Address Length */
+ case 8: /* Address Length */
- Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
+ Descriptor->Address16.AddressLength =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
break;
- case 10: /* ResSourceIndex [Optional Field - BYTE] */
+ case 9: /* ResSourceIndex [Optional Field - BYTE] */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
OptionIndex++;
- Descriptor->Was.Length++;
+ Descriptor->Address16.ResourceLength++;
+ ResSourceIndex = TRUE;
}
break;
- case 11: /* ResSource [Optional Field - STRING] */
+ case 10: /* ResSource [Optional Field - STRING] */
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
(InitializerOp->Asl.Value.String))
{
if (StringLength)
{
- Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length +StringLength);
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (Descriptor->Address16.ResourceLength + StringLength);
- strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
- InitializerOp->Asl.Value.String);
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
}
}
- break;
-
- case 12: /* ResourceTag */
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- case 13: /* Type */
-
- RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 4);
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
break;
- case 14: /* Translation Type */
+ case 11: /* ResourceTag */
- RsSetFlagBits (&Descriptor->Was.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_TRANSTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.SpecificFlags), 5);
+ UtAttachNamepathToOwner (Op, InitializerOp);
break;
default:
@@ -1056,16 +2250,15 @@
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Was.DescriptorType))
- + OptionIndex + StringLength;
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
+ OptionIndex + StringLength;
return (Rnode);
}
/*******************************************************************************
*
- * FUNCTION: RsDoWordBusNumberDescriptor
+ * FUNCTION: RsDoWordSpaceDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
* CurrentByteOffset - Offset into the resource template AML
@@ -1073,134 +2266,176 @@
*
* RETURN: Completed resource node
*
- * DESCRIPTION: Construct a long "WordBusNumber" descriptor
+ * DESCRIPTION: Construct a long "WordSpace" descriptor
*
******************************************************************************/
ASL_RESOURCE_NODE *
-RsDoWordBusNumberDescriptor (
+RsDoWordSpaceDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 StringLength = 0;
+ UINT8 *OptionalFields;
+ UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 i;
+ BOOLEAN ResSourceIndex = FALSE;
InitializerOp = Op->Asl.Child;
StringLength = RsGetStringDataLength (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (ASL_WORD_ADDRESS_DESC) +
- StringLength);
+ Rnode = RsAllocateResourceNode (
+ sizeof (AML_RESOURCE_ADDRESS16) + 1 + StringLength);
Descriptor = Rnode->Buffer;
- Descriptor->Was.DescriptorType = ACPI_RDESC_TYPE_WORD_ADDRESS_SPACE;
- Descriptor->Was.ResourceType = ACPI_RESOURCE_TYPE_BUS_NUMBER_RANGE;
+ Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
- Descriptor->Was.Length = (UINT16) (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Was.ResourceType));
+ OptionalFields = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_ADDRESS16);
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (sizeof (AML_RESOURCE_ADDRESS16) -
+ sizeof (AML_RESOURCE_LARGE_HEADER));
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Resource Type */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 0, 1);
+ Descriptor->Address16.ResourceType =
+ (UINT8) InitializerOp->Asl.Value.Integer;
break;
- case 1: /* MinType */
+ case 1: /* Resource Usage */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 2);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
break;
- case 2: /* MaxType */
+ case 2: /* DecodeType */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 3);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
break;
- case 3: /* DecodeType */
+ case 3: /* MinType */
- RsSetFlagBits (&Descriptor->Was.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Flags), 1);
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
break;
- case 4: /* Address Granularity */
+ case 4: /* MaxType */
- Descriptor->Was.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.Granularity));
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
break;
- case 5: /* Min Address */
+ case 5: /* Type-Specific flags */
- Descriptor->Was.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMin));
+ Descriptor->Address16.SpecificFlags =
+ (UINT8) InitializerOp->Asl.Value.Integer;
break;
- case 6: /* Max Address */
+ case 6: /* Address Granularity */
- Descriptor->Was.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressMax));
+ Descriptor->Address16.Granularity =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
break;
- case 7: /* Translation Offset */
+ case 7: /* Min Address */
- Descriptor->Was.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.TranslationOffset));
+ Descriptor->Address16.Minimum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
break;
- case 8: /* Address Length */
+ case 8: /* Max Address */
- Descriptor->Was.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Was.AddressLength));
+ Descriptor->Address16.Maximum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
break;
- case 9: /* ResSourceIndex [Optional Field - BYTE] */
+ case 9: /* Translation Offset */
+
+ Descriptor->Address16.TranslationOffset =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->Address16.AddressLength =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- Descriptor->Was.OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
OptionIndex++;
- Descriptor->Was.Length++;
+ Descriptor->Address16.ResourceLength++;
+ ResSourceIndex = TRUE;
}
break;
- case 10: /* ResSource [Optional Field - STRING] */
+ case 12: /* ResSource [Optional Field - STRING] */
if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
(InitializerOp->Asl.Value.String))
{
if (StringLength)
{
- Descriptor->Was.Length = (UINT16) (Descriptor->Was.Length + StringLength);
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (Descriptor->Address16.ResourceLength + StringLength);
- strcpy ((char *) &Descriptor->Was.OptionalFields[OptionIndex],
- InitializerOp->Asl.Value.String);
+ strcpy ((char *)
+ &OptionalFields[OptionIndex],
+ InitializerOp->Asl.Value.String);
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
}
}
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (ResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
+ }
+#endif
break;
- case 11: /* ResourceTag */
+ case 13: /* ResourceTag */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
@@ -1214,9 +2449,8 @@
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- Rnode->BufferLength = (ASL_RESDESC_OFFSET (Was.OptionalFields[0]) -
- ASL_RESDESC_OFFSET (Was.DescriptorType))
- + OptionIndex + StringLength;
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
+ OptionIndex + StringLength;
return (Rnode);
}
@@ -1240,11 +2474,11 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
- ASL_RESOURCE_DESC *Rover = NULL;
+ AML_RESOURCE *Descriptor;
+ AML_RESOURCE *Rover = NULL;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 StringLength = 0;
+ UINT16 StringLength = 0;
UINT32 OptionIndex = 0;
UINT32 i;
BOOLEAN HasResSourceIndex = FALSE;
@@ -1275,51 +2509,52 @@
}
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_EXTENDED_XRUPT_DESC) +
- OptionIndex + StringLength);
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_EXTENDED_IRQ) +
+ 1 + OptionIndex + StringLength);
+
Descriptor = Rnode->Buffer;
- Descriptor->Exx.DescriptorType = ACPI_RDESC_TYPE_EXTENDED_XRUPT;
+ Descriptor->ExtendedIrq.DescriptorType = ACPI_RESOURCE_NAME_EXTENDED_IRQ;
/*
* Initial descriptor length -- may be enlarged if there are
* optional fields present
*/
- Descriptor->Exx.Length = 2; /* Flags and table length byte */
- Descriptor->Exx.TableLength = 0;
+ Descriptor->ExtendedIrq.ResourceLength = 2; /* Flags and table length byte */
+ Descriptor->ExtendedIrq.InterruptCount = 0;
- Rover = ACPI_CAST_PTR (ASL_RESOURCE_DESC, (&(Descriptor->Exx.InterruptNumber[0])));
+ Rover = ACPI_CAST_PTR (AML_RESOURCE,
+ (&(Descriptor->ExtendedIrq.Interrupts[0])));
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
- case 0: /* Resource Type (Default: consumer (1) */
+ case 0: /* Resource Usage (Default: consumer (1) */
- RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 0, 1);
+ RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 0, 1);
break;
case 1: /* Interrupt Type (or Mode - edge/level) */
- RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 0);
+ RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 1);
break;
case 2: /* Interrupt Level (or Polarity - Active high/low) */
- RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 2);
+ RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 2);
break;
case 3: /* Share Type - Default: exclusive (0) */
- RsSetFlagBits (&Descriptor->Exx.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.Flags), 3);
+ RsSetFlagBits (&Descriptor->ExtendedIrq.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtendedIrq.Flags), 3);
break;
case 4: /* ResSourceIndex [Optional Field - BYTE] */
@@ -1340,7 +2575,27 @@
{
ResSourceString = (UINT8 *) InitializerOp->Asl.Value.String;
}
+
+ /* ResourceSourceIndex must also be valid */
+
+ if (!HasResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
+ InitializerOp, NULL);
+ }
+ }
+
+#if 0
+ /*
+ * Not a valid ResourceSource, ResourceSourceIndex must also
+ * be invalid
+ */
+ else if (HasResSourceIndex)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ InitializerOp, NULL);
}
+#endif
break;
case 6: /* ResourceTag */
@@ -1350,48 +2605,77 @@
default:
/*
- * Interrupt Numbers come through here, repeatedly.
- * Store the integer and move pointer to the next one.
+ * Interrupt Numbers come through here, repeatedly
*/
- Rover->U32Item = (UINT32) InitializerOp->Asl.Value.Integer;
- Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U32Item), 4);
- Descriptor->Exx.TableLength++;
- Descriptor->Exx.Length += 4;
+ /* Maximum 255 interrupts allowed for this descriptor */
+
+ if (Descriptor->ExtendedIrq.InterruptCount == 255)
+ {
+ AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_LIST,
+ InitializerOp, NULL);
+ return (Rnode);
+ }
+
+ /* Each interrupt number must be a 32-bit value */
+
+ if (InitializerOp->Asl.Value.Integer > ACPI_UINT32_MAX)
+ {
+ AslError (ASL_ERROR, ASL_MSG_EX_INTERRUPT_NUMBER,
+ InitializerOp, NULL);
+ }
+
+ /* Save the integer and move pointer to the next one */
+
+ Rover->DwordItem = (UINT32) InitializerOp->Asl.Value.Integer;
+ Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->DwordItem), 4);
+ Descriptor->ExtendedIrq.InterruptCount++;
+ Descriptor->ExtendedIrq.ResourceLength += 4;
- if (i == 7) /* case 7: First interrupt number */
+ /* Case 7: First interrupt number in list */
+
+ if (i == 7)
{
- RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]));
+ /* Check now for duplicates in list */
+
+ RsCheckListForDuplicates (InitializerOp);
+
+ /* Create a named field at the start of the list */
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
+ CurrentByteOffset +
+ ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]));
}
}
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
- /*
- * Add optional ResSourceIndex if present
- */
+
+ /* Add optional ResSourceIndex if present */
+
if (HasResSourceIndex)
{
- Rover->U8Item = ResSourceIndex;
- Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), 1);
- Descriptor->Exx.Length += 1;
+ Rover->ByteItem = ResSourceIndex;
+ Rover = ACPI_ADD_PTR (AML_RESOURCE, &(Rover->ByteItem), 1);
+ Descriptor->ExtendedIrq.ResourceLength += 1;
}
- /*
- * Add optional ResSource string if present
- */
+ /* Add optional ResSource string if present */
+
if (StringLength && ResSourceString)
{
strcpy ((char *) Rover, (char *) ResSourceString);
- Rover = ACPI_PTR_ADD (ASL_RESOURCE_DESC, &(Rover->U8Item), StringLength);
- Descriptor->Exx.Length = (UINT16) (Descriptor->Exx.Length + StringLength);
+ Rover = ACPI_ADD_PTR (
+ AML_RESOURCE, &(Rover->ByteItem), StringLength);
+
+ Descriptor->ExtendedIrq.ResourceLength = (UINT16)
+ (Descriptor->ExtendedIrq.ResourceLength + StringLength);
}
- Rnode->BufferLength = (ASL_RESDESC_OFFSET (Exx.InterruptNumber[0]) -
- ASL_RESDESC_OFFSET (Exx.DescriptorType))
+ Rnode->BufferLength = (ASL_RESDESC_OFFSET (ExtendedIrq.Interrupts[0]) -
+ ASL_RESDESC_OFFSET (ExtendedIrq.DescriptorType))
+ OptionIndex + StringLength;
return (Rnode);
}
@@ -1416,9 +2700,10 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
+ UINT8 *VendorData;
UINT32 i;
@@ -1429,24 +2714,35 @@
for (i = 0; InitializerOp; i++)
{
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
InitializerOp = InitializerOp->Asl.Next;
}
InitializerOp = Op->Asl.Child;
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- Rnode = RsAllocateResourceNode (sizeof (ASL_LARGE_VENDOR_DESC) + (i - 1));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_LARGE) + i);
Descriptor = Rnode->Buffer;
- Descriptor->Lgv.DescriptorType = ACPI_RDESC_TYPE_LARGE_VENDOR;
- Descriptor->Lgv.Length = (UINT16) i;
+ Descriptor->VendorLarge.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_LARGE;
+ Descriptor->VendorLarge.ResourceLength = (UINT16) i;
+
+ /* Point to end-of-descriptor for vendor data */
+
+ VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_LARGE_HEADER);
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
- Descriptor->Lgv.VendorDefined[i] = (UINT8) InitializerOp->Asl.Value.Integer;
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+ VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
@@ -1473,54 +2769,64 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_GENERAL_REGISTER_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GENERIC_REGISTER));
Descriptor = Rnode->Buffer;
- Descriptor->Grg.DescriptorType = ACPI_RDESC_TYPE_GENERAL_REGISTER;
- Descriptor->Grg.Length = 12;
+ Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
+ Descriptor->GenericReg.ResourceLength = 12;
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Address space */
- Descriptor->Grg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESSSPACE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.AddressSpaceId));
+ Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId));
break;
case 1: /* Register Bit Width */
- Descriptor->Grg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITWIDTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitWidth));
+ Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth));
break;
case 2: /* Register Bit Offset */
- Descriptor->Grg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_REGISTERBITOFFSET,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.BitOffset));
+ Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset));
break;
case 3: /* Register Address */
- Descriptor->Grg.Address = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ADDRESS,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Grg.Address));
+ Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
+ break;
+
+ case 4: /* Access Size (ACPI 3.0) */
+
+ Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize));
break;
+ case 5: /* ResourceTag (ACPI 3.0b) */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
default:
Index: asllength.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/asllength.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/asllength.c -L sys/contrib/dev/acpica/compiler/asllength.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/asllength.c
+++ sys/contrib/dev/acpica/compiler/asllength.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asllength - Tree walk to determine package and opcode lengths
- * $Revision: 31 $
+ * $Revision: 1.37 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,14 +116,33 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asllength")
+/* Local prototypes */
+
+static UINT8
+CgGetPackageLenByteCount (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 PackageLength);
+
+static void
+CgGenerateAmlOpcodeLength (
+ ACPI_PARSE_OBJECT *Op);
+
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+void
+LnAdjustLengthToRoot (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 LengthDelta);
+#endif
+
/*******************************************************************************
*
@@ -199,47 +218,9 @@
/*******************************************************************************
*
- * FUNCTION: LnAdjustLengthToRoot
- *
- * PARAMETERS: Op - Node whose Length was changed
- *
- * RETURN: None.
- *
- * DESCRIPTION: Change the Subtree length of the given node, and bubble the
- * change all the way up to the root node. This allows for
- * last second changes to a package length (for example, if the
- * package length encoding gets shorter or longer.)
- *
- ******************************************************************************/
-
-void
-LnAdjustLengthToRoot (
- ACPI_PARSE_OBJECT *SubtreeOp,
- UINT32 LengthDelta)
-{
- ACPI_PARSE_OBJECT *Op;
-
-
- /* Adjust all subtree lengths up to the root */
-
- Op = SubtreeOp->Asl.Parent;
- while (Op)
- {
- Op->Asl.AmlSubtreeLength -= LengthDelta;
- Op = Op->Asl.Parent;
- }
-
- /* Adjust the global table length */
-
- Gbl_TableLength -= LengthDelta;
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: CgGetPackageLenByteCount
*
- * PARAMETERS: Op - Parse node
+ * PARAMETERS: Op - Parse node
* PackageLength - Length to be encoded
*
* RETURN: Required length of the package length encoding
@@ -249,7 +230,7 @@
*
******************************************************************************/
-UINT8
+static UINT8
CgGetPackageLenByteCount (
ACPI_PARSE_OBJECT *Op,
UINT32 PackageLength)
@@ -291,7 +272,7 @@
*
* FUNCTION: CgGenerateAmlOpcodeLength
*
- * PARAMETERS: Op - Parse node whose AML opcode lengths will be
+ * PARAMETERS: Op - Parse node whose AML opcode lengths will be
* calculated
*
* RETURN: None.
@@ -301,7 +282,7 @@
*
******************************************************************************/
-void
+static void
CgGenerateAmlOpcodeLength (
ACPI_PARSE_OBJECT *Op)
{
@@ -322,7 +303,8 @@
Op->Asl.AmlPkgLenBytes = 0;
if (Op->Asl.CompileFlags & NODE_AML_PACKAGE)
{
- Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, Op->Asl.AmlSubtreeLength);
+ Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (
+ Op, Op->Asl.AmlSubtreeLength);
}
/* Data opcode lengths are easy */
@@ -425,7 +407,8 @@
{
case PARSEOP_DEFINITIONBLOCK:
- Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) + Op->Asl.AmlSubtreeLength;
+ Gbl_TableLength = sizeof (ACPI_TABLE_HEADER) +
+ Op->Asl.AmlSubtreeLength;
break;
case PARSEOP_NAMESEG:
@@ -471,13 +454,17 @@
case PARSEOP_STRING_LITERAL:
Op->Asl.AmlOpcodeLength = 1;
- Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1; /* Get null terminator */
+
+ /* Get null terminator */
+
+ Op->Asl.AmlLength = strlen (Op->Asl.Value.String) + 1;
break;
case PARSEOP_PACKAGE_LENGTH:
Op->Asl.AmlOpcodeLength = 0;
- Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op, (UINT32) Op->Asl.Value.Integer);
+ Op->Asl.AmlPkgLenBytes = CgGetPackageLenByteCount (Op,
+ (UINT32) Op->Asl.Value.Integer);
break;
case PARSEOP_RAW_DATA:
@@ -502,3 +489,43 @@
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: LnAdjustLengthToRoot
+ *
+ * PARAMETERS: Op - Node whose Length was changed
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Change the Subtree length of the given node, and bubble the
+ * change all the way up to the root node. This allows for
+ * last second changes to a package length (for example, if the
+ * package length encoding gets shorter or longer.)
+ *
+ ******************************************************************************/
+
+void
+LnAdjustLengthToRoot (
+ ACPI_PARSE_OBJECT *SubtreeOp,
+ UINT32 LengthDelta)
+{
+ ACPI_PARSE_OBJECT *Op;
+
+
+ /* Adjust all subtree lengths up to the root */
+
+ Op = SubtreeOp->Asl.Parent;
+ while (Op)
+ {
+ Op->Asl.AmlSubtreeLength -= LengthDelta;
+ Op = Op->Asl.Parent;
+ }
+
+ /* Adjust the global table length */
+
+ Gbl_TableLength -= LengthDelta;
+}
+#endif
+
+
Index: aslresource.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslresource.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslresource.c -L sys/contrib/dev/acpica/compiler/aslresource.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslresource.c
+++ sys/contrib/dev/acpica/compiler/aslresource.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslresource - Resource templates and descriptors
- * $Revision: 32 $
+ * $Revision: 1.43 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,9 +116,9 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_COMPILER
@@ -162,7 +162,7 @@
*
* FUNCTION: RsCreateBitField
*
- * PARAMETERS: Op - Resource field node
+ * PARAMETERS: Op - Resource field node
* Name - Name of the field (Used only to reference
* the field in the ASL, not in the AML)
* ByteOffset - Offset from the field start
@@ -185,7 +185,7 @@
{
Op->Asl.ExternalName = Name;
- Op->Asl.Value.Integer = (ByteOffset * 8) + BitOffset;
+ Op->Asl.Value.Integer = ((ACPI_INTEGER) ByteOffset * 8) + BitOffset;
Op->Asl.CompileFlags |= (NODE_IS_RESOURCE_FIELD | NODE_IS_BIT_OFFSET);
}
@@ -194,7 +194,7 @@
*
* FUNCTION: RsCreateByteField
*
- * PARAMETERS: Op - Resource field node
+ * PARAMETERS: Op - Resource field node
* Name - Name of the field (Used only to reference
* the field in the ASL, not in the AML)
* ByteOffset - Offset from the field start
@@ -225,7 +225,7 @@
* FUNCTION: RsSetFlagBits
*
* PARAMETERS: *Flags - Pointer to the flag byte
- * Op - Flag initialization node
+ * Op - Flag initialization node
* Position - Bit position within the flag byte
* Default - Used if the node is DEFAULT.
*
@@ -292,6 +292,69 @@
/*******************************************************************************
*
+ * FUNCTION: RsCheckListForDuplicates
+ *
+ * PARAMETERS: Op - First op in the initializer list
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check an initializer list for duplicate values. Emits an error
+ * if any duplicates are found.
+ *
+ ******************************************************************************/
+
+void
+RsCheckListForDuplicates (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *NextValueOp = Op;
+ ACPI_PARSE_OBJECT *NextOp;
+ UINT32 Value;
+
+
+ if (!Op)
+ {
+ return;
+ }
+
+ /* Search list once for each value in the list */
+
+ while (NextValueOp)
+ {
+ Value = (UINT32) NextValueOp->Asl.Value.Integer;
+
+ /* Compare this value to all remaining values in the list */
+
+ NextOp = ASL_GET_PEER_NODE (NextValueOp);
+ while (NextOp)
+ {
+ if (NextOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ /* Compare values */
+
+ if (Value == (UINT32) NextOp->Asl.Value.Integer)
+ {
+ /* Emit error only once per duplicate node */
+
+ if (!(NextOp->Asl.CompileFlags & NODE_IS_DUPLICATE))
+ {
+ NextOp->Asl.CompileFlags |= NODE_IS_DUPLICATE;
+ AslError (ASL_ERROR, ASL_MSG_DUPLICATE_ITEM,
+ NextOp, NULL);
+ }
+ }
+ }
+
+ NextOp = ASL_GET_PEER_NODE (NextOp);
+ }
+
+ NextValueOp = ASL_GET_PEER_NODE (NextValueOp);
+ }
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: RsDoOneResourceDescriptor
*
* PARAMETERS: DescriptorTypeOp - Parent parse node of the descriptor
@@ -313,31 +376,41 @@
ASL_RESOURCE_NODE *Rnode = NULL;
- /* Determine type of resource */
+ /* Construct the resource */
switch (DescriptorTypeOp->Asl.ParseOpcode)
{
case PARSEOP_DMA:
- Rnode = RsDoDmaDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoDmaDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_DWORDIO:
- Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoDwordIoDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_DWORDMEMORY:
- Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoDwordMemoryDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
+ case PARSEOP_DWORDSPACE:
+ Rnode = RsDoDwordSpaceDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_ENDDEPENDENTFN:
switch (*State)
{
case ACPI_RSTATE_NORMAL:
- AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT, DescriptorTypeOp, NULL);
+ AslError (ASL_ERROR, ASL_MSG_MISSING_STARTDEPENDENT,
+ DescriptorTypeOp, NULL);
break;
case ACPI_RSTATE_START_DEPENDENT:
- AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL);
+ AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
+ DescriptorTypeOp, NULL);
break;
case ACPI_RSTATE_DEPENDENT_LIST:
@@ -346,58 +419,96 @@
}
*State = ACPI_RSTATE_NORMAL;
- Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoEndDependentDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
+ case PARSEOP_ENDTAG:
+ Rnode = RsDoEndTagDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
+ case PARSEOP_EXTENDEDIO:
+ Rnode = RsDoExtendedIoDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
+ case PARSEOP_EXTENDEDMEMORY:
+ Rnode = RsDoExtendedMemoryDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
+ case PARSEOP_EXTENDEDSPACE:
+ Rnode = RsDoExtendedSpaceDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_FIXEDIO:
- Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoFixedIoDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_INTERRUPT:
- Rnode = RsDoInterruptDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoInterruptDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_IO:
- Rnode = RsDoIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoIoDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_IRQ:
- Rnode = RsDoIrqDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoIrqDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_IRQNOFLAGS:
- Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoIrqNoFlagsDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_MEMORY24:
- Rnode = RsDoMemory24Descriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoMemory24Descriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_MEMORY32:
- Rnode = RsDoMemory32Descriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoMemory32Descriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_MEMORY32FIXED:
- Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoMemory32FixedDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_QWORDIO:
- Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoQwordIoDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_QWORDMEMORY:
- Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoQwordMemoryDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
+ case PARSEOP_QWORDSPACE:
+ Rnode = RsDoQwordSpaceDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_REGISTER:
- Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoGeneralRegisterDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_STARTDEPENDENTFN:
switch (*State)
{
case ACPI_RSTATE_START_DEPENDENT:
- AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL);
+ AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
+ DescriptorTypeOp, NULL);
break;
case ACPI_RSTATE_NORMAL:
@@ -407,7 +518,8 @@
}
*State = ACPI_RSTATE_START_DEPENDENT;
- Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoStartDependentDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
*State = ACPI_RSTATE_DEPENDENT_LIST;
break;
@@ -415,7 +527,8 @@
switch (*State)
{
case ACPI_RSTATE_START_DEPENDENT:
- AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING, DescriptorTypeOp, NULL);
+ AslError (ASL_ERROR, ASL_MSG_DEPENDENT_NESTING,
+ DescriptorTypeOp, NULL);
break;
case ACPI_RSTATE_NORMAL:
@@ -425,24 +538,34 @@
}
*State = ACPI_RSTATE_START_DEPENDENT;
- Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoStartDependentNoPriDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
*State = ACPI_RSTATE_DEPENDENT_LIST;
break;
case PARSEOP_VENDORLONG:
- Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoVendorLargeDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_VENDORSHORT:
- Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoVendorSmallDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_WORDBUSNUMBER:
- Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoWordBusNumberDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_WORDIO:
- Rnode = RsDoWordIoDescriptor (DescriptorTypeOp, CurrentByteOffset);
+ Rnode = RsDoWordIoDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
+ break;
+
+ case PARSEOP_WORDSPACE:
+ Rnode = RsDoWordSpaceDescriptor (DescriptorTypeOp,
+ CurrentByteOffset);
break;
case PARSEOP_DEFAULT_ARG:
@@ -462,6 +585,12 @@
*/
DescriptorTypeOp->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
DescriptorTypeOp->Asl.CompileFlags = NODE_IS_RESOURCE_DESC;
+ DescriptorTypeOp->Asl.Value.Integer = CurrentByteOffset;
+
+ if (Rnode)
+ {
+ DescriptorTypeOp->Asl.FinalAmlLength = Rnode->BufferLength;
+ }
return (Rnode);
}
@@ -540,7 +669,6 @@
ACPI_PARSE_OBJECT *BufferOp;
ACPI_PARSE_OBJECT *DescriptorTypeOp;
ACPI_PARSE_OBJECT *LastOp = NULL;
- ASL_RESOURCE_DESC *Descriptor;
UINT32 CurrentByteOffset = 0;
ASL_RESOURCE_NODE HeadRnode;
ASL_RESOURCE_NODE *PreviousRnode;
@@ -548,6 +676,13 @@
UINT8 State;
+ /* Mark parent as containing a resource template */
+
+ if (Op->Asl.Parent)
+ {
+ Op->Asl.Parent->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC;
+ }
+
/* ResourceTemplate Opcode is first (Op) */
/* Buffer Length node is first child */
@@ -561,13 +696,18 @@
DescriptorTypeOp = ASL_GET_PEER_NODE (BufferOp);
- /* Process all resource descriptors in the list */
-
+ /*
+ * Process all resource descriptors in the list
+ * Note: It is assumed that the EndTag node has been automatically
+ * inserted at the end of the template by the parser.
+ */
State = ACPI_RSTATE_NORMAL;
PreviousRnode = &HeadRnode;
while (DescriptorTypeOp)
{
- Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset, &State);
+ DescriptorTypeOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DESC;
+ Rnode = RsDoOneResourceDescriptor (DescriptorTypeOp, CurrentByteOffset,
+ &State);
/*
* Update current byte offset to indicate the number of bytes from the
@@ -593,18 +733,6 @@
}
/*
- * Insert the EndTag descriptor after all other descriptors have been processed
- */
- Rnode = RsAllocateResourceNode (sizeof (ASL_END_TAG_DESC));
-
- Descriptor = Rnode->Buffer;
- Descriptor->Et.DescriptorType = ACPI_RDESC_TYPE_END_TAG |
- ASL_RDESC_END_TAG_SIZE;
- Descriptor->Et.Checksum = 0;
-
- CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, Rnode);
-
- /*
* Transform the nodes into the following
*
* Op -> AML_BUFFER_OP
@@ -613,11 +741,10 @@
*/
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Asl.AmlOpcode = AML_BUFFER_OP;
- Op->Asl.CompileFlags = NODE_AML_PACKAGE;
+ Op->Asl.CompileFlags = NODE_AML_PACKAGE | NODE_IS_RESOURCE_DESC;
BufferLengthOp->Asl.ParseOpcode = PARSEOP_INTEGER;
BufferLengthOp->Asl.Value.Integer = CurrentByteOffset;
-
(void) OpcSetOptimalIntegerSize (BufferLengthOp);
BufferOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
@@ -625,6 +752,7 @@
BufferOp->Asl.AmlOpcodeLength = 0;
BufferOp->Asl.AmlLength = CurrentByteOffset;
BufferOp->Asl.Value.Buffer = (UINT8 *) HeadRnode.Next;
+ BufferOp->Asl.CompileFlags |= NODE_IS_RESOURCE_DATA;
return;
}
Index: asllisting.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/asllisting.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/asllisting.c -L sys/contrib/dev/acpica/compiler/asllisting.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/asllisting.c
+++ sys/contrib/dev/acpica/compiler/asllisting.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asllisting - Listing file generation
- * $Revision: 51 $
+ * $Revision: 1.63 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,15 +116,137 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
-#include "acparser.h"
-#include "acnamesp.h"
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslisting")
+/* Local prototypes */
+
+static void
+LsDumpAscii (
+ UINT32 FileId,
+ UINT32 Count,
+ UINT8 *Buffer);
+
+static void
+LsDumpAsciiInComment (
+ UINT32 FileId,
+ UINT32 Count,
+ UINT8 *Buffer);
+
+static ACPI_STATUS
+LsAmlListingWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static void
+LsGenerateListing (
+ UINT32 FileId);
+
+static void
+LsPushNode (
+ char *Filename);
+
+static ASL_LISTING_NODE *
+LsPopNode (
+ void);
+
+static void
+LsCheckException (
+ UINT32 LineNumber,
+ UINT32 FileId);
+
+static void
+LsFlushListingBuffer (
+ UINT32 FileId);
+
+static void
+LsWriteListingHexBytes (
+ UINT8 *Buffer,
+ UINT32 Length,
+ UINT32 FileId);
+
+static UINT32
+LsWriteOneSourceLine (
+ UINT32 FileId);
+
+static void
+LsFinishSourceListing (
+ UINT32 FileId);
+
+static void
+LsWriteSourceLines (
+ UINT32 ToLineNumber,
+ UINT32 ToLogicalLineNumber,
+ UINT32 FileId);
+
+static void
+LsWriteNodeToListing (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 FileId);
+
+static void
+LsDoHexOutputC (
+ void);
+
+static void
+LsDoHexOutputAsm (
+ void);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LsTreeWriteWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Dump entire parse tree, for compiler debug only
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+LsTreeWriteWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ /* Debug output */
+
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
+ UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
+
+
+ DbgPrint (ASL_TREE_OUTPUT, "\n");
+ return (AE_OK);
+}
+
+
+void
+LsDumpParseTree (
+ void)
+{
+
+ if (!Gbl_DebugFlag)
+ {
+ return;
+ }
+
+ DbgPrint (ASL_TREE_OUTPUT, "\nOriginal parse tree from parser:\n\n");
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
+ LsTreeWriteWalk, NULL, NULL);
+}
+
/*******************************************************************************
*
@@ -140,7 +262,7 @@
*
******************************************************************************/
-void
+static void
LsDumpAscii (
UINT32 FileId,
UINT32 Count,
@@ -183,7 +305,7 @@
*
******************************************************************************/
-void
+static void
LsDumpAsciiInComment (
UINT32 FileId,
UINT32 Count,
@@ -237,7 +359,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LsAmlListingWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -245,11 +367,18 @@
{
UINT8 FileByte;
UINT32 i;
- UINT32 FileId = (UINT32) Context;
+ UINT32 FileId = (UINT32) ACPI_TO_INTEGER (Context);
LsWriteNodeToListing (Op, FileId);
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DATA)
+ {
+ /* Buffer is a resource template, don't dump the data all at once */
+
+ return (AE_OK);
+ }
+
/* Write the hex bytes to the listing file(s) (if requested) */
for (i = 0; i < Op->Asl.FinalAmlLength; i++)
@@ -279,7 +408,7 @@
*
******************************************************************************/
-void
+static void
LsGenerateListing (
UINT32 FileId)
{
@@ -316,7 +445,8 @@
******************************************************************************/
void
-LsDoListings (void)
+LsDoListings (
+ void)
{
if (Gbl_C_OutputFlag)
@@ -361,7 +491,7 @@
*
******************************************************************************/
-void
+static void
LsPushNode (
char *Filename)
{
@@ -397,8 +527,9 @@
*
******************************************************************************/
-ASL_LISTING_NODE *
-LsPopNode (void)
+static ASL_LISTING_NODE *
+LsPopNode (
+ void)
{
ASL_LISTING_NODE *Lnode;
@@ -409,12 +540,13 @@
if ((!Lnode) ||
(!Lnode->Next))
{
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL, "Could not pop empty listing stack");
+ AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, NULL,
+ "Could not pop empty listing stack");
return Gbl_ListingNode;
}
Gbl_ListingNode = Lnode->Next;
- ACPI_MEM_FREE (Lnode);
+ ACPI_FREE (Lnode);
/* New "Current" node is the new head */
@@ -438,7 +570,7 @@
*
******************************************************************************/
-void
+static void
LsCheckException (
UINT32 LineNumber,
UINT32 FileId)
@@ -481,7 +613,7 @@
*
******************************************************************************/
-void
+static void
LsFlushListingBuffer (
UINT32 FileId)
{
@@ -531,7 +663,8 @@
FlWriteFile (FileId, " ", 1);
}
- FlPrintFile (FileId, " ;%8.8X", Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
+ FlPrintFile (FileId, " ;%8.8X",
+ Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
/* Write the ASCII character associated with each of the bytes */
@@ -551,7 +684,8 @@
FlWriteFile (FileId, " ", 1);
}
- FlPrintFile (FileId, " /* %8.8X", Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
+ FlPrintFile (FileId, " /* %8.8X",
+ Gbl_CurrentAmlOffset - HEX_LISTING_LINE_SIZE);
/* Write the ASCII character associated with each of the bytes */
@@ -587,7 +721,7 @@
*
******************************************************************************/
-void
+static void
LsWriteListingHexBytes (
UINT8 *Buffer,
UINT32 Length,
@@ -663,7 +797,7 @@
*
******************************************************************************/
-UINT32
+static UINT32
LsWriteOneSourceLine (
UINT32 FileId)
{
@@ -742,7 +876,7 @@
*
******************************************************************************/
-void
+static void
LsFinishSourceListing (
UINT32 FileId)
{
@@ -804,7 +938,7 @@
*
******************************************************************************/
-void
+static void
LsWriteSourceLines (
UINT32 ToLineNumber,
UINT32 ToLogicalLineNumber,
@@ -823,9 +957,8 @@
LsFlushListingBuffer (FileId);
- /*
- * Read lines and write them as long as we are not caught up
- */
+ /* Read lines and write them as long as we are not caught up */
+
if (Gbl_SourceLine < Gbl_CurrentLine)
{
/*
@@ -843,9 +976,8 @@
FlPrintFile (FileId, " /*\n");
}
- /*
- * Write one line at a time until we have reached the target line #
- */
+ /* Write one line at a time until we have reached the target line # */
+
while ((Gbl_SourceLine < Gbl_CurrentLine) &&
LsWriteOneSourceLine (FileId))
{ ; }
@@ -875,7 +1007,7 @@
*
******************************************************************************/
-void
+static void
LsWriteNodeToListing (
ACPI_PARSE_OBJECT *Op,
UINT32 FileId)
@@ -890,8 +1022,9 @@
OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
OpClass = OpInfo->Class;
- /* TBD: clean this up with a single flag that says: I start a named output block */
-
+ /* TBD: clean this up with a single flag that says:
+ * I start a named output block
+ */
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
{
switch (Op->Asl.ParseOpcode)
@@ -932,7 +1065,6 @@
}
}
-
/* These cases do not have a corresponding AML opcode */
switch (Op->Asl.ParseOpcode)
@@ -945,22 +1077,26 @@
if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
{
- FlPrintFile (FileId, "%s_%s_Header \\\n",
+ FlPrintFile (FileId,
+ "%s_%s_Header \\\n",
Gbl_TableSignature, Gbl_TableId);
}
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
{
- FlPrintFile (FileId, " unsigned char %s_%s_Header [] = \n {\n",
+ FlPrintFile (FileId,
+ " unsigned char %s_%s_Header [] =\n {\n",
Gbl_TableSignature, Gbl_TableId);
}
if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
{
- FlPrintFile (FileId, "extrn %s_%s_Header : byte\n",
+ FlPrintFile (FileId,
+ "extrn %s_%s_Header : byte\n",
Gbl_TableSignature, Gbl_TableId);
}
if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
{
- FlPrintFile (FileId, "extern unsigned char %s_%s_Header [];\n",
+ FlPrintFile (FileId,
+ "extern unsigned char %s_%s_Header [];\n",
Gbl_TableSignature, Gbl_TableId);
}
return;
@@ -968,39 +1104,44 @@
case PARSEOP_METHODCALL:
- LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
+ FileId);
return;
case PARSEOP_INCLUDE:
- /*
- * Flush everything up to and including the include source line
- */
- LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ /* Flush everything up to and including the include source line */
+
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
+ FileId);
+
+ /* Create a new listing node and push it */
- /*
- * Create a new listing node and push it
- */
LsPushNode (Op->Asl.Child->Asl.Value.String);
return;
case PARSEOP_INCLUDE_END:
- /*
- * Flush out the rest of the include file
- */
- LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ /* Flush out the rest of the include file */
- /*
- * Pop off this listing node and go back to the parent file
- */
- LsPopNode ();
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
+ FileId);
+
+ /* Pop off this listing node and go back to the parent file */
+
+ (void) LsPopNode ();
return;
case PARSEOP_DEFAULT_ARG:
+
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.EndLogicalLine,
+ FileId);
+ }
return;
@@ -1029,15 +1170,36 @@
case AML_FIELD_OP:
case AML_INDEX_FIELD_OP:
case AML_BANK_FIELD_OP:
- case AML_NAME_OP:
- /* For fields, we want to dump all the AML after the entire definition */
+ /*
+ * For fields, we want to dump all the AML after the
+ * entire definition
+ */
+ LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine,
+ FileId);
+ break;
- LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine, FileId);
+ case AML_NAME_OP:
+
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
+ FileId);
+ }
+ else
+ {
+ /*
+ * For fields, we want to dump all the AML after the
+ * entire definition
+ */
+ LsWriteSourceLines (Op->Asl.EndLine, Op->Asl.EndLogicalLine,
+ FileId);
+ }
break;
default:
- LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
+ FileId);
break;
}
@@ -1087,26 +1249,30 @@
if (FileId == ASL_FILE_ASM_SOURCE_OUTPUT)
{
- FlPrintFile (FileId, "%s_%s_%s \\\n",
+ FlPrintFile (FileId,
+ "%s_%s_%s \\\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
if (FileId == ASL_FILE_C_SOURCE_OUTPUT)
{
- FlPrintFile (FileId, " unsigned char %s_%s_%s [] = \n {\n",
+ FlPrintFile (FileId,
+ " unsigned char %s_%s_%s [] =\n {\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
if (FileId == ASL_FILE_ASM_INCLUDE_OUTPUT)
{
- FlPrintFile (FileId, "extrn %s_%s_%s : byte\n",
+ FlPrintFile (FileId,
+ "extrn %s_%s_%s : byte\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
if (FileId == ASL_FILE_C_INCLUDE_OUTPUT)
{
- FlPrintFile (FileId, "extern unsigned char %s_%s_%s [];\n",
+ FlPrintFile (FileId,
+ "extern unsigned char %s_%s_%s [];\n",
Gbl_TableSignature, Gbl_TableId, &Pathname[1]);
}
}
- ACPI_MEM_FREE (Pathname);
+ ACPI_FREE (Pathname);
}
break;
@@ -1121,7 +1287,14 @@
case AML_CLASS_CREATE:
default:
- LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber, FileId);
+ if ((Op->Asl.ParseOpcode == PARSEOP_BUFFER) &&
+ (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC))
+ {
+ return;
+ }
+
+ LsWriteSourceLines (Op->Asl.LineNumber, Op->Asl.LogicalLineNumber,
+ FileId);
break;
case AML_CLASS_UNKNOWN:
@@ -1143,7 +1316,8 @@
******************************************************************************/
void
-LsDoHexOutput (void)
+LsDoHexOutput (
+ void)
{
switch (Gbl_HexOutputFlag)
@@ -1179,8 +1353,9 @@
*
******************************************************************************/
-void
-LsDoHexOutputC (void)
+static void
+LsDoHexOutputC (
+ void)
{
UINT32 j;
UINT8 FileByte[HEX_TABLE_LINE_SIZE];
@@ -1189,7 +1364,7 @@
FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n");
- FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] = \n{\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
/* Start at the beginning of the AML file */
@@ -1205,9 +1380,8 @@
FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
}
- /*
- * Convert each AML byte to hex
- */
+ /* Convert each AML byte to hex */
+
UtConvertByteToHex (FileByte[j], Buffer);
FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
@@ -1221,18 +1395,19 @@
{
/* End of line, emit the ascii dump of the entire line */
- FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset - HEX_TABLE_LINE_SIZE);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT,
+ " /* %8.8X", Offset - HEX_TABLE_LINE_SIZE);
/* Write the ASCII character associated with each of the bytes */
- LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte);
+ LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT,
+ HEX_TABLE_LINE_SIZE, FileByte);
FlPrintFile (ASL_FILE_HEX_OUTPUT, " */\n");
/* Start new line */
j = 0;
}
-
}
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n};\n");
@@ -1254,7 +1429,7 @@
*
******************************************************************************/
-void
+static void
LsDoHexOutputAsm (
void)
{
@@ -1286,9 +1461,8 @@
DoComma = FALSE;
}
- /*
- * Convert each AML byte to hex
- */
+ /* Convert each AML byte to hex */
+
UtConvertByteToAsmHex (FileByte[j], Buffer);
FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
@@ -1298,7 +1472,8 @@
j++;
if (j >= HEX_TABLE_LINE_SIZE)
{
- FlPrintFile (ASL_FILE_HEX_OUTPUT, " ;%8.8X", Offset - HEX_TABLE_LINE_SIZE);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT,
+ " ;%8.8X", Offset - HEX_TABLE_LINE_SIZE);
/* Write the ASCII character associated with each of the bytes */
Index: aslutils.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslutils.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslutils.c -L sys/contrib/dev/acpica/compiler/aslutils.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslutils.c
+++ sys/contrib/dev/acpica/compiler/aslutils.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslutils -- compiler utilities
- * $Revision: 58 $
+ * $Revision: 1.72 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,10 +116,10 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "acnamesp.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslutils")
@@ -131,13 +131,23 @@
extern const char * const yytname[];
#endif
+/* Local prototypes */
-void
-AslOptimizeNamepath (
- char *Buffer)
-{
- printf ("NamePath: %s\n", Buffer);
-}
+static ACPI_STATUS
+UtStrtoul64 (
+ char *String,
+ UINT32 Base,
+ ACPI_INTEGER *RetInteger);
+
+static void
+UtPadNameWithUnderscores (
+ char *NameSeg,
+ char *PaddedNameSeg);
+
+static void
+UtAttachNameseg (
+ ACPI_PARSE_OBJECT *Op,
+ char *Name);
/*******************************************************************************
@@ -156,7 +166,8 @@
UtDisplayConstantOpcodes (
void)
{
- UINT32 i;
+ UINT32 i;
+
printf ("Constant expression opcode information\n\n");
@@ -191,7 +202,7 @@
void *Allocated;
- Allocated = ACPI_MEM_CALLOCATE (Size);
+ Allocated = ACPI_ALLOCATE_ZEROED (Size);
if (!Allocated)
{
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
@@ -203,7 +214,7 @@
TotalAllocations++;
TotalAllocated += Size;
- return Allocated;
+ return (Allocated);
}
@@ -211,24 +222,32 @@
*
* FUNCTION: UtBeginEvent
*
- * PARAMETERS: Event - Event number (integer index)
- * Name - Ascii name of this event
+ * PARAMETERS: Name - Ascii name of this event
*
- * RETURN: None
+ * RETURN: Event - Event number (integer index)
*
* DESCRIPTION: Saves the current time with this event
*
******************************************************************************/
-void
+UINT8
UtBeginEvent (
- UINT32 Event,
char *Name)
{
- AslGbl_Events[Event].StartTime = (time_t) AcpiOsGetTimer();
- AslGbl_Events[Event].EventName = Name;
- AslGbl_Events[Event].Valid = TRUE;
+ if (AslGbl_NextEvent >= ASL_NUM_EVENTS)
+ {
+ AcpiOsPrintf ("Ran out of compiler event structs!\n");
+ return (AslGbl_NextEvent);
+ }
+
+ /* Init event with current (start) time */
+
+ AslGbl_Events[AslGbl_NextEvent].StartTime = AcpiOsGetTimer ();
+ AslGbl_Events[AslGbl_NextEvent].EventName = Name;
+ AslGbl_Events[AslGbl_NextEvent].Valid = TRUE;
+
+ return (AslGbl_NextEvent++);
}
@@ -246,10 +265,17 @@
void
UtEndEvent (
- UINT32 Event)
+ UINT8 Event)
{
- AslGbl_Events[Event].EndTime = (time_t) AcpiOsGetTimer();
+ if (Event >= ASL_NUM_EVENTS)
+ {
+ return;
+ }
+
+ /* Insert end time for event */
+
+ AslGbl_Events[Event].EndTime = AcpiOsGetTimer ();
}
@@ -257,7 +283,7 @@
*
* FUNCTION: UtHexCharToValue
*
- * PARAMETERS: hc - Hex character in Ascii
+ * PARAMETERS: HexChar - Hex character in Ascii
*
* RETURN: The binary value of the hex character
*
@@ -267,20 +293,20 @@
UINT8
UtHexCharToValue (
- int hc)
+ int HexChar)
{
- if (hc <= 0x39)
+ if (HexChar <= 0x39)
{
- return ((UINT8) (hc - 0x30));
+ return ((UINT8) (HexChar - 0x30));
}
- if (hc <= 0x46)
+ if (HexChar <= 0x46)
{
- return ((UINT8) (hc - 0x37));
+ return ((UINT8) (HexChar - 0x37));
}
- return ((UINT8) (hc - 0x57));
+ return ((UINT8) (HexChar - 0x57));
}
@@ -289,7 +315,7 @@
* FUNCTION: UtConvertByteToHex
*
* PARAMETERS: RawByte - Binary data
- * *Buffer - Pointer to where the hex bytes will be stored
+ * Buffer - Pointer to where the hex bytes will be stored
*
* RETURN: Ascii hex byte is stored in Buffer.
*
@@ -317,7 +343,7 @@
* FUNCTION: UtConvertByteToAsmHex
*
* PARAMETERS: RawByte - Binary data
- * *Buffer - Pointer to where the hex bytes will be stored
+ * Buffer - Pointer to where the hex bytes will be stored
*
* RETURN: Ascii hex byte is stored in Buffer.
*
@@ -333,7 +359,6 @@
{
Buffer[0] = '0';
-
Buffer[1] = (UINT8) hex[(RawByte >> 4) & 0xF];
Buffer[2] = (UINT8) hex[RawByte & 0xF];
Buffer[3] = 'h';
@@ -344,7 +369,8 @@
*
* FUNCTION: DbgPrint
*
- * PARAMETERS: Fmt - Printf format string
+ * PARAMETERS: Type - Type of output
+ * Fmt - Printf format string
* ... - variable printf list
*
* RETURN: None
@@ -403,9 +429,13 @@
UINT32 Level)
{
+ if (Level)
+ {
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%*s", (3 * Level), " ");
+ }
DbgPrint (ASL_TREE_OUTPUT,
- "%*s %-16.16s", (3 * Level), " ",
- UtGetOpName (ParseOpcode));
+ " %-20.20s", UtGetOpName (ParseOpcode));
if (Level < TEXT_OFFSET)
{
@@ -431,7 +461,9 @@
UtSetParseOpName (
ACPI_PARSE_OBJECT *Op)
{
- strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode), 12);
+
+ strncpy (Op->Asl.ParseOpName, UtGetOpName (Op->Asl.ParseOpcode),
+ ACPI_MAX_PARSEOP_NAME);
}
@@ -456,7 +488,8 @@
* First entries (ASL_YYTNAME_START) in yytname are special reserved names.
* Ignore first 8 characters of the name
*/
- return ((char *) yytname [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
+ return ((char *) yytname
+ [(ParseOpcode - ASL_FIRST_PARSE_OPCODE) + ASL_YYTNAME_START] + 8);
}
@@ -464,7 +497,7 @@
*
* FUNCTION: UtDisplaySummary
*
- * PARAMETERS: None
+ * PARAMETERS: FileID - ID of outpout file
*
* RETURN: None
*
@@ -507,7 +540,9 @@
FlPrintFile (FileId,
"Compilation complete. %d Errors, %d Warnings, %d Remarks, %d Optimizations\n",
Gbl_ExceptionCount[ASL_ERROR],
- Gbl_ExceptionCount[ASL_WARNING],
+ Gbl_ExceptionCount[ASL_WARNING] +
+ Gbl_ExceptionCount[ASL_WARNING2] +
+ Gbl_ExceptionCount[ASL_WARNING3],
Gbl_ExceptionCount[ASL_REMARK],
Gbl_ExceptionCount[ASL_OPTIMIZATION]);
}
@@ -517,7 +552,7 @@
*
* FUNCTION: UtDisplaySummary
*
- * PARAMETERS: Op - Integer parse node
+ * PARAMETERS: Op - Integer parse node
* LowValue - Smallest allowed value
* HighValue - Largest allowed value
*
@@ -590,7 +625,8 @@
if ((Gbl_StringCacheNext + Length) >= Gbl_StringCacheLast)
{
Gbl_StringCacheNext = UtLocalCalloc (ASL_STRING_CACHE_SIZE + Length);
- Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE + Length;
+ Gbl_StringCacheLast = Gbl_StringCacheNext + ASL_STRING_CACHE_SIZE +
+ Length;
}
Buffer = Gbl_StringCacheNext;
@@ -667,7 +703,7 @@
*
******************************************************************************/
-void
+static void
UtPadNameWithUnderscores (
char *NameSeg,
char *PaddedNameSeg)
@@ -698,14 +734,14 @@
* PARAMETERS: Op - Parent parse node
* Name - Full ExternalName
*
- * RETURN: Sets the NameSeg field in parent node
+ * RETURN: None; Sets the NameSeg field in parent node
*
* DESCRIPTION: Extract the last nameseg of the ExternalName and store it
* in the NameSeg field of the Op.
*
******************************************************************************/
-void
+static void
UtAttachNameseg (
ACPI_PARSE_OBJECT *Op,
char *Name)
@@ -775,6 +811,10 @@
Op->Asl.ExternalName = NameOp->Asl.Value.String;
+ /* Save the NameOp for possible error reporting later */
+
+ Op->Asl.ParentMethod = (void *) NameOp;
+
/* Last nameseg of the path */
UtAttachNameseg (Op, Op->Asl.ExternalName);
@@ -813,7 +853,8 @@
Status = UtStrtoul64 (String, 0, &Converted);
if (ACPI_FAILURE (Status))
{
- sprintf (ErrBuf, "%s %s\n", "Conversion error:", AcpiFormatException (Status));
+ sprintf (ErrBuf, "%s %s\n", "Conversion error:",
+ AcpiFormatException (Status));
AslCompilererror (ErrBuf);
}
@@ -821,12 +862,15 @@
}
+/* TBD: use version in ACPI CA main code base? */
+
/*******************************************************************************
*
* FUNCTION: UtStrtoul64
*
* PARAMETERS: String - Null terminated string
- * Terminater - Where a pointer to the terminating byte is returned
+ * Terminater - Where a pointer to the terminating byte is
+ * returned
* Base - Radix of the string
*
* RETURN: Converted value
@@ -834,10 +878,8 @@
* DESCRIPTION: Convert a string into an unsigned value.
*
******************************************************************************/
-#define NEGATIVE 1
-#define POSITIVE 0
-ACPI_STATUS
+static ACPI_STATUS
UtStrtoul64 (
char *String,
UINT32 Base,
@@ -867,9 +909,8 @@
return (AE_BAD_PARAMETER);
}
- /*
- * skip over any white space in the buffer:
- */
+ /* Skip over any white space in the buffer: */
+
while (isspace (*String) || *String == '\t')
{
++String;
@@ -977,9 +1018,8 @@
}
- /*
- * If a minus sign was present, then "the conversion is negated":
- */
+ /* If a minus sign was present, then "the conversion is negated": */
+
if (Sign == NEGATIVE)
{
ReturnValue = (ACPI_UINT32_MAX - ReturnValue) + 1;
Index: aslcodegen.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslcodegen.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslcodegen.c -L sys/contrib/dev/acpica/compiler/aslcodegen.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslcodegen.c
+++ sys/contrib/dev/acpica/compiler/aslcodegen.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslcodegen - AML code generation
- * $Revision: 51 $
+ * $Revision: 1.62 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,13 +116,43 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslcodegen")
+/* Local prototypes */
+
+static ACPI_STATUS
+CgAmlWriteWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static void
+CgLocalWriteAmlData (
+ ACPI_PARSE_OBJECT *Op,
+ void *Buffer,
+ UINT32 Length);
+
+static void
+CgWriteAmlOpcode (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+CgWriteTableHeader (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+CgCloseTable (
+ void);
+
+static void
+CgWriteNode (
+ ACPI_PARSE_OBJECT *Op);
+
/*******************************************************************************
*
@@ -138,7 +168,8 @@
******************************************************************************/
void
-CgGenerateAmlOutput (void)
+CgGenerateAmlOutput (
+ void)
{
DbgPrint (ASL_DEBUG_OUTPUT, "\nWriting AML\n\n");
@@ -149,7 +180,8 @@
Gbl_SourceLine = 0;
Gbl_NextError = Gbl_ErrorLog;
- TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD, CgAmlWriteWalk, NULL, NULL);
+ TrWalkParseTree (RootNode, ASL_WALK_VISIT_DOWNWARD,
+ CgAmlWriteWalk, NULL, NULL);
CgCloseTable ();
}
@@ -166,7 +198,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
CgAmlWriteWalk (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -174,8 +206,19 @@
{
/*
- * Debug output
+ * Print header at level 0. Alignment assumes 32-bit pointers
*/
+ if (!Level)
+ {
+ DbgPrint (ASL_TREE_OUTPUT,
+ "Final parse tree used for AML output:\n");
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%*s Value P_Op A_Op OpLen PByts Len SubLen PSubLen OpPtr Child Parent Flags AcTyp Final Col L\n",
+ 76, " ");
+ }
+
+ /* Debug output */
+
DbgPrint (ASL_TREE_OUTPUT,
"%5.5d [%2d]", Op->Asl.LogicalLineNumber, Level);
UtPrintFormattedName (Op->Asl.ParseOpcode, Level);
@@ -192,27 +235,27 @@
DbgPrint (ASL_TREE_OUTPUT, " ");
}
- DbgPrint (ASL_TREE_OUTPUT,
- "Val-%08X POp-%04X AOp-%04X OpLen-%01X PByts-%01X Len-%04X SubLen-%04X PSubLen-%04X Op-%08X Chld-%08X Paren-%08X Flags-%04X AcTyp-%08X C-%2d L-%d\n",
- (UINT32) Op->Asl.Value.Integer,
- Op->Asl.ParseOpcode,
- Op->Asl.AmlOpcode,
- Op->Asl.AmlOpcodeLength,
- Op->Asl.AmlPkgLenBytes,
- Op->Asl.AmlLength,
- Op->Asl.AmlSubtreeLength,
- Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
- Op,
- Op->Asl.Child,
- Op->Asl.Parent,
- Op->Asl.CompileFlags,
- Op->Asl.AcpiBtype,
- Op->Asl.Column,
- Op->Asl.LineNumber);
+ DbgPrint (ASL_TREE_OUTPUT,
+ "%08X %04X %04X %01X %04X %04X %04X %04X %08X %08X %08X %08X %08X %04X %02d %02d\n",
+ /* 1 */ (UINT32) Op->Asl.Value.Integer,
+ /* 2 */ Op->Asl.ParseOpcode,
+ /* 3 */ Op->Asl.AmlOpcode,
+ /* 4 */ Op->Asl.AmlOpcodeLength,
+ /* 5 */ Op->Asl.AmlPkgLenBytes,
+ /* 6 */ Op->Asl.AmlLength,
+ /* 7 */ Op->Asl.AmlSubtreeLength,
+ /* 8 */ Op->Asl.Parent ? Op->Asl.Parent->Asl.AmlSubtreeLength : 0,
+ /* 9 */ Op,
+ /* 10 */ Op->Asl.Child,
+ /* 11 */ Op->Asl.Parent,
+ /* 12 */ Op->Asl.CompileFlags,
+ /* 13 */ Op->Asl.AcpiBtype,
+ /* 14 */ Op->Asl.FinalAmlLength,
+ /* 15 */ Op->Asl.Column,
+ /* 16 */ Op->Asl.LineNumber);
+
+ /* Generate the AML for this node */
- /*
- * Generate the AML for this node
- */
CgWriteNode (Op);
return (AE_OK);
}
@@ -222,7 +265,8 @@
*
* FUNCTION: CgLocalWriteAmlData
*
- * PARAMETERS: Buffer - Buffer to write
+ * PARAMETERS: Op - Current parse op
+ * Buffer - Buffer to write
* Length - Size of data in buffer
*
* RETURN: None
@@ -231,14 +275,13 @@
*
******************************************************************************/
-void
+static void
CgLocalWriteAmlData (
ACPI_PARSE_OBJECT *Op,
void *Buffer,
UINT32 Length)
{
-
/* Write the raw data to the AML file */
FlWriteFile (ASL_FILE_AML_OUTPUT, Buffer, Length);
@@ -264,22 +307,21 @@
*
******************************************************************************/
-void
+static void
CgWriteAmlOpcode (
- ACPI_PARSE_OBJECT *Op)
+ ACPI_PARSE_OBJECT *Op)
{
+ UINT8 PkgLenFirstByte;
+ UINT32 i;
union {
- UINT16 Opcode;
- UINT8 OpcodeBytes[2];
+ UINT16 Opcode;
+ UINT8 OpcodeBytes[2];
} Aml;
union {
- UINT32 Len;
- UINT8 LenBytes[4];
+ UINT32 Len;
+ UINT8 LenBytes[4];
} PkgLen;
- UINT8 PkgLenFirstByte;
- UINT32 i;
-
/* We expect some DEFAULT_ARGs, just ignore them */
@@ -354,19 +396,22 @@
CgLocalWriteAmlData (Op, &PkgLen.LenBytes[0], 1);
}
- else
+ else if (Op->Asl.AmlPkgLenBytes != 0)
{
/*
* Encode the "bytes to follow" in the first byte, top two bits.
* The low-order nybble of the length is in the bottom 4 bits
*/
- PkgLenFirstByte = (UINT8) (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
- (PkgLen.LenBytes[0] & 0x0F));
+ PkgLenFirstByte = (UINT8)
+ (((UINT32) (Op->Asl.AmlPkgLenBytes - 1) << 6) |
+ (PkgLen.LenBytes[0] & 0x0F));
CgLocalWriteAmlData (Op, &PkgLenFirstByte, 1);
- /* Shift the length over by the 4 bits we just stuffed in the first byte */
-
+ /*
+ * Shift the length over by the 4 bits we just stuffed
+ * in the first byte
+ */
PkgLen.Len >>= 4;
/* Now we can write the remaining bytes - either 1, 2, or 3 bytes */
@@ -382,17 +427,17 @@
{
case AML_BYTE_OP:
- CgLocalWriteAmlData (Op, (UINT8 *) &Op->Asl.Value.Integer, 1);
+ CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 1);
break;
case AML_WORD_OP:
- CgLocalWriteAmlData (Op, (UINT16 *) &Op->Asl.Value.Integer, 2);
+ CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 2);
break;
case AML_DWORD_OP:
- CgLocalWriteAmlData (Op, (UINT32 *) &Op->Asl.Value.Integer, 4);
+ CgLocalWriteAmlData (Op, &Op->Asl.Value.Integer, 4);
break;
case AML_QWORD_OP:
@@ -418,17 +463,17 @@
*
* PARAMETERS: Op - The DEFINITIONBLOCK node
*
- * RETURN: None.
+ * RETURN: None
*
* DESCRIPTION: Write a table header corresponding to the DEFINITIONBLOCK
*
******************************************************************************/
-void
+static void
CgWriteTableHeader (
- ACPI_PARSE_OBJECT *Op)
+ ACPI_PARSE_OBJECT *Op)
{
- ACPI_PARSE_OBJECT *Child;
+ ACPI_PARSE_OBJECT *Child;
/* AML filename */
@@ -475,7 +520,7 @@
TableHeader.AslCompilerRevision = CompilerCreatorRevision;
- /* Table length. Checksum zero for now, will rewrite later */
+ /* Table length. Checksum zero for now, will rewrite later */
TableHeader.Length = Gbl_TableLength;
TableHeader.Checksum = 0;
@@ -497,8 +542,9 @@
*
******************************************************************************/
-void
-CgCloseTable (void)
+static void
+CgCloseTable (
+ void)
{
signed char Sum;
UINT8 FileByte;
@@ -535,15 +581,13 @@
*
******************************************************************************/
-void
+static void
CgWriteNode (
ACPI_PARSE_OBJECT *Op)
{
ASL_RESOURCE_NODE *Rnode;
- Op->Asl.FinalAmlLength = 0;
-
/* Always check for DEFAULT_ARG and other "Noop" nodes */
/* TBD: this may not be the best place for this check */
@@ -555,6 +599,8 @@
return;
}
+ Op->Asl.FinalAmlLength = 0;
+
switch (Op->Asl.AmlOpcode)
{
case AML_RAW_DATA_BYTE:
Index: asloperands.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/asloperands.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/asloperands.c -L sys/contrib/dev/acpica/compiler/asloperands.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/asloperands.c
+++ sys/contrib/dev/acpica/compiler/asloperands.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asloperands - AML operand processing
- * $Revision: 46 $
+ * $Revision: 1.61 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,13 +116,90 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asloperands")
+/* Local prototypes */
+
+static void
+OpnDoField (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoBankField (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoBuffer (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoDefinitionBlock (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoFieldCommon (
+ ACPI_PARSE_OBJECT *FieldOp,
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoIndexField (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoLoadTable (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoMethod (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoMutex (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnDoRegion (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpnAttachNameToNode (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpnDoMutex
+ *
+ * PARAMETERS: Op - The parent parse node
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Construct the operands for the MUTEX ASL keyword.
+ *
+ ******************************************************************************/
+
+static void
+OpnDoMutex (
+ ACPI_PARSE_OBJECT *Op)
+{
+ ACPI_PARSE_OBJECT *Next;
+
+
+ Next = Op->Asl.Child;
+ Next = Next->Asl.Next;
+
+ if (Next->Asl.Value.Integer > 15)
+ {
+ AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL);
+ }
+ return;
+}
+
/*******************************************************************************
*
@@ -136,7 +213,7 @@
*
******************************************************************************/
-void
+static void
OpnDoMethod (
ACPI_PARSE_OBJECT *Op)
{
@@ -173,11 +250,15 @@
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
}
- /* Concurrency value (0-15 valid) */
+ /* Concurrency value (valid values are 0-15) */
Next = Next->Asl.Next;
if (Next->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
+ if (Next->Asl.Value.Integer > 15)
+ {
+ AslError (ASL_ERROR, ASL_MSG_SYNC_LEVEL, Next, NULL);
+ }
Concurrency = (UINT8) Next->Asl.Value.Integer;
}
@@ -214,7 +295,7 @@
*
******************************************************************************/
-void
+static void
OpnDoFieldCommon (
ACPI_PARSE_OBJECT *FieldOp,
ACPI_PARSE_OBJECT *Op)
@@ -305,7 +386,8 @@
* Not allowed to specify a backwards offset!
* Issue error and ignore this node.
*/
- AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode, NULL);
+ AslError (ASL_ERROR, ASL_MSG_BACKWARDS_OFFSET, PkgLengthNode,
+ NULL);
Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
PkgLengthNode->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
}
@@ -324,7 +406,8 @@
* Valid new offset - set the value to be inserted into the AML
* and update the offset counter.
*/
- PkgLengthNode->Asl.Value.Integer = NewBitOffset - CurrentBitOffset;
+ PkgLengthNode->Asl.Value.Integer =
+ NewBitOffset - CurrentBitOffset;
CurrentBitOffset = NewBitOffset;
}
break;
@@ -390,7 +473,7 @@
*
******************************************************************************/
-void
+static void
OpnDoField (
ACPI_PARSE_OBJECT *Op)
{
@@ -420,7 +503,7 @@
*
******************************************************************************/
-void
+static void
OpnDoIndexField (
ACPI_PARSE_OBJECT *Op)
{
@@ -454,7 +537,7 @@
*
******************************************************************************/
-void
+static void
OpnDoBankField (
ACPI_PARSE_OBJECT *Op)
{
@@ -493,7 +576,7 @@
*
******************************************************************************/
-void
+static void
OpnDoRegion (
ACPI_PARSE_OBJECT *Op)
{
@@ -541,7 +624,7 @@
*
******************************************************************************/
-void
+static void
OpnDoBuffer (
ACPI_PARSE_OBJECT *Op)
{
@@ -639,9 +722,9 @@
if (!BufferLength)
{
- /* No length AND no items -- issue a warning */
+ /* No length AND no items -- issue notice */
- AslError (ASL_WARNING, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL);
+ AslError (ASL_REMARK, ASL_MSG_BUFFER_LENGTH, BufferLengthOp, NULL);
/* But go ahead and put the buffer length of zero into the AML */
}
@@ -668,7 +751,9 @@
*
* RETURN: None
*
- * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword.
+ * DESCRIPTION: Construct the AML operands for the PACKAGE ASL keyword. NOTE:
+ * can only be called after constants have been folded, to ensure
+ * that the PackageLength operand has been fully reduced.
*
******************************************************************************/
@@ -678,23 +763,16 @@
{
ACPI_PARSE_OBJECT *InitializerOp;
ACPI_PARSE_OBJECT *PackageLengthOp;
+ UINT32 PackageLength = 0;
- /* Optional arguments for this opcode with defaults */
-
- UINT32 PackageLength = 0;
-
- /* Opcode and package length first */
- /* Buffer Length is next, followed by the initializer list */
+ /* Opcode and package length first, followed by the initializer list */
PackageLengthOp = Op->Asl.Child;
InitializerOp = PackageLengthOp->Asl.Next;
- /*
- * We always count the number of items in the initializer list, because if
- * it is larger than the buffer length, we will define the buffer size
- * to be the size of the initializer list (Per ACPI Spec)
- */
+ /* Count the number of items in the initializer list */
+
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
/* The peer list contains the byte list (if any...) */
@@ -706,43 +784,78 @@
}
}
- /* Check if initializer list is longer than the buffer length */
+ /* If package length is a constant, compare to the initializer list */
if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
- (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST))
+ (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST))
{
- if (PackageLengthOp->Asl.Value.Integer > PackageLength)
+ if (PackageLengthOp->Asl.Value.Integer >= PackageLength)
{
+ /* Allow package to be longer than the initializer list */
+
PackageLength = (UINT32) PackageLengthOp->Asl.Value.Integer;
}
+ else
+ {
+ /*
+ * Initializer list is longer than the package length. This
+ * is an error as per the ACPI spec.
+ */
+ AslError (ASL_ERROR, ASL_MSG_LIST_LENGTH,
+ PackageLengthOp->Asl.Next, NULL);
+ }
}
- /*
- * If not a variable-length package, check for a zero
- * package length
- */
+ if (PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ /*
+ * This is the case if the PackageLength was left empty - Package()
+ * The package length becomes the length of the initializer list
+ */
+ Op->Asl.Child->Asl.ParseOpcode = PARSEOP_INTEGER;
+ Op->Asl.Child->Asl.Value.Integer = PackageLength;
+
+ /* Set the AML opcode */
+
+ (void) OpcSetOptimalIntegerSize (Op->Asl.Child);
+ }
+
+ /* If not a variable-length package, check for a zero package length */
+
if ((PackageLengthOp->Asl.ParseOpcode == PARSEOP_INTEGER) ||
- (PackageLengthOp->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
+ (PackageLengthOp->Asl.ParseOpcode == PARSEOP_QWORDCONST) ||
(PackageLengthOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG))
{
if (!PackageLength)
{
- /* No length AND no items -- issue a warning */
+ /* No length AND no initializer list -- issue a remark */
- AslError (ASL_WARNING, ASL_MSG_PACKAGE_LENGTH, PackageLengthOp, NULL);
+ AslError (ASL_REMARK, ASL_MSG_PACKAGE_LENGTH,
+ PackageLengthOp, NULL);
/* But go ahead and put the buffer length of zero into the AML */
}
}
/*
- * Just set the buffer size node to be the buffer length, regardless
- * of whether it was previously an integer or a default_arg placeholder
+ * If the PackageLength is a constant <= 255, we can change the
+ * AML opcode from VarPackage to a simple (ACPI 1.0) Package opcode.
*/
- PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
- PackageLengthOp->Asl.AmlLength = 1;
- PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
- PackageLengthOp->Asl.Value.Integer = PackageLength;
+ if ((Op->Asl.Child->Asl.ParseOpcode == PARSEOP_INTEGER) &&
+ (Op->Asl.Child->Asl.Value.Integer <= 255))
+ {
+ Op->Asl.AmlOpcode = AML_PACKAGE_OP;
+ Op->Asl.ParseOpcode = PARSEOP_PACKAGE;
+
+ /*
+ * Just set the package size node to be the package length, regardless
+ * of whether it was previously an integer or a default_arg placeholder
+ */
+ PackageLengthOp->Asl.AmlOpcode = AML_RAW_DATA_BYTE;
+ PackageLengthOp->Asl.AmlLength = 1;
+ PackageLengthOp->Asl.ParseOpcode = PARSEOP_RAW_DATA;
+ PackageLengthOp->Asl.Value.Integer = PackageLength;
+ }
/* Remaining nodes are handled via the tree walk */
}
@@ -760,7 +873,7 @@
*
******************************************************************************/
-void
+static void
OpnDoLoadTable (
ACPI_PARSE_OBJECT *Op)
{
@@ -791,10 +904,12 @@
OpcGenerateAmlOpcode (Next);
}
+#ifdef ASL_FUTURE_IMPLEMENTATION
+
+ /* TBD: NOT IMPLEMENTED */
/* Fifth child is the [optional] ParameterPathString */
/* Sixth child is the [optional] ParameterData */
-/*
Next = Next->Asl.Next;
if (Next->Asl.ParseOpcode == DEFAULT_ARG)
{
@@ -811,7 +926,7 @@
Next->Asl.ParseOpcode = ZERO;
OpcGenerateAmlOpcode (Next);
}
- */
+#endif
}
@@ -827,7 +942,7 @@
*
******************************************************************************/
-void
+static void
OpnDoDefinitionBlock (
ACPI_PARSE_OBJECT *Op)
{
@@ -844,10 +959,12 @@
* as AML opcodes!
*/
- /* AML filename */
+ /* Get AML filename. Use it if non-null */
Child = Op->Asl.Child;
- if ((Child->Asl.Value.Buffer) && (Gbl_UseDefaultAmlFilename))
+ if (Child->Asl.Value.Buffer &&
+ *Child->Asl.Value.Buffer &&
+ (Gbl_UseDefaultAmlFilename))
{
Gbl_OutputFilenamePrefix = (char *) Child->Asl.Value.Buffer;
}
@@ -862,14 +979,16 @@
Gbl_TableSignature = Child->Asl.Value.String;
if (ACPI_STRLEN (Gbl_TableSignature) != 4)
{
- AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Length not exactly 4");
+ AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
+ "Length not exactly 4");
}
for (i = 0; i < 4; i++)
{
if (!isalnum (Gbl_TableSignature[i]))
{
- AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child, "Contains non-alphanumeric characters");
+ AslError (ASL_ERROR, ASL_MSG_TABLE_SIGNATURE, Child,
+ "Contains non-alphanumeric characters");
}
}
}
@@ -878,10 +997,9 @@
Child = Child->Asl.Next;
Child->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
-
- /* Use the revision to set the integer width */
-
- AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
+ /*
+ * We used the revision to set the integer width earlier
+ */
/* OEMID */
@@ -963,7 +1081,7 @@
*
******************************************************************************/
-void
+static void
OpnAttachNameToNode (
ACPI_PARSE_OBJECT *Op)
{
@@ -1062,6 +1180,10 @@
OpnDoMethod (Op);
break;
+ case PARSEOP_MUTEX:
+ OpnDoMutex (Op);
+ break;
+
case PARSEOP_FIELD:
OpnDoField (Op);
break;
@@ -1082,10 +1204,6 @@
OpnDoLoadTable (Op);
break;
- case PARSEOP_PACKAGE:
- OpnDoPackage (Op);
- break;
-
case PARSEOP_OPERATIONREGION:
OpnDoRegion (Op);
break;
Index: asltypes.h
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/asltypes.h,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/asltypes.h -L sys/contrib/dev/acpica/compiler/asltypes.h -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/asltypes.h
+++ sys/contrib/dev/acpica/compiler/asltypes.h
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asltypes.h - compiler data types and struct definitions
- * $Revision: 65 $
+ * $Revision: 1.89 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -120,9 +120,6 @@
#define __ASLTYPES_H
-#include <time.h>
-
-
/*******************************************************************************
*
* Structure definitions
@@ -150,6 +147,8 @@
#define NODE_WAS_ONES_OP 0x00008000
#define NODE_IS_NAME_DECLARATION 0x00010000
#define NODE_COMPILER_EMITTED 0x00020000
+#define NODE_IS_DUPLICATE 0x00040000
+#define NODE_IS_RESOURCE_DATA 0x00080000
/* Keeps information about individual control methods */
@@ -224,6 +223,13 @@
} ASL_FILE_INFO;
+typedef struct asl_file_status
+{
+ UINT32 Line;
+ UINT32 Offset;
+
+} ASL_FILE_STATUS;
+
/* File types */
@@ -290,212 +296,256 @@
typedef struct asl_event_info
{
- time_t StartTime;
- time_t EndTime;
+ UINT64 StartTime;
+ UINT64 EndTime;
char *EventName;
BOOLEAN Valid;
} ASL_EVENT_INFO;
-#define ASL_ERROR 0
-#define ASL_WARNING 1
-#define ASL_REMARK 2
-#define ASL_OPTIMIZATION 3
-#define ASL_NUM_REPORT_LEVELS 4
+#define ASL_WARNING 0
+#define ASL_WARNING2 1
+#define ASL_WARNING3 2
+#define ASL_ERROR 3
+#define ASL_REMARK 4
+#define ASL_OPTIMIZATION 5
+#define ASL_NUM_REPORT_LEVELS 6
typedef enum
{
- ASL_MSG_NULL = 0,
- ASL_MSG_MEMORY_ALLOCATION,
- ASL_MSG_INPUT_FILE_OPEN,
- ASL_MSG_OUTPUT_FILENAME,
- ASL_MSG_OUTPUT_FILE_OPEN,
- ASL_MSG_LISTING_FILENAME,
- ASL_MSG_LISTING_FILE_OPEN,
- ASL_MSG_DEBUG_FILENAME,
+ ASL_MSG_RESERVED = 0,
+ ASL_MSG_ALPHANUMERIC_STRING,
+ ASL_MSG_AML_NOT_IMPLEMENTED,
+ ASL_MSG_ARG_COUNT_HI,
+ ASL_MSG_ARG_COUNT_LO,
+ ASL_MSG_ARG_INIT,
+ ASL_MSG_BACKWARDS_OFFSET,
+ ASL_MSG_BITS_TO_BYTES,
+ ASL_MSG_BUFFER_LENGTH,
+ ASL_MSG_BYTES_TO_BITS,
+ ASL_MSG_CLOSE,
+ ASL_MSG_COMPILER_INTERNAL,
+ ASL_MSG_CONSTANT_EVALUATION,
+ ASL_MSG_CONSTANT_FOLDED,
+ ASL_MSG_CORE_EXCEPTION,
ASL_MSG_DEBUG_FILE_OPEN,
- ASL_MSG_INCLUDE_FILE_OPEN,
+ ASL_MSG_DEBUG_FILENAME,
+ ASL_MSG_DEPENDENT_NESTING,
+ ASL_MSG_DMA_CHANNEL,
+ ASL_MSG_DMA_LIST,
+ ASL_MSG_DUPLICATE_CASE,
+ ASL_MSG_DUPLICATE_ITEM,
+ ASL_MSG_EARLY_EOF,
ASL_MSG_ENCODING_LENGTH,
- ASL_MSG_INVALID_PRIORITY,
+ ASL_MSG_EX_INTERRUPT_LIST,
+ ASL_MSG_EX_INTERRUPT_NUMBER,
+ ASL_MSG_FIELD_ACCESS_WIDTH,
+ ASL_MSG_FIELD_UNIT_ACCESS_WIDTH,
+ ASL_MSG_FIELD_UNIT_OFFSET,
+ ASL_MSG_INCLUDE_FILE_OPEN,
+ ASL_MSG_INPUT_FILE_OPEN,
+ ASL_MSG_INTEGER_LENGTH,
+ ASL_MSG_INTEGER_OPTIMIZATION,
+ ASL_MSG_INTERRUPT_LIST,
+ ASL_MSG_INTERRUPT_NUMBER,
+ ASL_MSG_INVALID_CONSTANT_OP,
+ ASL_MSG_INVALID_EISAID,
+ ASL_MSG_INVALID_ESCAPE,
+ ASL_MSG_INVALID_OPERAND,
ASL_MSG_INVALID_PERFORMANCE,
+ ASL_MSG_INVALID_PRIORITY,
+ ASL_MSG_INVALID_STRING,
+ ASL_MSG_INVALID_TARGET,
+ ASL_MSG_INVALID_TIME,
+ ASL_MSG_INVALID_TYPE,
+ ASL_MSG_INVALID_UUID,
+ ASL_MSG_LIST_LENGTH,
+ ASL_MSG_LISTING_FILE_OPEN,
+ ASL_MSG_LISTING_FILENAME,
ASL_MSG_LOCAL_INIT,
- ASL_MSG_ARG_INIT,
- ASL_MSG_UNSUPPORTED,
- ASL_MSG_RESERVED_WORD,
- ASL_MSG_BUFFER_LENGTH,
- ASL_MSG_PACKAGE_LENGTH,
- ASL_MSG_RETURN_TYPES,
- ASL_MSG_NOT_FOUND,
- ASL_MSG_NOT_REACHABLE,
- ASL_MSG_NOT_EXIST,
+ ASL_MSG_LONG_LINE,
+ ASL_MSG_MEMORY_ALLOCATION,
+ ASL_MSG_MISSING_ENDDEPENDENT,
+ ASL_MSG_MISSING_STARTDEPENDENT,
+ ASL_MSG_MULTIPLE_TYPES,
+ ASL_MSG_NAME_EXISTS,
+ ASL_MSG_NAME_OPTIMIZATION,
ASL_MSG_NESTED_COMMENT,
- ASL_MSG_RESERVED_ARG_COUNT_HI,
- ASL_MSG_RESERVED_ARG_COUNT_LO,
- ASL_MSG_RESERVED_RETURN_VALUE,
- ASL_MSG_ARG_COUNT_HI,
- ASL_MSG_ARG_COUNT_LO,
+ ASL_MSG_NO_CASES,
ASL_MSG_NO_RETVAL,
- ASL_MSG_SOME_NO_RETVAL,
- ASL_MSG_COMPILER_INTERNAL,
- ASL_MSG_BACKWARDS_OFFSET,
- ASL_MSG_UNKNOWN_RESERVED_NAME,
- ASL_MSG_NAME_EXISTS,
- ASL_MSG_INVALID_TYPE,
- ASL_MSG_MULTIPLE_TYPES,
- ASL_MSG_SYNTAX,
+ ASL_MSG_NO_WHILE,
+ ASL_MSG_NON_ASCII,
+ ASL_MSG_NOT_EXIST,
+ ASL_MSG_NOT_FOUND,
ASL_MSG_NOT_METHOD,
- ASL_MSG_LONG_LINE,
- ASL_MSG_RECURSION,
ASL_MSG_NOT_PARAMETER,
+ ASL_MSG_NOT_REACHABLE,
ASL_MSG_OPEN,
+ ASL_MSG_OUTPUT_FILE_OPEN,
+ ASL_MSG_OUTPUT_FILENAME,
+ ASL_MSG_PACKAGE_LENGTH,
ASL_MSG_READ,
- ASL_MSG_WRITE,
- ASL_MSG_SEEK,
- ASL_MSG_CLOSE,
- ASL_MSG_FIELD_ACCESS_WIDTH,
- ASL_MSG_REGION_BYTE_ACCESS,
+ ASL_MSG_RECURSION,
ASL_MSG_REGION_BUFFER_ACCESS,
- ASL_MSG_FIELD_UNIT_OFFSET,
- ASL_MSG_FIELD_UNIT_ACCESS_WIDTH,
- ASL_MSG_RESOURCE_FIELD,
- ASL_MSG_BYTES_TO_BITS,
- ASL_MSG_BITS_TO_BYTES,
- ASL_MSG_AML_NOT_IMPLEMENTED,
- ASL_MSG_NO_WHILE,
- ASL_MSG_INVALID_ESCAPE,
- ASL_MSG_INVALID_STRING,
- ASL_MSG_TABLE_SIGNATURE,
- ASL_MSG_RESOURCE_LIST,
- ASL_MSG_INVALID_TARGET,
- ASL_MSG_INVALID_CONSTANT_OP,
- ASL_MSG_CONSTANT_EVALUATION,
- ASL_MSG_CONSTANT_FOLDED,
- ASL_MSG_INVALID_EISAID,
- ASL_MSG_RESERVED_OPERAND_TYPE,
+ ASL_MSG_REGION_BYTE_ACCESS,
+ ASL_MSG_RESERVED_ARG_COUNT_HI,
+ ASL_MSG_RESERVED_ARG_COUNT_LO,
ASL_MSG_RESERVED_METHOD,
- ASL_MSG_ALPHANUMERIC_STRING,
+ ASL_MSG_RESERVED_OPERAND_TYPE,
+ ASL_MSG_RESERVED_RETURN_VALUE,
ASL_MSG_RESERVED_USE,
- ASL_MSG_INVALID_OPERAND,
- ASL_MSG_MISSING_ENDDEPENDENT,
- ASL_MSG_MISSING_STARTDEPENDENT,
- ASL_MSG_DEPENDENT_NESTING,
- ASL_MSG_NAME_OPTIMIZATION,
- ASL_MSG_SINGLE_NAME_OPTIMIZATION,
- ASL_MSG_INTEGER_OPTIMIZATION,
+ ASL_MSG_RESERVED_WORD,
+ ASL_MSG_RESOURCE_FIELD,
+ ASL_MSG_RESOURCE_INDEX,
+ ASL_MSG_RESOURCE_LIST,
+ ASL_MSG_RESOURCE_SOURCE,
+ ASL_MSG_RETURN_TYPES,
+ ASL_MSG_SCOPE_FWD_REF,
ASL_MSG_SCOPE_TYPE,
- ASL_MSG_CORE_EXCEPTION,
+ ASL_MSG_SEEK,
+ ASL_MSG_SINGLE_NAME_OPTIMIZATION,
+ ASL_MSG_SOME_NO_RETVAL,
+ ASL_MSG_SWITCH_TYPE,
+ ASL_MSG_SYNC_LEVEL,
+ ASL_MSG_SYNTAX,
+ ASL_MSG_TABLE_SIGNATURE,
+ ASL_MSG_TOO_MANY_TEMPS,
+ ASL_MSG_UNKNOWN_RESERVED_NAME,
ASL_MSG_UNREACHABLE_CODE,
- ASL_MSG_EARLY_EOF,
- ASL_MSG_SCOPE_FWD_REF,
- ASL_MSG_NON_ASCII,
- ASL_MSG_INVALID_TIME,
- ASL_MSG_DUPLICATE_CASE,
- ASL_MSG_NO_CASES,
- ASL_MSG_INVALID_UUID
+ ASL_MSG_UNSUPPORTED,
+ ASL_MSG_VENDOR_LIST,
+ ASL_MSG_WRITE,
+ ASL_MSG_MULTIPLE_DEFAULT,
+ ASL_MSG_TIMEOUT,
+ ASL_MSG_RESULT_NOT_USED,
+ ASL_MSG_NOT_REFERENCED,
+ ASL_MSG_NON_ZERO,
+ ASL_MSG_STRING_LENGTH
} ASL_MESSAGE_IDS;
#ifdef ASL_EXCEPTIONS
char *AslMessages [] = {
-/* ASL_MSG_NULL */ NULL,
-/* ASL_MSG_MEMORY_ALLOCATION, */ "Memory allocation failure",
-/* ASL_MSG_INPUT_FILE_OPEN, */ "Could not open input file",
-/* ASL_MSG_OUTPUT_FILENAME, */ "Could not create output filename",
-/* ASL_MSG_OUTPUT_FILE_OPEN, */ "Could not open output AML file",
-/* ASL_MSG_LISTING_FILENAME, */ "Could not create listing filename",
-/* ASL_MSG_LISTING_FILE_OPEN, */ "Could not open listing file",
-/* ASL_MSG_DEBUG_FILENAME, */ "Could not create debug filename",
-/* ASL_MSG_DEBUG_FILE_OPEN, */ "Could not open debug file",
-/* ASL_MSG_INCLUDE_FILE_OPEN, */ "Could not open include file",
-/* ASL_MSG_ENCODING_LENGTH, */ "Package length too long to encode",
-/* ASL_MSG_INVALID_PRIORITY, */ "Invalid priority value",
-/* ASL_MSG_INVALID_PERFORMANCE, */ "Invalid performance/robustness value",
-/* ASL_MSG_LOCAL_INIT, */ "Method local variable is not initialized",
-/* ASL_MSG_ARG_INIT, */ "Method argument is not initialized",
-/* ASL_MSG_UNSUPPORTED, */ "Unsupported feature",
-/* ASL_MSG_RESERVED_WORD, */ "Use of reserved word",
-/* ASL_MSG_BUFFER_LENGTH, */ "Effective AML buffer length is zero",
-/* ASL_MSG_PACKAGE_LENGTH, */ "Effective AML package length is zero",
-/* ASL_MSG_RETURN_TYPES, */ "Not all control paths return a value",
-/* ASL_MSG_NOT_FOUND, */ "Object not found or not accessible from scope",
-/* ASL_MSG_NOT_REACHABLE, */ "Object not accessible from this scope",
-/* ASL_MSG_NOT_EXIST, */ "Object does not exist",
-/* ASL_MSG_NESTED_COMMENT, */ "Nested comment found",
-/* ASL_MSG_RESERVED_ARG_COUNT_HI, */ "Reserved method has too many arguments",
-/* ASL_MSG_RESERVED_ARG_COUNT_LO, */ "Reserved method has too few arguments",
-/* ASL_MSG_RESERVED_RETURN_VALUE, */ "Reserved method must return a value",
-/* ASL_MSG_ARG_COUNT_HI, */ "Too many arguments",
-/* ASL_MSG_ARG_COUNT_LO, */ "Too few arguments",
-/* ASL_MSG_NO_RETVAL, */ "Called method returns no value",
-/* ASL_MSG_SOME_NO_RETVAL, */ "Called method may not always return a value",
-/* ASL_MSG_COMPILER_INTERNAL, */ "Internal compiler error",
-/* ASL_MSG_BACKWARDS_OFFSET, */ "Invalid backwards offset",
-/* ASL_MSG_UNKNOWN_RESERVED_NAME, */ "Unknown reserved name",
-/* ASL_MSG_NAME_EXISTS, */ "Name already exists in scope",
-/* ASL_MSG_INVALID_TYPE, */ "Invalid type",
-/* ASL_MSG_MULTIPLE_TYPES, */ "Multiple types",
-/* ASL_MSG_SYNTAX, */ "",
-/* ASL_MSG_NOT_METHOD, */ "Not a control method, cannot invoke",
-/* ASL_MSG_LONG_LINE, */ "Splitting long input line",
-/* ASL_MSG_RECURSION, */ "Recursive method call",
-/* ASL_MSG_NOT_PARAMETER, */ "Not a parameter, used as local only",
-/* ASL_MSG_OPEN, */ "Could not open file",
-/* ASL_MSG_READ, */ "Could not read file",
-/* ASL_MSG_WRITE, */ "Could not write file",
-/* ASL_MSG_SEEK, */ "Could not seek file",
-/* ASL_MSG_CLOSE, */ "Could not close file",
-/* ASL_MSG_FIELD_ACCESS_WIDTH, */ "Access width is greater than region size",
-/* ASL_MSG_REGION_BYTE_ACCESS, */ "Host Operation Region requires ByteAcc access",
-/* ASL_MSG_REGION_BUFFER_ACCESS, */ "Host Operation Region requires BufferAcc access",
-/* ASL_MSG_FIELD_UNIT_OFFSET, */ "Field Unit extends beyond region limit",
-/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH, */ "Access width of Field Unit extends beyond region limit",
-/* ASL_MSG_RESOURCE_FIELD, */ "Resource field name cannot be used as a target",
-/* ASL_MSG_BYTES_TO_BITS, */ "Field offset is in bytes, but a bit offset is required",
-/* ASL_MSG_BITS_TO_BYTES, */ "Field offset is in bits, but a byte offset is required",
-/* ASL_MSG_AML_NOT_IMPLEMENTED, */ "Opcode is not implemented in compiler AML code generator",
-/* ASL_MSG_NO_WHILE, */ "No enclosing While statement",
-/* ASL_MSG_INVALID_ESCAPE, */ "Invalid or unknown escape sequence",
-/* ASL_MSG_INVALID_STRING, */ "Invalid Hex/Octal Escape - Non-ASCII or NULL",
-/* ASL_MSG_TABLE_SIGNATURE, */ "Invalid Table Signature",
-/* ASL_MSG_RESOURCE_LIST, */ "Too many resource items (internal error)",
-/* ASL_MSG_INVALID_TARGET, */ "Target operand not allowed in constant expression",
-/* ASL_MSG_INVALID_CONSTANT_OP, */ "Invalid operator in constant expression (not type 3/4/5)",
-/* ASL_MSG_CONSTANT_EVALUATION, */ "Could not evaluate constant expression",
-/* ASL_MSG_CONSTANT_FOLDED, */ "Constant expression evaluated and reduced",
-/* ASL_MSG_INVALID_EISAID, */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
-/* ASL_MSG_RESERVED_OPERAND_TYPE, */ "Invalid operand type for reserved name, must be",
-/* ASL_MSG_RESERVED_METHOD, */ "Reserved name must be a control method",
-/* ASL_MSG_ALPHANUMERIC_STRING, */ "String must be entirely alphanumeric",
-/* ASL_MSG_RESERVED_USE, */ "Invalid use of reserved name",
-/* ASL_MSG_INVALID_OPERAND, */ "Invalid operand",
-/* ASL_MSG_MISSING_ENDDEPENDENT, */ "Missing EndDependentFn() macro in dependent resource list",
-/* ASL_MSG_MISSING_STARTDEPENDENT, */ "Missing StartDependentFn() macro in dependent resource list",
-/* ASL_MSG_DEPENDENT_NESTING, */ "Dependent function macros cannot be nested",\
-/* ASL_MSG_NAME_OPTIMIZATION, */ "NamePath optimized",
-/* ASL_MSG_SINGLE_NAME_OPTIMIZATION, */ "NamePath optimized to NameSeg (uses run-time search path)",
-/* ASL_MSG_INTEGER_OPTIMIZATION, */ "Integer optimized to single-byte AML opcode",
-/* ASL_MSG_SCOPE_TYPE, */ "Existing object has invalid type for Scope operator",
-/* ASL_MSG_CORE_EXCEPTION, */ "From ACPI CA Subsystem",
-/* ASL_MSG_UNREACHABLE_CODE, */ "Statement is unreachable",
+/* The zeroth message is resesrved */ "",
+/* ASL_MSG_ALPHANUMERIC_STRING */ "String must be entirely alphanumeric",
+/* ASL_MSG_AML_NOT_IMPLEMENTED */ "Opcode is not implemented in compiler AML code generator",
+/* ASL_MSG_ARG_COUNT_HI */ "Too many arguments",
+/* ASL_MSG_ARG_COUNT_LO */ "Too few arguments",
+/* ASL_MSG_ARG_INIT */ "Method argument is not initialized",
+/* ASL_MSG_BACKWARDS_OFFSET */ "Invalid backwards offset",
+/* ASL_MSG_BITS_TO_BYTES */ "Field offset is in bits, but a byte offset is required",
+/* ASL_MSG_BUFFER_LENGTH */ "Effective AML buffer length is zero",
+/* ASL_MSG_BYTES_TO_BITS */ "Field offset is in bytes, but a bit offset is required",
+/* ASL_MSG_CLOSE */ "Could not close file",
+/* ASL_MSG_COMPILER_INTERNAL */ "Internal compiler error",
+/* ASL_MSG_CONSTANT_EVALUATION */ "Could not evaluate constant expression",
+/* ASL_MSG_CONSTANT_FOLDED */ "Constant expression evaluated and reduced",
+/* ASL_MSG_CORE_EXCEPTION */ "From ACPI CA Subsystem",
+/* ASL_MSG_DEBUG_FILE_OPEN */ "Could not open debug file",
+/* ASL_MSG_DEBUG_FILENAME */ "Could not create debug filename",
+/* ASL_MSG_DEPENDENT_NESTING */ "Dependent function macros cannot be nested",\
+/* ASL_MSG_DMA_CHANNEL */ "Invalid DMA channel (must be 0-7)",
+/* ASL_MSG_DMA_LIST */ "Too many DMA channels (8 max)",
+/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified",
+/* ASL_MSG_DUPLICATE_ITEM */ "Duplicate value in list",
/* ASL_MSG_EARLY_EOF */ "Premature end-of-file reached",
-/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope() not allowed",
-/* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
+/* ASL_MSG_ENCODING_LENGTH */ "Package length too long to encode",
+/* ASL_MSG_EX_INTERRUPT_LIST */ "Too many interrupts (255 max)",
+/* ASL_MSG_EX_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 32 bits)",
+/* ASL_MSG_FIELD_ACCESS_WIDTH */ "Access width is greater than region size",
+/* ASL_MSG_FIELD_UNIT_ACCESS_WIDTH */ "Access width of Field Unit extends beyond region limit",
+/* ASL_MSG_FIELD_UNIT_OFFSET */ "Field Unit extends beyond region limit",
+/* ASL_MSG_INCLUDE_FILE_OPEN */ "Could not open include file",
+/* ASL_MSG_INPUT_FILE_OPEN */ "Could not open input file",
+/* ASL_MSG_INTEGER_LENGTH */ "64-bit integer in 32-bit table, truncating",
+/* ASL_MSG_INTEGER_OPTIMIZATION */ "Integer optimized to single-byte AML opcode",
+/* ASL_MSG_INTERRUPT_LIST */ "Too many interrupts (16 max)",
+/* ASL_MSG_INTERRUPT_NUMBER */ "Invalid interrupt number (must be 0-15)",
+/* ASL_MSG_INVALID_CONSTANT_OP */ "Invalid operator in constant expression (not type 3/4/5)",
+/* ASL_MSG_INVALID_EISAID */ "EISAID string must be of the form \"UUUXXXX\" (3 uppercase, 4 hex digits)",
+/* ASL_MSG_INVALID_ESCAPE */ "Invalid or unknown escape sequence",
+/* ASL_MSG_INVALID_OPERAND */ "Invalid operand",
+/* ASL_MSG_INVALID_PERFORMANCE */ "Invalid performance/robustness value",
+/* ASL_MSG_INVALID_PRIORITY */ "Invalid priority value",
+/* ASL_MSG_INVALID_STRING */ "Invalid Hex/Octal Escape - Non-ASCII or NULL",
+/* ASL_MSG_INVALID_TARGET */ "Target operand not allowed in constant expression",
/* ASL_MSG_INVALID_TIME */ "Time parameter too long (255 max)",
-/* ASL_MSG_DUPLICATE_CASE */ "Case value already specified",
-/* ASL_MSG_NO_CASES */ "No Case() statements under Switch()",
-/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\""
-
-
+/* ASL_MSG_INVALID_TYPE */ "Invalid type",
+/* ASL_MSG_INVALID_UUID */ "UUID string must be of the form \"aabbccdd-eeff-gghh-iijj-kkllmmnnoopp\"",
+/* ASL_MSG_LIST_LENGTH */ "Initializer list too long",
+/* ASL_MSG_LISTING_FILE_OPEN */ "Could not open listing file",
+/* ASL_MSG_LISTING_FILENAME */ "Could not create listing filename",
+/* ASL_MSG_LOCAL_INIT */ "Method local variable is not initialized",
+/* ASL_MSG_LONG_LINE */ "Splitting long input line",
+/* ASL_MSG_MEMORY_ALLOCATION */ "Memory allocation failure",
+/* ASL_MSG_MISSING_ENDDEPENDENT */ "Missing EndDependentFn() macro in dependent resource list",
+/* ASL_MSG_MISSING_STARTDEPENDENT */ "Missing StartDependentFn() macro in dependent resource list",
+/* ASL_MSG_MULTIPLE_TYPES */ "Multiple types",
+/* ASL_MSG_NAME_EXISTS */ "Name already exists in scope",
+/* ASL_MSG_NAME_OPTIMIZATION */ "NamePath optimized",
+/* ASL_MSG_NESTED_COMMENT */ "Nested comment found",
+/* ASL_MSG_NO_CASES */ "No Case statements under Switch",
+/* ASL_MSG_NO_RETVAL */ "Called method returns no value",
+/* ASL_MSG_NO_WHILE */ "No enclosing While statement",
+/* ASL_MSG_NON_ASCII */ "Invalid characters found in file",
+/* ASL_MSG_NOT_EXIST */ "Object does not exist",
+/* ASL_MSG_NOT_FOUND */ "Object not found or not accessible from scope",
+/* ASL_MSG_NOT_METHOD */ "Not a control method, cannot invoke",
+/* ASL_MSG_NOT_PARAMETER */ "Not a parameter, used as local only",
+/* ASL_MSG_NOT_REACHABLE */ "Object is not accessible from this scope",
+/* ASL_MSG_OPEN */ "Could not open file",
+/* ASL_MSG_OUTPUT_FILE_OPEN */ "Could not open output AML file",
+/* ASL_MSG_OUTPUT_FILENAME */ "Could not create output filename",
+/* ASL_MSG_PACKAGE_LENGTH */ "Effective AML package length is zero",
+/* ASL_MSG_READ */ "Could not read file",
+/* ASL_MSG_RECURSION */ "Recursive method call",
+/* ASL_MSG_REGION_BUFFER_ACCESS */ "Host Operation Region requires BufferAcc access",
+/* ASL_MSG_REGION_BYTE_ACCESS */ "Host Operation Region requires ByteAcc access",
+/* ASL_MSG_RESERVED_ARG_COUNT_HI */ "Reserved method has too many arguments",
+/* ASL_MSG_RESERVED_ARG_COUNT_LO */ "Reserved method has too few arguments",
+/* ASL_MSG_RESERVED_METHOD */ "Reserved name must be a control method",
+/* ASL_MSG_RESERVED_OPERAND_TYPE */ "Invalid operand type for reserved name, must be",
+/* ASL_MSG_RESERVED_RETURN_VALUE */ "Reserved method must return a value",
+/* ASL_MSG_RESERVED_USE */ "Invalid use of reserved name",
+/* ASL_MSG_RESERVED_WORD */ "Use of reserved word",
+/* ASL_MSG_RESOURCE_FIELD */ "Resource field name cannot be used as a target",
+/* ASL_MSG_RESOURCE_INDEX */ "Missing ResourceSourceIndex (required)",
+/* ASL_MSG_RESOURCE_LIST */ "Too many resource items (internal error)",
+/* ASL_MSG_RESOURCE_SOURCE */ "Missing ResourceSource string (required)",
+/* ASL_MSG_RETURN_TYPES */ "Not all control paths return a value",
+/* ASL_MSG_SCOPE_FWD_REF */ "Forward references from Scope operator not allowed",
+/* ASL_MSG_SCOPE_TYPE */ "Existing object has invalid type for Scope operator",
+/* ASL_MSG_SEEK */ "Could not seek file",
+/* ASL_MSG_SINGLE_NAME_OPTIMIZATION */ "NamePath optimized to NameSeg (uses run-time search path)",
+/* ASL_MSG_SOME_NO_RETVAL */ "Called method may not always return a value",
+/* ASL_MSG_SWITCH_TYPE */ "Switch expression is not a static Integer/Buffer/String data type, defaulting to Integer",
+/* ASL_MSG_SYNC_LEVEL */ "SyncLevel must be in the range 0-15",
+/* ASL_MSG_SYNTAX */ "",
+/* ASL_MSG_TABLE_SIGNATURE */ "Invalid Table Signature",
+/* ASL_MSG_TOO_MANY_TEMPS */ "Method requires too many temporary variables (_T_x)",
+/* ASL_MSG_UNKNOWN_RESERVED_NAME */ "Unknown reserved name",
+/* ASL_MSG_UNREACHABLE_CODE */ "Statement is unreachable",
+/* ASL_MSG_UNSUPPORTED */ "Unsupported feature",
+/* ASL_MSG_VENDOR_LIST */ "Too many vendor data bytes (7 max)",
+/* ASL_MSG_WRITE */ "Could not write file",
+/* ASL_MSG_MULTIPLE_DEFAULT */ "More than one Default statement within Switch construct",
+/* ASL_MSG_TIMEOUT */ "Possible operator timeout is ignored",
+/* ASL_MSG_RESULT_NOT_USED */ "Result is not used, operator has no effect",
+/* ASL_MSG_NOT_REFERENCED */ "Namespace object is not referenced",
+/* ASL_MSG_NON_ZERO */ "Operand evaluates to zero",
+/* ASL_MSG_STRING_LENGTH */ "String literal too long"
};
char *AslErrorLevel [ASL_NUM_REPORT_LEVELS] = {
- "Error ",
"Warning ",
+ "Warning ",
+ "Warning ",
+ "Error ",
"Remark ",
"Optimize"
};
@@ -504,7 +554,7 @@
/* Exception counters */
-UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0};
+UINT32 Gbl_ExceptionCount[ASL_NUM_REPORT_LEVELS] = {0,0,0,0,0,0};
#endif
Index: aslcompiler.y
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslcompiler.y,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslcompiler.y -L sys/contrib/dev/acpica/compiler/aslcompiler.y -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslcompiler.y
+++ sys/contrib/dev/acpica/compiler/aslcompiler.y
@@ -3,7 +3,7 @@
/******************************************************************************
*
* Module Name: aslcompiler.y - Bison input file (ASL grammar and actions)
- * $Revision: $
+ * $Revision: 1.105 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -124,15 +124,28 @@
*/
#define YYINITDEPTH 600
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "acpi.h"
+#include <contrib/dev/acpica/acpi.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslparse")
+/*
+ * Global Notes:
+ *
+ * October 2005: The following list terms have been optimized (from the
+ * original ASL grammar in the ACPI specification) to force the immediate
+ * reduction of each list item so that the parse stack use doesn't increase on
+ * each list element and possibly overflow on very large lists (>4000 items).
+ * This dramatically reduces use of the parse stack overall.
+ *
+ * ArgList, TermList, Objectlist, ByteList, DWordList, PackageList,
+ * ResourceMacroList, and FieldUnitList
+ */
+
/*
* Next statement is important - this makes everything public so that
@@ -166,14 +179,20 @@
*/
%union {
- UINT64 i;
- char *s;
- ACPI_PARSE_OBJECT *n;
+ UINT64 i;
+ char *s;
+ ACPI_PARSE_OBJECT *n;
}
/*! [Begin] no source code translation */
+/*
+ * These shift/reduce conflicts are expected. There should be zer0
+ * reduce/reduce conflicts.
+ */
+%expect 64
+
/*
* Token types: These are returned by the lexer
@@ -255,6 +274,7 @@
%token <i> PARSEOP_ELSE
%token <i> PARSEOP_ELSEIF
%token <i> PARSEOP_ENDDEPENDENTFN
+%token <i> PARSEOP_ENDTAG
%token <i> PARSEOP_ERRORNODE
%token <i> PARSEOP_EVENT
%token <i> PARSEOP_EXTENDEDIO
@@ -353,6 +373,7 @@
%token <i> PARSEOP_OBJECTTYPE_OPR
%token <i> PARSEOP_OBJECTTYPE_PKG
%token <i> PARSEOP_OBJECTTYPE_POW
+%token <i> PARSEOP_OBJECTTYPE_PRO
%token <i> PARSEOP_OBJECTTYPE_STR
%token <i> PARSEOP_OBJECTTYPE_THZ
%token <i> PARSEOP_OBJECTTYPE_UNK
@@ -463,7 +484,6 @@
%type <n> NameSpaceModifier
%type <n> UserTerm
%type <n> ArgList
-%type <n> ArgListTail
%type <n> TermArg
%type <n> Target
%type <n> RequiredTarget
@@ -493,7 +513,6 @@
%type <n> ExternalTerm
%type <n> FieldUnitList
-%type <n> FieldUnitListTail
%type <n> FieldUnit
%type <n> FieldUnitEntry
@@ -551,8 +570,8 @@
%type <n> SleepTerm
%type <n> StallTerm
%type <n> SwitchTerm
-%type <n> CaseTermList
-%type <n> DefaultTermList
+%type <n> CaseDefaultTermList
+//%type <n> CaseTermList
%type <n> CaseTerm
%type <n> DefaultTerm
%type <n> UnloadTerm
@@ -611,6 +630,7 @@
%type <n> XOrTerm
%type <n> OptionalTermArg
+%type <n> OptionalReturnArg
%type <n> OptionalListString
@@ -626,7 +646,7 @@
%type <n> MatchOpKeyword
%type <n> SerializeRuleKeyword
%type <n> DMATypeKeyword
-%type <n> BusMasterKeyword
+%type <n> OptionalBusMasterKeyword
%type <n> XferTypeKeyword
%type <n> ResourceTypeKeyword
%type <n> MinKeyword
@@ -634,7 +654,7 @@
%type <n> DecodeKeyword
%type <n> RangeTypeKeyword
%type <n> MemTypeKeyword
-%type <n> ReadWriteKeyword
+%type <n> OptionalReadWriteKeyword
%type <n> InterruptTypeKeyword
%type <n> InterruptLevel
%type <n> ShareTypeKeyword
@@ -650,19 +670,11 @@
%type <n> LocalTerm
%type <n> DebugTerm
-
%type <n> Integer
-
%type <n> ByteConst
%type <n> WordConst
%type <n> DWordConst
%type <n> QWordConst
-
-/* Useless
-%type <n> WordConst
-%type <n> QWordConst
-*/
-
%type <n> String
%type <n> ConstTerm
@@ -674,14 +686,10 @@
%type <n> BufferTerm
%type <n> ByteList
-%type <n> ByteListTail
%type <n> DWordList
-%type <n> DWordListTail
%type <n> PackageTerm
-%type <n> PackageLengthTerm
%type <n> PackageList
-%type <n> PackageListTail
%type <n> PackageElement
%type <n> VarPackageLengthTerm
@@ -756,6 +764,7 @@
%type <n> OptionalParameterTypePackage
%type <n> OptionalParameterTypesPackage
%type <n> OptionalReference
+%type <n> OptionalAccessSize
%type <n> TermArgItem
@@ -793,15 +802,15 @@
String ','
DWordConst
')' {TrSetEndLineNumber ($<n>3);}
- '{' ObjectList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}
+ '{' TermList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$6,$8,$10,$12,$14,$18);}
;
/* ACPI 3.0 -- allow semicolons between terms */
TermList
: {$$ = NULL;}
- | Term TermList {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
- | Term ';' TermList {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
+ | TermList Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$2);}
+ | TermList ';' Term {$$ = TrLinkPeerNode (TrSetNodeFlags ($1, NODE_RESULT_NOT_USED),$3);}
;
Term
@@ -824,7 +833,7 @@
ObjectList
: {$$ = NULL;}
- | Object ObjectList {$$ = TrLinkPeerNode ($1,$2);}
+ | ObjectList Object {$$ = TrLinkPeerNode ($1,$2);}
| error {$$ = AslDoError(); yyclearin;}
;
@@ -899,21 +908,23 @@
ArgList
: {$$ = NULL;}
- | TermArg ArgListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-ArgListTail
- : {$$ = NULL;}
- | ',' TermArg ArgListTail {$$ = TrLinkPeerNode ($2,$3);}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
+ | TermArg
+ | ArgList ',' /* Allows a trailing comma at list end */
+ | ArgList ','
+ TermArg {$$ = TrLinkPeerNode ($1,$3);}
;
-TermArg
- : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+/*
+Removed from TermArg due to reduce/reduce conflicts
| Type2IntegerOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2StringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2BufferOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| Type2BufferOrStringOpcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
+
+*/
+
+TermArg
+ : Type2Opcode {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| DataObject {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| NameString {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
| ArgTerm {$$ = TrSetNodeFlags ($1, NODE_IS_TERM_ARG);}
@@ -936,50 +947,43 @@
| ArgTerm {}
;
-/* Rules for specifying the Return type for control methods */
+/* Rules for specifying the type of one method argument or return value */
-ParameterTypePackageList
+ParameterTypePackage
: {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;}
- | ObjectTypeKeyword ','
- ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);}
+ | ParameterTypePackage ','
+ ObjectTypeKeyword {$$ = TrLinkPeerNodes (2,$1,$3);}
;
-ParameterTypePackage
+ParameterTypePackageList
: {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;}
- | '{'
- ParameterTypePackageList
- '}' {$$ = $2;}
+ | '{' ParameterTypePackage '}' {$$ = $2;}
;
OptionalParameterTypePackage
: {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' ParameterTypePackage {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
+ | ',' ParameterTypePackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
;
-/* Rules for specifying the Argument types for control methods */
+/* Rules for specifying the types for method arguments */
-ParameterTypesPackageList
- : {$$ = NULL;}
- | ObjectTypeKeyword {$$ = $1;}
- | ObjectTypeKeyword ','
- ParameterTypesPackage {$$ = TrLinkPeerNodes (2,$1,$3);}
+ParameterTypesPackage
+ : ParameterTypePackageList {$$ = $1;}
+ | ParameterTypesPackage ','
+ ParameterTypePackageList {$$ = TrLinkPeerNodes (2,$1,$3);}
;
-ParameterTypesPackage
+ParameterTypesPackageList
: {$$ = NULL;}
| ObjectTypeKeyword {$$ = $1;}
- | '{'
- ParameterTypesPackageList
- '}' {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
+ | '{' ParameterTypesPackage '}' {$$ = $2;}
;
OptionalParameterTypesPackage
: {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
- | ',' ParameterTypesPackage {$$ = $2;}
+ | ',' ParameterTypesPackageList {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_DEFAULT_ARG),1,$2);}
;
@@ -1153,20 +1157,15 @@
')' '{'
FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,7,$4,$5,$6,$8,$10,$12,$15);}
| PARSEOP_BANKFIELD '('
- error ')' {$$ = AslDoError(); yyclearin;}
+ error ')' '{' error '}' {$$ = AslDoError(); yyclearin;}
;
FieldUnitList
: {$$ = NULL;}
| FieldUnit
- FieldUnitListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-FieldUnitListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' FieldUnit
- FieldUnitListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | FieldUnitList ',' /* Allows a trailing comma at list end */
+ | FieldUnitList ','
+ FieldUnit {$$ = TrLinkPeerNode ($1,$3);}
;
FieldUnit
@@ -1296,7 +1295,7 @@
')' '{'
FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$10,$13);}
| PARSEOP_FIELD '('
- error ')' {$$ = AslDoError(); yyclearin;}
+ error ')' '{' error '}' {$$ = AslDoError(); yyclearin;}
;
FunctionTerm
@@ -1306,8 +1305,8 @@
OptionalParameterTypesPackage
')' '{'
TermList '}' {$$ = TrLinkChildren ($<n>3,7,TrSetNodeFlags ($4, NODE_IS_NAME_DECLARATION),
- TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),
- TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL),
+ TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),
+ TrCreateLeafNode (PARSEOP_SERIALIZERULE_NOTSERIAL),
TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0),$5,$6,$9);}
| PARSEOP_FUNCTION '('
error ')' {$$ = AslDoError(); yyclearin;}
@@ -1323,7 +1322,7 @@
')' '{'
FieldUnitList '}' {$$ = TrLinkChildren ($<n>3,6,$4,$5,$7,$9,$11,$14);}
| PARSEOP_INDEXFIELD '('
- error ')' {$$ = AslDoError(); yyclearin;}
+ error ')' '{' error '}' {$$ = AslDoError(); yyclearin;}
;
MethodTerm
@@ -1462,8 +1461,8 @@
: PARSEOP_IF '(' {$$ = TrCreateLeafNode (PARSEOP_IF);}
TermArg
')' '{'
- TermList '}'
- {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+ TermList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
+
| PARSEOP_IF '('
error ')' {$$ = AslDoError(); yyclearin;}
;
@@ -1471,19 +1470,26 @@
ElseTerm
: {$$ = NULL;}
| PARSEOP_ELSE '{' {$$ = TrCreateLeafNode (PARSEOP_ELSE);}
- TermList '}'
- {$$ = TrLinkChildren ($<n>3,1,$4);}
+ TermList '}' {$$ = TrLinkChildren ($<n>3,1,$4);}
+
| PARSEOP_ELSE '{'
error '}' {$$ = AslDoError(); yyclearin;}
+ | PARSEOP_ELSE
+ error {$$ = AslDoError(); yyclearin;}
+
| PARSEOP_ELSEIF '(' {$$ = TrCreateLeafNode (PARSEOP_ELSE);}
TermArg {$$ = TrCreateLeafNode (PARSEOP_IF);}
')' '{'
- TermList '}' {$$ = TrLinkChildren ($<n>5,2,$4,$8);}
+ TermList '}' {$$ = TrLinkChildren ($<n>5,2,$4,$8);}
ElseTerm {$$ = TrLinkPeerNode ($<n>5,$11);}
{$$ = TrLinkChildren ($<n>3,1,$<n>5);}
+
| PARSEOP_ELSEIF '('
error ')' {$$ = AslDoError(); yyclearin;}
+
+ | PARSEOP_ELSEIF
+ error {$$ = AslDoError(); yyclearin;}
;
LoadTerm
@@ -1526,9 +1532,9 @@
ReturnTerm
: PARSEOP_RETURN '(' {$$ = TrCreateLeafNode (PARSEOP_RETURN);}
- OptionalTermArg
+ OptionalReturnArg
')' {$$ = TrLinkChildren ($<n>3,1,$4);}
- | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),0);}
+ | PARSEOP_RETURN {$$ = TrLinkChildren (TrCreateLeafNode (PARSEOP_RETURN),1,TrCreateLeafNode (PARSEOP_ZERO));}
| PARSEOP_RETURN '('
error ')' {$$ = AslDoError(); yyclearin;}
;
@@ -1561,27 +1567,44 @@
: PARSEOP_SWITCH '(' {$$ = TrCreateLeafNode (PARSEOP_SWITCH);}
TermArg
')' '{'
- CaseTermList '}'
+ CaseDefaultTermList '}'
{$$ = TrLinkChildren ($<n>3,2,$4,$7);}
| PARSEOP_SWITCH '('
error ')' {$$ = AslDoError(); yyclearin;}
;
-CaseTermList
+/*
+ * Case-Default list; allow only one Default term and unlimited Case terms
+ */
+
+CaseDefaultTermList
: {$$ = NULL;}
- | CaseTerm {}
- | DefaultTerm
- DefaultTermList {$$ = TrLinkPeerNode ($1,$2);}
- | CaseTerm
- CaseTermList {$$ = TrLinkPeerNode ($1,$2);}
+ | CaseTerm {}
+ | DefaultTerm {}
+ | CaseDefaultTermList
+ CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
+ | CaseDefaultTermList
+ DefaultTerm {$$ = TrLinkPeerNode ($1,$2);}
+
+/* Original - attempts to force zero or one default term within the switch */
+
+/*
+CaseDefaultTermList
+ : {$$ = NULL;}
+ | CaseTermList
+ DefaultTerm
+ CaseTermList {$$ = TrLinkPeerNode ($1,TrLinkPeerNode ($2, $3));}
+ | CaseTermList
+ CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
;
-DefaultTermList
+CaseTermList
: {$$ = NULL;}
| CaseTerm {}
- | CaseTerm
- DefaultTermList {$$ = TrLinkPeerNode ($1,$2);}
+ | CaseTermList
+ CaseTerm {$$ = TrLinkPeerNode ($1,$2);}
;
+*/
CaseTerm
: PARSEOP_CASE '(' {$$ = TrCreateLeafNode (PARSEOP_CASE);}
@@ -2107,6 +2130,7 @@
| PARSEOP_OBJECTTYPE_MTX {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_MTX);}
| PARSEOP_OBJECTTYPE_OPR {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_OPR);}
| PARSEOP_OBJECTTYPE_POW {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_POW);}
+ | PARSEOP_OBJECTTYPE_PRO {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_PRO);}
| PARSEOP_OBJECTTYPE_THZ {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_THZ);}
| PARSEOP_OBJECTTYPE_BFF {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_BFF);}
| PARSEOP_OBJECTTYPE_DDB {$$ = TrCreateLeafNode (PARSEOP_OBJECTTYPE_DDB);}
@@ -2181,11 +2205,6 @@
| PARSEOP_DMATYPE_F {$$ = TrCreateLeafNode (PARSEOP_DMATYPE_F);}
;
-BusMasterKeyword
- : PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
- | PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);}
- ;
-
XferTypeKeyword
: PARSEOP_XFERTYPE_8 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8);}
| PARSEOP_XFERTYPE_8_16 {$$ = TrCreateLeafNode (PARSEOP_XFERTYPE_8_16);}
@@ -2225,8 +2244,9 @@
| PARSEOP_MEMTYPE_NONCACHEABLE {$$ = TrCreateLeafNode (PARSEOP_MEMTYPE_NONCACHEABLE);}
;
-ReadWriteKeyword
- : PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
+OptionalReadWriteKeyword
+ : {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
+ | PARSEOP_READWRITETYPE_BOTH {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_BOTH);}
| PARSEOP_READWRITETYPE_READONLY {$$ = TrCreateLeafNode (PARSEOP_READWRITETYPE_READONLY);}
;
@@ -2395,35 +2415,21 @@
ByteList
: {$$ = NULL;}
| ByteConstExpr
- ByteListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-ByteListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' ByteConstExpr
- ByteListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | ByteList ',' /* Allows a trailing comma at list end */
+ | ByteList ','
+ ByteConstExpr {$$ = TrLinkPeerNode ($1,$3);}
;
DWordList
: {$$ = NULL;}
| DWordConstExpr
- DWordListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-DWordListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' DWordConstExpr
- DWordListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | DWordList ',' /* Allows a trailing comma at list end */
+ | DWordList ','
+ DWordConstExpr {$$ = TrLinkPeerNode ($1,$3);}
;
PackageTerm
- : PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_PACKAGE);}
- PackageLengthTerm
- ')' '{'
- PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
- | PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);}
+ : PARSEOP_PACKAGE '(' {$$ = TrCreateLeafNode (PARSEOP_VAR_PACKAGE);}
VarPackageLengthTerm
')' '{'
PackageList '}' {$$ = TrLinkChildren ($<n>3,2,$4,$7);}
@@ -2431,26 +2437,17 @@
error ')' {$$ = AslDoError(); yyclearin;}
;
-PackageLengthTerm
- : {$$ = NULL;}
- | ByteConstExpr {}
- ;
-
VarPackageLengthTerm
- : TermArg {}
+ : {$$ = TrCreateLeafNode (PARSEOP_DEFAULT_ARG);}
+ | TermArg {$$ = $1;}
;
PackageList
: {$$ = NULL;}
| PackageElement
- PackageListTail {$$ = TrLinkPeerNode ($1,$2);}
- ;
-
-PackageListTail
- : {$$ = NULL;}
- | ',' {$$ = NULL;} /* Allows a trailing comma at list end */
- | ',' PackageElement
- PackageListTail {$$ = TrLinkPeerNode ($2,$3);}
+ | PackageList ',' /* Allows a trailing comma at list end */
+ | PackageList ','
+ PackageElement {$$ = TrLinkPeerNode ($1,$3);}
;
PackageElement
@@ -2469,12 +2466,18 @@
/******* Resources and Memory ***********************************************/
+/*
+ * Note: Create two default nodes to allow conversion to a Buffer AML opcode
+ * Also, insert the EndTag at the end of the template.
+ */
ResourceTemplateTerm
: PARSEOP_RESOURCETEMPLATE '(' ')'
'{'
- ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,3,
+ ResourceMacroList '}' {$$ = TrCreateNode (PARSEOP_RESOURCETEMPLATE,4,
TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
- TrCreateLeafNode (PARSEOP_DEFAULT_ARG),$5);}
+ TrCreateLeafNode (PARSEOP_DEFAULT_ARG),
+ $5,
+ TrCreateLeafNode (PARSEOP_ENDTAG));}
;
UnicodeTerm
@@ -2487,8 +2490,8 @@
ResourceMacroList
: {$$ = NULL;}
- | ResourceMacroTerm
- ResourceMacroList {$$ = TrLinkPeerNode ($1,$2);}
+ | ResourceMacroList
+ ResourceMacroTerm {$$ = TrLinkPeerNode ($1,$2);}
;
ResourceMacroTerm
@@ -2524,11 +2527,11 @@
DMATerm
: PARSEOP_DMA '(' {$$ = TrCreateLeafNode (PARSEOP_DMA);}
DMATypeKeyword
- ',' BusMasterKeyword
+ OptionalBusMasterKeyword
',' XferTypeKeyword
OptionalNameString_Last
')' '{'
- ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$6,$8,$9,$12);}
+ ByteList '}' {$$ = TrLinkChildren ($<n>3,5,$4,$5,$7,$8,$11);}
| PARSEOP_DMA '('
error ')' {$$ = AslDoError(); yyclearin;}
;
@@ -2562,7 +2565,7 @@
OptionalMinType
OptionalMaxType
OptionalMemType
- ',' ReadWriteKeyword
+ ',' OptionalReadWriteKeyword
',' DWordConstExpr
',' DWordConstExpr
',' DWordConstExpr
@@ -2635,7 +2638,7 @@
OptionalMinType
OptionalMaxType
OptionalMemType
- ',' ReadWriteKeyword
+ ',' OptionalReadWriteKeyword
',' QWordConstExpr
',' QWordConstExpr
',' QWordConstExpr
@@ -2731,7 +2734,7 @@
Memory24Term
: PARSEOP_MEMORY24 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY24);}
- ReadWriteKeyword
+ OptionalReadWriteKeyword
',' WordConstExpr
',' WordConstExpr
',' WordConstExpr
@@ -2744,7 +2747,7 @@
Memory32FixedTerm
: PARSEOP_MEMORY32FIXED '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32FIXED);}
- ReadWriteKeyword
+ OptionalReadWriteKeyword
',' DWordConstExpr
',' DWordConstExpr
OptionalNameString_Last
@@ -2755,7 +2758,7 @@
Memory32Term
: PARSEOP_MEMORY32 '(' {$$ = TrCreateLeafNode (PARSEOP_MEMORY32);}
- ReadWriteKeyword
+ OptionalReadWriteKeyword
',' DWordConstExpr
',' DWordConstExpr
',' DWordConstExpr
@@ -2795,7 +2798,7 @@
OptionalMinType
OptionalMaxType
OptionalMemType
- ',' ReadWriteKeyword
+ ',' OptionalReadWriteKeyword
',' QWordConstExpr
',' QWordConstExpr
',' QWordConstExpr
@@ -2838,7 +2841,9 @@
',' ByteConstExpr
',' ByteConstExpr
',' QWordConstExpr
- ')' {$$ = TrLinkChildren ($<n>3,4,$4,$6,$8,$10);}
+ OptionalAccessSize
+ OptionalNameString_Last
+ ')' {$$ = TrLinkChildren ($<n>3,6,$4,$6,$8,$10,$11,$12);}
| PARSEOP_REGISTER '('
error ')' {$$ = AslDoError(); yyclearin;}
;
@@ -2944,10 +2949,14 @@
/******* Object References ***********************************************/
+/* Allow IO, DMA, IRQ Resource macro names to also be used as identifiers */
NameString
: NameSeg {}
| PARSEOP_NAMESTRING {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) AslCompilerlval.s);}
+ | PARSEOP_IO {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IO");}
+ | PARSEOP_DMA {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "DMA");}
+ | PARSEOP_IRQ {$$ = TrCreateValuedLeafNode (PARSEOP_NAMESTRING, (ACPI_NATIVE_INT) "IRQ");}
;
NameSeg
@@ -2962,6 +2971,12 @@
: Integer {$$ = TrUpdateNode (PARSEOP_PACKAGE_LENGTH,(ACPI_PARSE_OBJECT *) $1);}
;
+OptionalBusMasterKeyword
+ : ',' {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
+ | ',' PARSEOP_BUSMASTERTYPE_MASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_MASTER);}
+ | ',' PARSEOP_BUSMASTERTYPE_NOTMASTER {$$ = TrCreateLeafNode (PARSEOP_BUSMASTERTYPE_NOTMASTER);}
+ ;
+
OptionalAccessAttribTerm
: {$$ = NULL;}
| ',' {$$ = NULL;}
@@ -2969,6 +2984,12 @@
| ',' AccessAttribKeyword {$$ = $2;}
;
+OptionalAccessSize
+ : {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);}
+ | ',' {$$ = TrCreateValuedLeafNode (PARSEOP_BYTECONST, 0);}
+ | ',' ByteConstExpr {$$ = $2;}
+ ;
+
OptionalAddressRange
: {$$ = NULL;}
| ',' {$$ = NULL;}
@@ -3087,6 +3108,11 @@
| TermArg {$$ = $1;}
;
+OptionalReturnArg
+ : {$$ = TrCreateLeafNode (PARSEOP_ZERO);} /* Placeholder is a ZeroOp object */
+ | TermArg {$$ = $1;}
+ ;
+
OptionalType
: {$$ = NULL;}
| ',' {$$ = NULL;}
@@ -3140,7 +3166,7 @@
DbgPrint (ASL_PARSE_OUTPUT, "\nAslLocalAllocate: Expanding Stack to %d\n\n", Size);
- Mem = ACPI_MEM_CALLOCATE (Size);
+ Mem = ACPI_ALLOCATE_ZEROED (Size);
if (!Mem)
{
AslCommonError (ASL_ERROR, ASL_MSG_MEMORY_ALLOCATION,
Index: aslopt.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslopt.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslopt.c -L sys/contrib/dev/acpica/compiler/aslopt.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslopt.c
+++ sys/contrib/dev/acpica/compiler/aslopt.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: aslopt- Compiler optimizations
- * $Revision: 16 $
+ * $Revision: 1.26 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,19 +115,51 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acnamesp.h"
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acnamesp.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslopt")
-UINT32 OptTotal = 0;
+static UINT32 OptTotal = 0;
+
+/* Local prototypes */
+
+static ACPI_STATUS
+OptSearchToRoot (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *CurrentNode,
+ ACPI_NAMESPACE_NODE *TargetNode,
+ ACPI_BUFFER *TargetPath,
+ char **NewPath);
+
+static ACPI_STATUS
+OptBuildShortestPath (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *CurrentNode,
+ ACPI_NAMESPACE_NODE *TargetNode,
+ ACPI_BUFFER *CurrentPath,
+ ACPI_BUFFER *TargetPath,
+ ACPI_SIZE AmlNameStringLength,
+ UINT8 IsDeclaration,
+ char **ReturnNewPath);
+
+static ACPI_STATUS
+OptOptimizeNameDeclaration (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState,
+ ACPI_NAMESPACE_NODE *CurrentNode,
+ ACPI_NAMESPACE_NODE *TargetNode,
+ char *AmlNameString,
+ char **NewPath);
/*******************************************************************************
@@ -149,7 +181,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OptSearchToRoot (
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState,
@@ -164,7 +196,7 @@
char *Path;
- ACPI_FUNCTION_NAME ("OptSearchToRoot");
+ ACPI_FUNCTION_NAME (OptSearchToRoot);
/*
@@ -174,7 +206,8 @@
* name in the search path before the one we want, the nodes will
* not match, and we cannot use this optimization.
*/
- Path = &(((char *) TargetPath->Pointer)[TargetPath->Length - ACPI_NAME_SIZE]),
+ Path = &(((char *) TargetPath->Pointer)[TargetPath->Length -
+ ACPI_NAME_SIZE]),
ScopeInfo.Scope.Node = CurrentNode;
/* Lookup the NameSeg using SEARCH_PARENT (search-to-root) */
@@ -208,7 +241,7 @@
/* We must allocate a new string for the name (TargetPath gets deleted) */
- *NewPath = ACPI_MEM_CALLOCATE (ACPI_NAME_SIZE + 1);
+ *NewPath = ACPI_ALLOCATE_ZEROED (ACPI_NAME_SIZE + 1);
ACPI_STRCPY (*NewPath, Path);
if (ACPI_STRNCMP (*NewPath, "_T_", 3))
@@ -241,7 +274,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OptBuildShortestPath (
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState,
@@ -266,7 +299,7 @@
BOOLEAN SubPath = FALSE;
- ACPI_FUNCTION_NAME ("OptBuildShortestPath");
+ ACPI_FUNCTION_NAME (OptBuildShortestPath);
ScopeInfo.Scope.Node = CurrentNode;
@@ -295,8 +328,10 @@
/* Compare two single NameSegs */
if (ACPI_STRNCMP (
- &((char *) TargetPath->Pointer)[(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1],
- &((char *) CurrentPath->Pointer)[(NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1],
+ &((char *) TargetPath->Pointer)[(NumCommonSegments *
+ ACPI_PATH_SEGMENT_LENGTH) + 1],
+ &((char *) CurrentPath->Pointer)[(NumCommonSegments *
+ ACPI_PATH_SEGMENT_LENGTH) + 1],
ACPI_NAME_SIZE))
{
/* Mismatch */
@@ -305,7 +340,8 @@
}
}
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %d", NumCommonSegments));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " COMMON: %d",
+ NumCommonSegments));
/* There must be at least 1 common NameSeg in order to optimize */
@@ -330,12 +366,14 @@
/* Determine how many prefix Carats are required */
- NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) - NumCommonSegments;
+ NumCarats = (CurrentPath->Length / ACPI_PATH_SEGMENT_LENGTH) -
+ NumCommonSegments;
/*
* Construct a new target string
*/
- NewPathExternal = ACPI_MEM_CALLOCATE (TargetPath->Length + NumCarats);
+ NewPathExternal = ACPI_ALLOCATE_ZEROED (
+ TargetPath->Length + NumCarats + 1);
/* Insert the Carats into the Target string */
@@ -344,8 +382,10 @@
NewPathExternal[i] = '^';
}
- /* Copy only the necessary (optimal) segments from the original target string */
-
+ /*
+ * Copy only the necessary (optimal) segments from the original
+ * target string
+ */
Index = (NumCommonSegments * ACPI_PATH_SEGMENT_LENGTH) + 1;
/* Special handling for exact subpath in a name declaration */
@@ -353,8 +393,9 @@
if (IsDeclaration && SubPath && (CurrentPath->Length > TargetPath->Length))
{
/*
- * The current path is longer than the target, and the target is a subpath
- * of the current path. We must include one more NameSeg of the target path
+ * The current path is longer than the target, and the target is a
+ * subpath of the current path. We must include one more NameSeg of
+ * the target path
*/
Index -= ACPI_PATH_SEGMENT_LENGTH;
@@ -368,28 +409,36 @@
}
}
+ /* Make sure we haven't gone off the end of the target path */
+
+ if (Index > TargetPath->Length)
+ {
+ Index = TargetPath->Length;
+ }
+
ACPI_STRCPY (&NewPathExternal[i], &((char *) TargetPath->Pointer)[Index]);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " %-24s", NewPathExternal));
/*
- * Internalize the new target string and check it against the original string
- * to make sure that this is in fact an optimization. If the original string
- * is already optimal, there is no point in continuing.
+ * Internalize the new target string and check it against the original
+ * string to make sure that this is in fact an optimization. If the
+ * original string is already optimal, there is no point in continuing.
*/
Status = AcpiNsInternalizeName (NewPathExternal, &NewPath);
-
if (ACPI_FAILURE (Status))
{
- AslCoreSubsystemError (Op, Status, "Internalizing new NamePath", ASL_NO_ABORT);
- ACPI_MEM_FREE (NewPathExternal);
+ AslCoreSubsystemError (Op, Status, "Internalizing new NamePath",
+ ASL_NO_ABORT);
+ ACPI_FREE (NewPathExternal);
return (Status);
}
if (ACPI_STRLEN (NewPath) >= AmlNameStringLength)
{
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " NOT SHORTER (New %d old %d)",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ " NOT SHORTER (New %u old %u)",
ACPI_STRLEN (NewPath), AmlNameStringLength));
- ACPI_MEM_FREE (NewPathExternal);
+ ACPI_FREE (NewPathExternal);
return (AE_NOT_FOUND);
}
@@ -432,7 +481,7 @@
"Not using optimized name - did not find node");
}
- ACPI_MEM_FREE (NewPathExternal);
+ ACPI_FREE (NewPathExternal);
return (Status);
}
@@ -454,7 +503,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
OptOptimizeNameDeclaration (
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState,
@@ -469,7 +518,7 @@
ACPI_NAMESPACE_NODE *Node;
- ACPI_FUNCTION_TRACE ("OptOptimizeNameDeclaration");
+ ACPI_FUNCTION_TRACE (OptOptimizeNameDeclaration);
if (((CurrentNode == AcpiGbl_RootNode) ||
@@ -488,7 +537,8 @@
NULL, &NewPathExternal);
if (ACPI_FAILURE (Status))
{
- AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT);
+ AslCoreSubsystemError (Op, Status, "Externalizing NamePath",
+ ASL_NO_ABORT);
return (Status);
}
@@ -520,7 +570,8 @@
/* Node is not correct, do not use this optimization */
Status = AE_NOT_FOUND;
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** WRONG NODE"));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ " ***** WRONG NODE"));
AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op,
"Not using optimized name - found wrong node");
}
@@ -529,12 +580,13 @@
{
/* The lookup failed, we obviously cannot use this optimization */
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " ***** NOT FOUND"));
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
+ " ***** NOT FOUND"));
AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op,
"Not using optimized name - did not find node");
}
- ACPI_MEM_FREE (NewPathExternal);
+ ACPI_FREE (NewPathExternal);
return (Status);
}
@@ -581,7 +633,7 @@
ACPI_PARSE_OBJECT *NextOp;
- ACPI_FUNCTION_TRACE ("OptOptimizeNamePath");
+ ACPI_FUNCTION_TRACE (OptOptimizeNamePath);
/* This is an optional optimization */
@@ -644,8 +696,10 @@
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "NAME"));
- /* The node of interest is the parent of this node (the containing scope) */
-
+ /*
+ * The node of interest is the parent of this node
+ * (the containing scope)
+ */
CurrentNode = Op->Asl.Parent->Asl.Node;
if (!CurrentNode)
{
@@ -668,7 +722,8 @@
Status = AcpiNsHandleToPathname (TargetNode, &TargetPath);
if (ACPI_FAILURE (Status))
{
- AslCoreSubsystemError (Op, Status, "Getting Target NamePath", ASL_NO_ABORT);
+ AslCoreSubsystemError (Op, Status, "Getting Target NamePath",
+ ASL_NO_ABORT);
return_VOID;
}
TargetPath.Length--; /* Subtract one for null terminator */
@@ -679,7 +734,8 @@
Status = AcpiNsHandleToPathname (CurrentNode, &CurrentPath);
if (ACPI_FAILURE (Status))
{
- AslCoreSubsystemError (Op, Status, "Getting Current NamePath", ASL_NO_ABORT);
+ AslCoreSubsystemError (Op, Status, "Getting Current NamePath",
+ ASL_NO_ABORT);
return_VOID;
}
CurrentPath.Length--; /* Subtract one for null terminator */
@@ -690,16 +746,17 @@
NULL, &ExternalNameString);
if (ACPI_FAILURE (Status))
{
- AslCoreSubsystemError (Op, Status, "Externalizing NamePath", ASL_NO_ABORT);
+ AslCoreSubsystemError (Op, Status, "Externalizing NamePath",
+ ASL_NO_ABORT);
return_VOID;
}
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS,
- "%37s (%2d) ==> %-32s(%2d) %-32s",
+ "%37s (%2u) ==> %-32s(%2u) %-32s",
(char *) CurrentPath.Pointer, CurrentPath.Length,
(char *) TargetPath.Pointer, TargetPath.Length, ExternalNameString));
- ACPI_MEM_FREE (ExternalNameString);
+ ACPI_FREE (ExternalNameString);
/*
* Attempt an optmization depending on the type of namepath
@@ -754,7 +811,7 @@
HowMuchShorter = (AmlNameStringLength - ACPI_STRLEN (NewPath));
OptTotal += HowMuchShorter;
- ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2d (%d)",
+ ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, " REDUCED %2u (%u)",
HowMuchShorter, OptTotal));
if (Flags & AML_NAMED)
@@ -803,8 +860,8 @@
/* Cleanup path buffers */
- ACPI_MEM_FREE (TargetPath.Pointer);
- ACPI_MEM_FREE (CurrentPath.Pointer);
+ ACPI_FREE (TargetPath.Pointer);
+ ACPI_FREE (CurrentPath.Pointer);
ACPI_DEBUG_PRINT_RAW ((ACPI_DB_OPTIMIZATIONS, "\n"));
return_VOID;
Index: aslfiles.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslfiles.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslfiles.c -L sys/contrib/dev/acpica/compiler/aslfiles.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslfiles.c
+++ sys/contrib/dev/acpica/compiler/aslfiles.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslfiles - file I/O suppoert
- * $Revision: 47 $
+ * $Revision: 1.54 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,12 +115,31 @@
*
*****************************************************************************/
-#include "aslcompiler.h"
-#include "acapps.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/acapps.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslfiles")
+/* Local prototypes */
+
+static void
+FlOpenFile (
+ UINT32 FileId,
+ char *Filename,
+ char *Mode);
+
+static FILE *
+FlOpenLocalFile (
+ char *LocalName,
+ char *Mode);
+
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+ACPI_STATUS
+FlParseInputPathname (
+ char *InputFilename);
+#endif
+
/*******************************************************************************
*
@@ -136,7 +155,8 @@
******************************************************************************/
void
-AslAbort (void)
+AslAbort (
+ void)
{
AePrintErrorLog (ASL_FILE_STDOUT);
@@ -147,7 +167,7 @@
AePrintErrorLog (ASL_FILE_STDERR);
}
- exit (0);
+ exit (1);
}
@@ -165,7 +185,7 @@
*
******************************************************************************/
-FILE *
+static FILE *
FlOpenLocalFile (
char *LocalName,
char *Mode)
@@ -199,7 +219,8 @@
UINT8 ErrorId)
{
- sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename, strerror (errno));
+ sprintf (MsgBuffer, "\"%s\" (%s)", Gbl_Files[FileId].Filename,
+ strerror (errno));
AslCommonError (ASL_ERROR, ErrorId, 0, 0, 0, 0, NULL, MsgBuffer);
}
@@ -212,14 +233,14 @@
* Filename - file pathname to open
* Mode - Open mode for fopen
*
- * RETURN: File descriptor
+ * RETURN: None
*
* DESCRIPTION: Open a file.
* NOTE: Aborts compiler on any error.
*
******************************************************************************/
-void
+static void
FlOpenFile (
UINT32 FileId,
char *Filename,
@@ -293,7 +314,7 @@
* Buffer - Data to write
* Length - Amount of data to write
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Write data to an open file.
* NOTE: Aborts compiler on any error.
@@ -363,7 +384,7 @@
* PARAMETERS: FileId - Index into file info array
* Offset - Absolute byte offset in file
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Seek to absolute offset
* NOTE: Aborts compiler on any error.
@@ -393,7 +414,7 @@
*
* PARAMETERS: FileId - Index into file info array
*
- * RETURN: Status
+ * RETURN: None
*
* DESCRIPTION: Close an open file. Aborts compiler on error
*
@@ -487,7 +508,8 @@
/* Prepend the directory pathname and open the include file */
- DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n", Op->Asl.Value.String);
+ DbgPrint (ASL_PARSE_OUTPUT, "\nOpen include file: path %s\n\n",
+ Op->Asl.Value.String);
IncFile = FlOpenLocalFile (Op->Asl.Value.String, "r");
if (!IncFile)
{
@@ -504,72 +526,6 @@
/*******************************************************************************
*
- * FUNCTION: FlParseInputPathname
- *
- * PARAMETERS: InputFilename - The user-specified ASL source file to be
- * compiled
- *
- * RETURN: Status
- *
- * DESCRIPTION: Split the input path into a directory and filename part
- * 1) Directory part used to open include files
- * 2) Filename part used to generate output filenames
- *
- ******************************************************************************/
-
-ACPI_STATUS
-FlParseInputPathname (
- char *InputFilename)
-{
- char *Substring;
-
-
- if (!InputFilename)
- {
- return (AE_OK);
- }
-
- /* Get the path to the input filename's directory */
-
- Gbl_DirectoryPath = strdup (InputFilename);
- if (!Gbl_DirectoryPath)
- {
- return (AE_NO_MEMORY);
- }
-
- Substring = strrchr (Gbl_DirectoryPath, '\\');
- if (!Substring)
- {
- Substring = strrchr (Gbl_DirectoryPath, '/');
- if (!Substring)
- {
- Substring = strrchr (Gbl_DirectoryPath, ':');
- }
- }
-
- if (!Substring)
- {
- Gbl_DirectoryPath[0] = 0;
- if (Gbl_UseDefaultAmlFilename)
- {
- Gbl_OutputFilenamePrefix = strdup (InputFilename);
- }
- }
- else
- {
- if (Gbl_UseDefaultAmlFilename)
- {
- Gbl_OutputFilenamePrefix = strdup (Substring + 1);
- }
- *(Substring+1) = 0;
- }
-
- return (AE_OK);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: FlOpenInputFile
*
* PARAMETERS: InputFilename - The user-specified ASL source file to be
@@ -588,7 +544,6 @@
char *InputFilename)
{
-
/* Open the input ASL file, text mode */
FlOpenFile (ASL_FILE_INPUT, InputFilename, "r");
@@ -628,7 +583,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_AML_CODE);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_OUTPUT_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
}
@@ -665,7 +621,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_SOURCE);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -683,7 +640,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_LISTING);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -702,7 +660,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_SOURCE);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -721,7 +680,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_SOURCE);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -741,7 +701,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_ASM_INCLUDE);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -760,7 +721,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_C_INCLUDE);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -780,7 +742,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_HEX_DUMP);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -799,7 +762,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_NAMESPACE);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_LISTING_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -818,7 +782,8 @@
Filename = FlGenerateFilename (FilenamePrefix, FILE_SUFFIX_DEBUG);
if (!Filename)
{
- AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME, 0, 0, 0, 0, NULL, NULL);
+ AslCommonError (ASL_ERROR, ASL_MSG_DEBUG_FILENAME,
+ 0, 0, 0, 0, NULL, NULL);
return (AE_ERROR);
}
@@ -827,7 +792,8 @@
/* TBD: hide this behind a FlReopenFile function */
Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Filename = Filename;
- Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle = freopen (Filename, "w+t", stderr);
+ Gbl_Files[ASL_FILE_DEBUG_OUTPUT].Handle =
+ freopen (Filename, "w+t", stderr);
AslCompilerSignon (ASL_FILE_DEBUG_OUTPUT);
AslCompilerFileHeader (ASL_FILE_DEBUG_OUTPUT);
@@ -837,3 +803,71 @@
}
+#ifdef ACPI_OBSOLETE_FUNCTIONS
+/*******************************************************************************
+ *
+ * FUNCTION: FlParseInputPathname
+ *
+ * PARAMETERS: InputFilename - The user-specified ASL source file to be
+ * compiled
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Split the input path into a directory and filename part
+ * 1) Directory part used to open include files
+ * 2) Filename part used to generate output filenames
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+FlParseInputPathname (
+ char *InputFilename)
+{
+ char *Substring;
+
+
+ if (!InputFilename)
+ {
+ return (AE_OK);
+ }
+
+ /* Get the path to the input filename's directory */
+
+ Gbl_DirectoryPath = strdup (InputFilename);
+ if (!Gbl_DirectoryPath)
+ {
+ return (AE_NO_MEMORY);
+ }
+
+ Substring = strrchr (Gbl_DirectoryPath, '\\');
+ if (!Substring)
+ {
+ Substring = strrchr (Gbl_DirectoryPath, '/');
+ if (!Substring)
+ {
+ Substring = strrchr (Gbl_DirectoryPath, ':');
+ }
+ }
+
+ if (!Substring)
+ {
+ Gbl_DirectoryPath[0] = 0;
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = strdup (InputFilename);
+ }
+ }
+ else
+ {
+ if (Gbl_UseDefaultAmlFilename)
+ {
+ Gbl_OutputFilenamePrefix = strdup (Substring + 1);
+ }
+ *(Substring+1) = 0;
+ }
+
+ return (AE_OK);
+}
+#endif
+
+
Index: asltree.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/asltree.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/asltree.c -L sys/contrib/dev/acpica/compiler/asltree.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/asltree.c
+++ sys/contrib/dev/acpica/compiler/asltree.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: asltree - parse tree management
- * $Revision: 55 $
+ * $Revision: 1.63 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,12 +116,22 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asltree")
+/* Local prototypes */
+
+static ACPI_PARSE_OBJECT *
+TrGetNextNode (
+ void);
+
+static char *
+TrGetNodeFlagName (
+ UINT32 Flags);
+
/*******************************************************************************
*
@@ -137,13 +147,15 @@
*
******************************************************************************/
-ACPI_PARSE_OBJECT *
-TrGetNextNode (void)
+static ACPI_PARSE_OBJECT *
+TrGetNextNode (
+ void)
{
if (Gbl_NodeCacheNext >= Gbl_NodeCacheLast)
{
- Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) * ASL_NODE_CACHE_SIZE);
+ Gbl_NodeCacheNext = UtLocalCalloc (sizeof (ACPI_PARSE_OBJECT) *
+ ASL_NODE_CACHE_SIZE);
Gbl_NodeCacheLast = Gbl_NodeCacheNext + ASL_NODE_CACHE_SIZE;
}
@@ -298,13 +310,13 @@
*
* PARAMETERS: Flags - Flags word to be decoded
*
- * RETURN: Name string
+ * RETURN: Name string. Always returns a valid string pointer.
*
* DESCRIPTION: Decode a flags word
*
******************************************************************************/
-char *
+static char *
TrGetNodeFlagName (
UINT32 Flags)
{
@@ -372,10 +384,10 @@
*
* FUNCTION: TrSetNodeFlags
*
- * PARAMETERS: Op - An existing parse node
+ * PARAMETERS: Op - An existing parse node
* Flags - New flags word
*
- * RETURN: The updated node
+ * RETURN: The updated parser op
*
* DESCRIPTION: Set bits in the node flags word. Will not clear bits, only set
*
@@ -388,7 +400,8 @@
{
DbgPrint (ASL_PARSE_OUTPUT,
- "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags, TrGetNodeFlagName (Flags));
+ "\nSetNodeFlags: Op %p, %8.8X %s\n\n", Op, Flags,
+ TrGetNodeFlagName (Flags));
if (!Op)
{
@@ -454,8 +467,8 @@
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateLeafNode Line %d NewNode %p Op %s\n\n",
- Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode));
+ "\nCreateLeafNode Ln/Col %d/%d NewNode %p Op %s\n\n",
+ Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode));
return Op;
}
@@ -486,8 +499,8 @@
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateValuedLeafNode Line %d NewNode %p Op %s Value %8.8X%8.8X ",
- Op->Asl.LineNumber, Op, UtGetOpName(ParseOpcode),
+ "\nCreateValuedLeafNode Ln/Col %d/%d NewNode %p Op %s Value %8.8X%8.8X ",
+ Op->Asl.LineNumber, Op->Asl.Column, Op, UtGetOpName(ParseOpcode),
ACPI_FORMAT_UINT64 (Value));
Op->Asl.Value.Integer = Value;
@@ -563,8 +576,8 @@
Op = TrAllocateNode (ParseOpcode);
DbgPrint (ASL_PARSE_OUTPUT,
- "\nCreateNode Line %d NewParent %p Child %d Op %s ",
- Op->Asl.LineNumber, Op, NumChildren, UtGetOpName(ParseOpcode));
+ "\nCreateNode Ln/Col %d/%d NewParent %p Child %d Op %s ",
+ Op->Asl.LineNumber, Op->Asl.Column, Op, NumChildren, UtGetOpName(ParseOpcode));
/* Some extra debug output based on the parse opcode */
@@ -716,7 +729,8 @@
if ((Child == PrevChild) && (Child != NULL))
{
- AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child, "Child node list invalid");
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Child,
+ "Child node list invalid");
return Op;
}
@@ -818,8 +832,10 @@
if (Op1 == Op2)
{
DbgPrint (ASL_DEBUG_OUTPUT,
- "\n\n************* Internal error, linking node to itself %p\n\n\n", Op1);
- AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1, "Linking node to itself");
+ "\n\n************* Internal error, linking node to itself %p\n\n\n",
+ Op1);
+ AslError (ASL_WARNING, ASL_MSG_COMPILER_INTERNAL, Op1,
+ "Linking node to itself");
return Op1;
}
@@ -995,9 +1011,8 @@
{
if (!NodePreviouslyVisited)
{
- /*
- * Let the callback process the node.
- */
+ /* Let the callback process the node. */
+
Status = DescendingCallback (Op, Level, Context);
if (ACPI_SUCCESS (Status))
{
@@ -1056,10 +1071,8 @@
if ((!Op->Asl.Child) ||
(NodePreviouslyVisited))
{
- /*
- * Let the callback process the node.
- *
- */
+ /* Let the callback process the node. */
+
Status = AscendingCallback (Op, Level, Context);
if (ACPI_FAILURE (Status))
{
@@ -1118,9 +1131,8 @@
}
else
{
- /*
- * Let the callback process the node.
- */
+ /* Let the callback process the node. */
+
Status = DescendingCallback (Op, Level, Context);
if (ACPI_SUCCESS (Status))
{
Index: aslload.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslload.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslload.c -L sys/contrib/dev/acpica/compiler/aslload.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslload.c
+++ sys/contrib/dev/acpica/compiler/aslload.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: dswload - Dispatcher namespace load callbacks
- * $Revision: 62 $
+ * $Revision: 1.77 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,22 +116,46 @@
#define __ASLLOAD_C__
-#include "aslcompiler.h"
-#include "amlcode.h"
-#include "acdispat.h"
-#include "acnamesp.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acdispat.h>
+#include <contrib/dev/acpica/acnamesp.h>
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslload")
+/* Local prototypes */
+
+static ACPI_STATUS
+LdLoadFieldElements (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState);
+
+static ACPI_STATUS
+LdLoadResourceElements (
+ ACPI_PARSE_OBJECT *Op,
+ ACPI_WALK_STATE *WalkState);
+
+static ACPI_STATUS
+LdNamespace1Begin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+LdNamespace1End (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
/*******************************************************************************
*
* FUNCTION: LdLoadNamespace
*
- * PARAMETERS: None
+ * PARAMETERS: RootOp - Root of the parse tree
*
* RETURN: Status
*
@@ -162,7 +186,7 @@
/* Perform the walk of the parse tree */
TrWalkParseTree (RootOp, ASL_WALK_VISIT_TWICE, LdNamespace1Begin,
- LdNamespace1End, WalkState);
+ LdNamespace1End, WalkState);
/* Dump the namespace if debug is enabled */
@@ -175,7 +199,7 @@
*
* FUNCTION: LdLoadFieldElements
*
- * PARAMETERS: Op - Parent node (Field)
+ * PARAMETERS: Op - Parent node (Field)
* WalkState - Current walk state
*
* RETURN: Status
@@ -185,7 +209,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LdLoadFieldElements (
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState)
@@ -232,27 +256,33 @@
default:
- Status = AcpiNsLookup (WalkState->ScopeInfo, Child->Asl.Value.String,
- ACPI_TYPE_LOCAL_REGION_FIELD, ACPI_IMODE_LOAD_PASS1,
- ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE | ACPI_NS_ERROR_IF_FOUND,
- NULL, &Node);
+ Status = AcpiNsLookup (WalkState->ScopeInfo,
+ Child->Asl.Value.String,
+ ACPI_TYPE_LOCAL_REGION_FIELD,
+ ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE |
+ ACPI_NS_ERROR_IF_FOUND,
+ NULL, &Node);
if (ACPI_FAILURE (Status))
{
if (Status != AE_ALREADY_EXISTS)
{
- return (Status);
+ AslError (ASL_ERROR, ASL_MSG_CORE_EXCEPTION, Child,
+ Child->Asl.Value.String);
+ return (Status);
}
/*
* The name already exists in this scope
* But continue processing the elements
*/
- AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child, Child->Asl.Value.String);
+ AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Child,
+ Child->Asl.Value.String);
}
else
{
Child->Asl.Node = Node;
- Node->Object = (ACPI_OPERAND_OBJECT *) Child;
+ Node->Op = Child;
}
break;
}
@@ -266,7 +296,7 @@
*
* FUNCTION: LdLoadResourceElements
*
- * PARAMETERS: Op - Parent node (Resource Descriptor)
+ * PARAMETERS: Op - Parent node (Resource Descriptor)
* WalkState - Current walk state
*
* RETURN: Status
@@ -280,7 +310,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LdLoadResourceElements (
ACPI_PARSE_OBJECT *Op,
ACPI_WALK_STATE *WalkState)
@@ -291,17 +321,29 @@
/*
- * Enter the resouce name into the namespace
- * This opens a scope
+ * Enter the resource name into the namespace. Name must not already exist.
+ * This opens a scope, so later field names are guaranteed to be new/unique.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Op->Asl.Namepath,
- ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH,
- WalkState, &Node);
+ ACPI_TYPE_LOCAL_RESOURCE, ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_ERROR_IF_FOUND,
+ WalkState, &Node);
if (ACPI_FAILURE (Status))
{
+ if (Status == AE_ALREADY_EXISTS)
+ {
+ /* Actual node causing the error was saved in ParentMethod */
+
+ AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS,
+ (ACPI_PARSE_OBJECT *) Op->Asl.ParentMethod, Op->Asl.Namepath);
+ return (AE_OK);
+ }
return (Status);
}
+ Node->Value = (UINT32) Op->Asl.Value.Integer;
+ Node->Op = Op;
+
/*
* Now enter the predefined fields, for easy lookup when referenced
* by the source ASL
@@ -313,10 +355,11 @@
if (InitializerOp->Asl.ExternalName)
{
Status = AcpiNsLookup (WalkState->ScopeInfo,
- InitializerOp->Asl.ExternalName,
- ACPI_TYPE_LOCAL_RESOURCE_FIELD,
- ACPI_IMODE_LOAD_PASS1, ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
- NULL, &Node);
+ InitializerOp->Asl.ExternalName,
+ ACPI_TYPE_LOCAL_RESOURCE_FIELD,
+ ACPI_IMODE_LOAD_PASS1,
+ ACPI_NS_NO_UPSEARCH | ACPI_NS_DONT_OPEN_SCOPE,
+ NULL, &Node);
if (ACPI_FAILURE (Status))
{
return (Status);
@@ -326,9 +369,9 @@
* Store the field offset in the namespace node so it
* can be used when the field is referenced
*/
- Node->OwnerId = (UINT16) InitializerOp->Asl.Value.Integer;
+ Node->Value = (UINT32) InitializerOp->Asl.Value.Integer;
InitializerOp->Asl.Node = Node;
- Node->Object = (ACPI_OPERAND_OBJECT *) InitializerOp;
+ Node->Op = InitializerOp;
/* Pass thru the field type (Bitfield or Bytefield) */
@@ -357,7 +400,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LdNamespace1Begin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -372,9 +415,10 @@
UINT32 Flags = ACPI_NS_NO_UPSEARCH;
ACPI_PARSE_OBJECT *Arg;
UINT32 i;
+ BOOLEAN ForceNewScope = FALSE;
- ACPI_FUNCTION_NAME ("LdNamespace1Begin");
+ ACPI_FUNCTION_NAME (LdNamespace1Begin);
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Op %p [%s]\n",
Op, Op->Asl.ParseOpName));
@@ -417,8 +461,18 @@
{
case PARSEOP_NAME:
- Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */
- Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */
+ Arg = Op->Asl.Child; /* Get the NameSeg/NameString node */
+ Arg = Arg->Asl.Next; /* First peer is the object to be associated with the name */
+
+ /*
+ * If this name refers to a ResourceTemplate, we will need to open
+ * a new scope so that the resource subfield names can be entered into
+ * the namespace underneath this name
+ */
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ ForceNewScope = TRUE;
+ }
/* Get the data type associated with the named object, not the name itself */
@@ -443,12 +497,30 @@
*/
ActualObjectType = (UINT8) Op->Asl.Child->Asl.Next->Asl.Value.Integer;
ObjectType = ACPI_TYPE_ANY;
- break;
+ /*
+ * We will mark every new node along the path as "External". This
+ * allows some or all of the nodes to be created later in the ASL
+ * code. Handles cases like this:
+ *
+ * External (\_SB_.PCI0.ABCD, IntObj)
+ * Scope (_SB_)
+ * {
+ * Device (PCI0)
+ * {
+ * }
+ * }
+ * Method (X)
+ * {
+ * Store (\_SB_.PCI0.ABCD, Local0)
+ * }
+ */
+ Flags |= ACPI_NS_EXTERNAL;
+ break;
case PARSEOP_DEFAULT_ARG:
- if(Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)
+ if (Op->Asl.CompileFlags == NODE_IS_RESOURCE_DESC)
{
Status = LdLoadResourceElements (Op, WalkState);
goto Exit;
@@ -467,23 +539,28 @@
* handle this case. Perhaps someday this case can go away.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_ANY,
- ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT, WalkState, &(Node));
+ ACPI_IMODE_EXECUTE, ACPI_NS_SEARCH_PARENT,
+ WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
{
/* The name was not found, go ahead and create it */
- Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ACPI_TYPE_LOCAL_SCOPE,
- ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path,
+ ACPI_TYPE_LOCAL_SCOPE,
+ ACPI_IMODE_LOAD_PASS1, Flags,
+ WalkState, &(Node));
/*
* However, this is an error -- primarily because the MS
* interpreter can't handle a forward reference from the
* Scope() operator.
*/
- AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName);
- AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op, Op->Asl.ExternalName);
+ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
+ Op->Asl.ExternalName);
+ AslError (ASL_ERROR, ASL_MSG_SCOPE_FWD_REF, Op,
+ Op->Asl.ExternalName);
goto FinishNode;
}
@@ -509,8 +586,8 @@
case ACPI_TYPE_BUFFER:
/*
- * These types we will allow, but we will change the type. This
- * enables some existing code of the form:
+ * These types we will allow, but we will change the type.
+ * This enables some existing code of the form:
*
* Name (DEB, 0)
* Scope (DEB) { ... }
@@ -522,11 +599,11 @@
Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
AslError (ASL_REMARK, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
- /*
- * Switch the type to scope, open the new scope
- */
+ /* Switch the type to scope, open the new scope */
+
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
- Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, WalkState);
+ Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
+ WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -535,10 +612,10 @@
default:
- /*
- * All other types are an error
- */
- sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
+ /* All other types are an error */
+
+ sprintf (MsgBuffer, "%s [%s]", Op->Asl.ExternalName,
+ AcpiUtGetTypeName (Node->Type));
AslError (ASL_ERROR, ASL_MSG_SCOPE_TYPE, Op, MsgBuffer);
/*
@@ -547,7 +624,8 @@
* cascade of additional errors. Open the new scope.
*/
Node->Type = ACPI_TYPE_LOCAL_SCOPE;
- Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE, WalkState);
+ Status = AcpiDsScopeStackPush (Node, ACPI_TYPE_LOCAL_SCOPE,
+ WalkState);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -575,11 +653,12 @@
/*
* Enter the named type into the internal namespace. We enter the name
- * as we go downward in the parse tree. Any necessary subobjects that involve
- * arguments to the opcode must be created as we go back up the parse tree later.
+ * as we go downward in the parse tree. Any necessary subobjects that
+ * involve arguments to the opcode must be created as we go back up the
+ * parse tree later.
*/
Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &(Node));
+ ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
if (Status == AE_ALREADY_EXISTS)
@@ -588,23 +667,58 @@
if (Node->Type == ACPI_TYPE_LOCAL_SCOPE)
{
+ /* Allow multiple references to the same scope */
+
+ Node->Type = (UINT8) ObjectType;
+ Status = AE_OK;
+ }
+ else if (Node->Flags & ANOBJ_IS_EXTERNAL)
+ {
+ /*
+ * Allow one create on an object or segment that was
+ * previously declared External
+ */
+ Node->Flags &= ~ANOBJ_IS_EXTERNAL;
Node->Type = (UINT8) ObjectType;
+
+ /* Just retyped a node, probably will need to open a scope */
+
+ if (AcpiNsOpensScope (ObjectType))
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
Status = AE_OK;
}
else
{
- AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op, Op->Asl.ExternalName);
+ /* Valid error, object already exists */
+
+ AslError (ASL_ERROR, ASL_MSG_NAME_EXISTS, Op,
+ Op->Asl.ExternalName);
Status = AE_OK;
goto Exit;
}
}
else
{
- AslCoreSubsystemError (Op, Status, "Failure from lookup %s\n", FALSE);
+ AslCoreSubsystemError (Op, Status,
+ "Failure from lookup %s\n", FALSE);
goto Exit;
}
}
+ if (ForceNewScope)
+ {
+ Status = AcpiDsScopeStackPush (Node, ObjectType, WalkState);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+ }
FinishNode:
/*
@@ -612,23 +726,23 @@
* the Node back to the original Parse node
*/
Op->Asl.Node = Node;
- Node->Object = (ACPI_OPERAND_OBJECT *) Op;
+ Node->Op = Op;
/* Set the actual data type if appropriate (EXTERNAL term only) */
if (ActualObjectType != ACPI_TYPE_ANY)
{
Node->Type = (UINT8) ActualObjectType;
- Node->OwnerId = ASL_EXTERNAL_METHOD;
+ Node->Value = ASL_EXTERNAL_METHOD;
}
if (Op->Asl.ParseOpcode == PARSEOP_METHOD)
{
/*
- * Get the method argument count from "Extra" and store
- * it in the OwnerId field of the namespace node
+ * Get the method argument count from "Extra" and save
+ * it in the namespace node
*/
- Node->OwnerId = (UINT16) Op->Asl.Extra;
+ Node->Value = (UINT32) Op->Asl.Extra;
}
Exit:
@@ -649,7 +763,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LdNamespace1End (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -657,9 +771,10 @@
{
ACPI_WALK_STATE *WalkState = (ACPI_WALK_STATE *) Context;
ACPI_OBJECT_TYPE ObjectType;
+ BOOLEAN ForceNewScope = FALSE;
- ACPI_FUNCTION_NAME ("LdNamespace1End");
+ ACPI_FUNCTION_NAME (LdNamespace1End);
/* We are only interested in opcodes that have an associated name */
@@ -683,16 +798,26 @@
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
}
+ /* Pop scope that was pushed for Resource Templates */
+
+ if (Op->Asl.ParseOpcode == PARSEOP_NAME)
+ {
+ if (Op->Asl.CompileFlags & NODE_IS_RESOURCE_DESC)
+ {
+ ForceNewScope = TRUE;
+ }
+ }
+
/* Pop the scope stack */
- if (AcpiNsOpensScope (ObjectType))
+ if (ForceNewScope || AcpiNsOpensScope (ObjectType))
{
ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
"(%s): Popping scope for Op [%s] %p\n",
AcpiUtGetTypeName (ObjectType), Op->Asl.ParseOpName, Op));
- AcpiDsScopeStackPop (WalkState);
+ (void) AcpiDsScopeStackPop (WalkState);
}
return (AE_OK);
Index: asllookup.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/asllookup.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/asllookup.c -L sys/contrib/dev/acpica/compiler/asllookup.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/asllookup.c
+++ sys/contrib/dev/acpica/compiler/asllookup.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Module Name: asllookup- Namespace lookup
- * $Revision: 83 $
+ * $Revision: 1.103 $
*
*****************************************************************************/
@@ -9,7 +9,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -115,18 +115,65 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "acparser.h"
-#include "amlcode.h"
-#include "acnamesp.h"
-#include "acdispat.h"
+#include <contrib/dev/acpica/acparser.h>
+#include <contrib/dev/acpica/amlcode.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/acdispat.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("asllookup")
+/* Local prototypes */
+
+static ACPI_STATUS
+LsCompareOneNamespaceObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+static ACPI_STATUS
+LsDoOneNamespaceObject (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+static BOOLEAN
+LkObjectExists (
+ char *Name);
+
+static void
+LkCheckFieldRange (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 RegionBitLength,
+ UINT32 FieldBitOffset,
+ UINT32 FieldBitLength,
+ UINT32 AccessBitWidth);
+
+static ACPI_STATUS
+LkNamespaceLocateBegin (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+LkNamespaceLocateEnd (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context);
+
+static ACPI_STATUS
+LkIsObjectUsed (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
/*******************************************************************************
*
@@ -141,7 +188,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LsDoOneNamespaceObject (
ACPI_HANDLE ObjHandle,
UINT32 Level,
@@ -149,70 +196,212 @@
void **ReturnValue)
{
ACPI_NAMESPACE_NODE *Node = (ACPI_NAMESPACE_NODE *) ObjHandle;
+ ACPI_OPERAND_OBJECT *ObjDesc;
ACPI_PARSE_OBJECT *Op;
Gbl_NumNamespaceObjects++;
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "%5d [%d] %*s %4.4s - %s",
- Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
- &Node->Name,
- AcpiUtGetTypeName (Node->Type));
+ Gbl_NumNamespaceObjects, Level, (Level * 3), " ",
+ &Node->Name,
+ AcpiUtGetTypeName (Node->Type));
- Op = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+ Op = Node->Op;
+ ObjDesc = ACPI_CAST_PTR (ACPI_OPERAND_OBJECT, Node->Object);
- if (Op)
+ if (!Op)
{
- if (Op->Asl.ParseOpcode == PARSEOP_NAME)
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "\n");
+ return (AE_OK);
+ }
+
+
+ if ((ObjDesc) &&
+ (ACPI_GET_DESCRIPTOR_TYPE (ObjDesc) == ACPI_DESC_TYPE_OPERAND))
+ {
+ switch (Node->Type)
{
- Op = Op->Asl.Child;
+ case ACPI_TYPE_INTEGER:
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Initial Value 0x%8.8X%8.8X]",
+ ACPI_FORMAT_UINT64 (ObjDesc->Integer.Value));
+ break;
+
+
+ case ACPI_TYPE_STRING:
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Initial Value \"%s\"]",
+ ObjDesc->String.Pointer);
+ break;
+
+ default:
+ /* Nothing to do for other types */
+ break;
}
+ }
+ else
+ {
switch (Node->Type)
{
case ACPI_TYPE_INTEGER:
+ if (Op->Asl.ParseOpcode == PARSEOP_NAME)
+ {
+ Op = Op->Asl.Child;
+ }
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
Op = Op->Asl.Next;
}
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Initial Value 0x%8.8X%8.8X]",
+ ACPI_FORMAT_UINT64 (Op->Asl.Value.Integer));
+ break;
+
- if (Op->Asl.Value.Integer > ACPI_UINT32_MAX)
+ case ACPI_TYPE_STRING:
+
+ if (Op->Asl.ParseOpcode == PARSEOP_NAME)
{
- FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X%X]",
- ACPI_HIDWORD (Op->Asl.Value.Integer64), (UINT32) Op->Asl.Value.Integer);
+ Op = Op->Asl.Child;
}
- else
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
- FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = 0x%X]",
- (UINT32) Op->Asl.Value.Integer);
+ Op = Op->Asl.Next;
}
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Initial Value \"%s\"]",
+ Op->Asl.Value.String);
break;
- case ACPI_TYPE_STRING:
+ case ACPI_TYPE_LOCAL_REGION_FIELD:
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
- Op = Op->Asl.Next;
+ Op = Op->Asl.Child;
}
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Offset 0x%04X Length 0x%04X bits]",
+ Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
+ break;
+
+
+ case ACPI_TYPE_BUFFER_FIELD:
+
+ switch (Op->Asl.ParseOpcode)
+ {
+ case PARSEOP_CREATEBYTEFIELD:
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BYTE ( 8 bit)]");
+ break;
+
+ case PARSEOP_CREATEDWORDFIELD:
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [DWORD (32 bit)]");
+ break;
+
+ case PARSEOP_CREATEQWORDFIELD:
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [QWORD (64 bit)]");
+ break;
+
+ case PARSEOP_CREATEWORDFIELD:
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [WORD (16 bit)]");
+ break;
+
+ case PARSEOP_CREATEBITFIELD:
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [BIT ( 1 bit)]");
+ break;
- FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Initial Value = \"%s\"]",
- Op->Asl.Value.String);
+ case PARSEOP_CREATEFIELD:
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Arbitrary Bit Field]");
+ break;
+
+ default:
+ break;
+
+ }
break;
- case ACPI_TYPE_LOCAL_REGION_FIELD:
+ case ACPI_TYPE_PACKAGE:
+ if (Op->Asl.ParseOpcode == PARSEOP_NAME)
+ {
+ Op = Op->Asl.Child;
+ }
if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
(Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
{
+ Op = Op->Asl.Next;
+ }
+ Op = Op->Asl.Child;
+
+ if ((Op->Asl.ParseOpcode == PARSEOP_BYTECONST) ||
+ (Op->Asl.ParseOpcode == PARSEOP_RAW_DATA))
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Initial Length 0x%.2X elements]",
+ Op->Asl.Value.Integer);
+ }
+ break;
+
+
+ case ACPI_TYPE_BUFFER:
+
+ if (Op->Asl.ParseOpcode == PARSEOP_NAME)
+ {
Op = Op->Asl.Child;
}
- FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, " [Offset 0x%02X, Length 0x%02X]",
- Op->Asl.Parent->Asl.ExtraValue, (UINT32) Op->Asl.Value.Integer);
+ if ((Op->Asl.ParseOpcode == PARSEOP_NAMESEG) ||
+ (Op->Asl.ParseOpcode == PARSEOP_NAMESTRING))
+ {
+ Op = Op->Asl.Next;
+ }
+ Op = Op->Asl.Child;
+
+ if (Op && (Op->Asl.ParseOpcode == PARSEOP_INTEGER))
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Initial Length 0x%.2X bytes]",
+ Op->Asl.Value.Integer);
+ }
+ break;
+
+
+ case ACPI_TYPE_METHOD:
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Code Length 0x%.4X bytes]",
+ Op->Asl.AmlSubtreeLength);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_RESOURCE:
+
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Desc Offset 0x%.4X Bytes]", Node->Value);
+ break;
+
+
+ case ACPI_TYPE_LOCAL_RESOURCE_FIELD:
+
+ if (Node->Flags & 0x80)
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Field Offset 0x%.4X Bits 0x%.4X Bytes]",
+ Node->Value, Node->Value / 8);
+ }
+ else
+ {
+ FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT,
+ " [Field Offset 0x%.4X Bytes]", Node->Value);
+ }
break;
@@ -227,13 +416,22 @@
}
+void
+LsSetupNsList (void * Handle)
+{
+
+ Gbl_NsOutputFlag = TRUE;
+ Gbl_Files[ASL_FILE_NAMESPACE_OUTPUT].Handle = Handle;
+}
+
+
/*******************************************************************************
*
* FUNCTION: LsDisplayNamespace
*
* PARAMETERS: None
*
- * RETURN: None
+ * RETURN: Status
*
* DESCRIPTION: Walk the namespace an display information about each node
* in the tree. Information is written to the optional
@@ -253,6 +451,8 @@
return (AE_OK);
}
+ Gbl_NumNamespaceObjects = 0;
+
/* File header */
FlPrintFile (ASL_FILE_NAMESPACE_OUTPUT, "Contents of ACPI Namespace\n\n");
@@ -261,8 +461,8 @@
/* Walk entire namespace from the root */
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject,
- NULL, NULL);
+ ACPI_UINT32_MAX, FALSE, LsDoOneNamespaceObject,
+ NULL, NULL);
return (Status);
}
@@ -279,7 +479,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LsCompareOneNamespaceObject (
ACPI_HANDLE ObjHandle,
UINT32 Level,
@@ -314,7 +514,7 @@
*
******************************************************************************/
-BOOLEAN
+static BOOLEAN
LkObjectExists (
char *Name)
{
@@ -324,8 +524,8 @@
/* Walk entire namespace from the supplied root */
Status = AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
- ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject,
- Name, NULL);
+ ACPI_UINT32_MAX, FALSE, LsCompareOneNamespaceObject,
+ Name, NULL);
if (Status == AE_CTRL_TRUE)
{
/* At least one instance of the name was found */
@@ -339,6 +539,153 @@
/*******************************************************************************
*
+ * FUNCTION: LkGetNameOp
+ *
+ * PARAMETERS: Op - Current Op
+ *
+ * RETURN: NameOp associated with the input op
+ *
+ * DESCRIPTION: Find the name declaration op associated with the operator
+ *
+ ******************************************************************************/
+
+ACPI_PARSE_OBJECT *
+LkGetNameOp (
+ ACPI_PARSE_OBJECT *Op)
+{
+ const ACPI_OPCODE_INFO *OpInfo;
+ ACPI_PARSE_OBJECT *NameOp = Op;
+
+
+ OpInfo = AcpiPsGetOpcodeInfo (Op->Asl.AmlOpcode);
+
+
+ /* Get the NamePath from the appropriate place */
+
+ if (OpInfo->Flags & AML_NAMED)
+ {
+ /* For nearly all NAMED operators, the name reference is the first child */
+
+ NameOp = Op->Asl.Child;
+ if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
+ {
+ /*
+ * ALIAS is the only oddball opcode, the name declaration
+ * (alias name) is the second operand
+ */
+ NameOp = Op->Asl.Child->Asl.Next;
+ }
+ }
+ else if (OpInfo->Flags & AML_CREATE)
+ {
+ /* Name must appear as the last parameter */
+
+ NameOp = Op->Asl.Child;
+ while (!(NameOp->Asl.CompileFlags & NODE_IS_NAME_DECLARATION))
+ {
+ NameOp = NameOp->Asl.Next;
+ }
+ }
+
+ return (NameOp);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkIsObjectUsed
+ *
+ * PARAMETERS: ACPI_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Check for an unreferenced namespace object and emit a warning.
+ * We have to be careful, because some types and names are
+ * typically or always unreferenced, we don't want to issue
+ * excessive warnings.
+ *
+ ******************************************************************************/
+
+static ACPI_STATUS
+LkIsObjectUsed (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *Node = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+
+
+ /* Referenced flag is set during the namespace xref */
+
+ if (Node->Flags & ANOBJ_IS_REFERENCED)
+ {
+ return (AE_OK);
+ }
+
+ /*
+ * Ignore names that start with an underscore,
+ * these are the reserved ACPI names and are typically not referenced,
+ * they are called by the host OS.
+ */
+ if (Node->Name.Ascii[0] == '_')
+ {
+ return (AE_OK);
+ }
+
+ /* There are some types that are typically not referenced, ignore them */
+
+ switch (Node->Type)
+ {
+ case ACPI_TYPE_DEVICE:
+ case ACPI_TYPE_PROCESSOR:
+ case ACPI_TYPE_POWER:
+ case ACPI_TYPE_LOCAL_RESOURCE:
+ return (AE_OK);
+
+ default:
+ break;
+ }
+
+ /* All others are valid unreferenced namespace objects */
+
+ if (Node->Op)
+ {
+ AslError (ASL_WARNING2, ASL_MSG_NOT_REFERENCED, LkGetNameOp (Node->Op), NULL);
+ }
+ return (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: LkFindUnreferencedObjects
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Namespace walk to find objects that are not referenced in any
+ * way. Must be called after the namespace has been cross
+ * referenced.
+ *
+ ******************************************************************************/
+
+void
+LkFindUnreferencedObjects (
+ void)
+{
+
+ /* Walk entire namespace from the supplied root */
+
+ (void) AcpiNsWalkNamespace (ACPI_TYPE_ANY, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, FALSE, LkIsObjectUsed,
+ NULL, NULL);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: LkCrossReferenceNamespace
*
* PARAMETERS: None
@@ -402,7 +749,7 @@
*
******************************************************************************/
-void
+static void
LkCheckFieldRange (
ACPI_PARSE_OBJECT *Op,
UINT32 RegionBitLength,
@@ -412,6 +759,7 @@
{
UINT32 FieldEndBitOffset;
+
/*
* Check each field unit against the region size. The entire
* field unit (start offset plus length) must fit within the
@@ -460,7 +808,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LkNamespaceLocateBegin (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -481,7 +829,7 @@
UINT32 Flags;
- ACPI_FUNCTION_TRACE_PTR ("LkNamespaceLocateBegin", Op);
+ ACPI_FUNCTION_TRACE_PTR (LkNamespaceLocateBegin, Op);
/*
* If this node is the actual declaration of a name
@@ -528,7 +876,7 @@
if (OpInfo->Flags & AML_NAMED)
{
- /* For all NAMED operators, the name reference is the first child */
+ /* For nearly all NAMED operators, the name reference is the first child */
Path = Op->Asl.Child->Asl.Value.String;
if (Op->Asl.AmlOpcode == AML_ALIAS_OP)
@@ -557,7 +905,8 @@
}
ObjectType = AslMapNamedOpcodeToDataType (Op->Asl.AmlOpcode);
- ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH, "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
+ ACPI_DEBUG_PRINT ((ACPI_DB_DISPATCH,
+ "Type=%s\n", AcpiUtGetTypeName (ObjectType)));
/*
* Lookup the name in the namespace. Name must exist at this point, or it
@@ -568,8 +917,8 @@
*/
Gbl_NsLookupCount++;
- Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
- ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
+ Status = AcpiNsLookup (WalkState->ScopeInfo, Path, ObjectType,
+ ACPI_IMODE_EXECUTE, Flags, WalkState, &(Node));
if (ACPI_FAILURE (Status))
{
if (Status == AE_NOT_FOUND)
@@ -584,15 +933,27 @@
if (LkObjectExists (Path))
{
- /* There exists such a name, but we couldn't get to it from this scope */
-
- AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op, Op->Asl.ExternalName);
+ /*
+ * There exists such a name, but we couldn't get to it
+ * from this scope
+ */
+ AslError (ASL_ERROR, ASL_MSG_NOT_REACHABLE, Op,
+ Op->Asl.ExternalName);
}
else
{
/* The name doesn't exist, period */
- AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName);
+ if ((Op->Asl.Parent) &&
+ (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
+ {
+ /* Ignore not found if parent is CondRefOf */
+
+ return (AE_OK);
+ }
+
+ AslError (ASL_ERROR, ASL_MSG_NOT_EXIST,
+ Op, Op->Asl.ExternalName);
}
}
else
@@ -603,13 +964,25 @@
{
/* Gave full path, the object does not exist */
- AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op, Op->Asl.ExternalName);
+ if ((Op->Asl.Parent) &&
+ (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_CONDREFOF))
+ {
+ /* Ignore not found if parent is CondRefOf */
+
+ return (AE_OK);
+ }
+
+ AslError (ASL_ERROR, ASL_MSG_NOT_EXIST, Op,
+ Op->Asl.ExternalName);
}
else
{
- /* We can't tell whether it doesn't exist or just can't be reached. */
-
- AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op, Op->Asl.ExternalName);
+ /*
+ * We can't tell whether it doesn't exist or just
+ * can't be reached.
+ */
+ AslError (ASL_ERROR, ASL_MSG_NOT_FOUND, Op,
+ Op->Asl.ExternalName);
}
}
@@ -618,39 +991,48 @@
return (Status);
}
+ /* Check for a reference vs. name declaration */
+
+ if (!(OpInfo->Flags & AML_NAMED) &&
+ !(OpInfo->Flags & AML_CREATE))
+ {
+ /* This node has been referenced, mark it for reference check */
+
+ Node->Flags |= ANOBJ_IS_REFERENCED;
+ }
+
/* Attempt to optimize the NamePath */
OptOptimizeNamePath (Op, OpInfo->Flags, WalkState, Path, Node);
/*
- * Dereference an alias. (A name reference that is an alias.)
- * Aliases are not nested; The alias always points to the final object
+ * 1) Dereference an alias (A name reference that is an alias)
+ * Aliases are not nested, the alias always points to the final object
*/
- if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) && (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
+ if ((Op->Asl.ParseOpcode != PARSEOP_ALIAS) &&
+ (Node->Type == ACPI_TYPE_LOCAL_ALIAS))
{
/* This node points back to the original PARSEOP_ALIAS */
- NextOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
+ NextOp = Node->Op;
/* The first child is the alias target op */
NextOp = NextOp->Asl.Child;
- /* Who in turn points back to original target alias node */
+ /* That in turn points back to original target alias node */
if (NextOp->Asl.Node)
{
Node = NextOp->Asl.Node;
}
- else
- {
- AslError (ASL_ERROR, ASL_MSG_COMPILER_INTERNAL, Op, "Missing alias link");
- }
+
+ /* Else - forward reference to alias, will be resolved later */
}
- /* 1) Check for a reference to a resource descriptor */
+ /* 2) Check for a reference to a resource descriptor */
- else if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
+ if ((Node->Type == ACPI_TYPE_LOCAL_RESOURCE_FIELD) ||
(Node->Type == ACPI_TYPE_LOCAL_RESOURCE))
{
/*
@@ -659,7 +1041,7 @@
* the field type) and change the named reference into an integer for
* AML code generation
*/
- Temp = (UINT32) Node->OwnerId;
+ Temp = Node->Value;
if (Node->Flags & ANOBJ_IS_BIT_OFFSET)
{
Op->Asl.CompileFlags |= NODE_IS_BIT_OFFSET;
@@ -715,15 +1097,15 @@
/* Now convert this node to an integer whose value is the field offset */
+ Op->Asl.AmlLength = 0;
Op->Asl.ParseOpcode = PARSEOP_INTEGER;
Op->Asl.Value.Integer = (UINT64) Temp;
Op->Asl.CompileFlags |= NODE_IS_RESOURCE_FIELD;
OpcGenerateAmlOpcode (Op);
- Op->Asl.AmlLength = OpcSetOptimalIntegerSize (Op);
}
- /* 2) Check for a method invocation */
+ /* 3) Check for a method invocation */
else if ((((Op->Asl.ParseOpcode == PARSEOP_NAMESTRING) || (Op->Asl.ParseOpcode == PARSEOP_NAMESEG)) &&
(Node->Type == ACPI_TYPE_METHOD) &&
@@ -734,14 +1116,28 @@
{
/*
+ * A reference to a method within one of these opcodes is not an
+ * invocation of the method, it is simply a reference to the method.
+ */
+ if ((Op->Asl.Parent) &&
+ ((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_REFOF) ||
+ (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEREFOF) ||
+ (Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_OBJECTTYPE)))
+ {
+ return (AE_OK);
+ }
+ /*
* There are two types of method invocation:
- * 1) Invocation with arguments -- the parser recognizes this as a METHODCALL
- * 2) Invocation with no arguments --the parser cannot determine that this is a method
- * invocation, therefore we have to figure it out here.
+ * 1) Invocation with arguments -- the parser recognizes this
+ * as a METHODCALL.
+ * 2) Invocation with no arguments --the parser cannot determine that
+ * this is a method invocation, therefore we have to figure it out
+ * here.
*/
if (Node->Type != ACPI_TYPE_METHOD)
{
- sprintf (MsgBuffer, "%s is a %s", Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
+ sprintf (MsgBuffer, "%s is a %s",
+ Op->Asl.ExternalName, AcpiUtGetTypeName (Node->Type));
AslError (ASL_ERROR, ASL_MSG_NOT_METHOD, Op, MsgBuffer);
return (AE_OK);
@@ -772,18 +1168,18 @@
NextOp = NextOp->Asl.Next;
}
- if (Node->OwnerId != ASL_EXTERNAL_METHOD)
+ if (Node->Value != ASL_EXTERNAL_METHOD)
{
/*
* Check the parsed arguments with the number expected by the
* method declaration itself
*/
- if (PassedArgs != Node->OwnerId)
+ if (PassedArgs != Node->Value)
{
sprintf (MsgBuffer, "%s requires %d", Op->Asl.ExternalName,
- Node->OwnerId);
+ Node->Value);
- if (PassedArgs < Node->OwnerId)
+ if (PassedArgs < Node->Value)
{
AslError (ASL_ERROR, ASL_MSG_ARG_COUNT_LO, Op, MsgBuffer);
}
@@ -795,9 +1191,8 @@
}
}
- /*
- * 3) Check for an ASL Field definition
- */
+ /* 4) Check for an ASL Field definition */
+
else if ((Op->Asl.Parent) &&
((Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_FIELD) ||
(Op->Asl.Parent->Asl.ParseOpcode == PARSEOP_BANKFIELD)))
@@ -818,8 +1213,9 @@
* the name of the region. Get the parse node for the
* region -- which contains the length of the region.
*/
- OwningOp = ACPI_CAST_PTR (ACPI_PARSE_OBJECT, Node->Object);
- Op->Asl.Parent->Asl.ExtraValue = ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer);
+ OwningOp = Node->Op;
+ Op->Asl.Parent->Asl.ExtraValue =
+ ACPI_MUL_8 ((UINT32) OwningOp->Asl.Value.Integer);
/* Examine the field access width */
@@ -926,7 +1322,7 @@
*
******************************************************************************/
-ACPI_STATUS
+static ACPI_STATUS
LkNamespaceLocateEnd (
ACPI_PARSE_OBJECT *Op,
UINT32 Level,
@@ -936,7 +1332,7 @@
const ACPI_OPCODE_INFO *OpInfo;
- ACPI_FUNCTION_TRACE ("LkNamespaceLocateEnd");
+ ACPI_FUNCTION_TRACE (LkNamespaceLocateEnd);
/* We are only interested in opcodes that have an associated name */
@@ -965,7 +1361,7 @@
"%s: Popping scope for Op %p\n",
AcpiUtGetTypeName (OpInfo->ObjectType), Op));
- AcpiDsScopeStackPop (WalkState);
+ (void) AcpiDsScopeStackPop (WalkState);
}
return (AE_OK);
Index: aslerror.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslerror.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslerror.c -L sys/contrib/dev/acpica/compiler/aslerror.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslerror.c
+++ sys/contrib/dev/acpica/compiler/aslerror.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslerror - Error handling and statistics
- * $Revision: 83 $
+ * $Revision: 1.92 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,11 +116,17 @@
*****************************************************************************/
#define ASL_EXCEPTIONS
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslerror")
+/* Local prototypes */
+
+static void
+AeAddToErrorLog (
+ ASL_ERROR_MSG *Enode);
+
/*******************************************************************************
*
@@ -136,7 +142,7 @@
*
******************************************************************************/
-void
+static void
AeAddToErrorLog (
ASL_ERROR_MSG *Enode)
{
@@ -189,7 +195,7 @@
*
* FUNCTION: AePrintException
*
- * PARAMETERS: Where - Where to send the message
+ * PARAMETERS: FileId - ID of output file
* Enode - Error node to print
* Header - Additional text before each message
*
@@ -211,7 +217,8 @@
char *Header)
{
UINT8 SourceByte;
- UINT32 Actual;
+ int Actual;
+ size_t RActual;
UINT32 MsgLength;
char *MainMessage;
char *ExtraMessage;
@@ -221,8 +228,10 @@
FILE *SourceFile;
- /* Only listing files have a header, and remarks/optimizations are always output */
-
+ /*
+ * Only listing files have a header, and remarks/optimizations
+ * are always output
+ */
if (!Header)
{
/* Ignore remarks if requested */
@@ -274,23 +283,26 @@
* Seek to the offset in the combined source file, read the source
* line, and write it to the output.
*/
- Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset, SEEK_SET);
+ Actual = fseek (SourceFile, (long) Enode->LogicalByteOffset,
+ (int) SEEK_SET);
if (Actual)
{
- fprintf (OutputFile, "[*** iASL: Seek error on source code temp file ***]");
+ fprintf (OutputFile,
+ "[*** iASL: Seek error on source code temp file ***]");
}
else
{
- Actual = fread (&SourceByte, 1, 1, SourceFile);
- if (!Actual)
+ RActual = fread (&SourceByte, 1, 1, SourceFile);
+ if (!RActual)
{
- fprintf (OutputFile, "[*** iASL: Read error on source code temp file ***]");
+ fprintf (OutputFile,
+ "[*** iASL: Read error on source code temp file ***]");
}
- else while (Actual && SourceByte && (SourceByte != '\n'))
+ else while (RActual && SourceByte && (SourceByte != '\n'))
{
fwrite (&SourceByte, 1, 1, OutputFile);
- Actual = fread (&SourceByte, 1, 1, SourceFile);
+ RActual = fread (&SourceByte, 1, 1, SourceFile);
}
}
fprintf (OutputFile, "\n");
@@ -373,9 +385,7 @@
}
else
{
- fprintf (OutputFile, " %s %s\n\n",
- MainMessage,
- ExtraMessage);
+ fprintf (OutputFile, " %s %s\n\n", MainMessage, ExtraMessage);
}
}
}
@@ -423,7 +433,7 @@
* Filename - source filename
* ExtraMessage - additional error message
*
- * RETURN: New error node for this error
+ * RETURN: None
*
* DESCRIPTION: Create a new error node and add it to the error log
*
@@ -493,7 +503,7 @@
Gbl_ExceptionCount[Level]++;
if (Gbl_ExceptionCount[ASL_ERROR] > ASL_MAX_ERROR_COUNT)
{
- printf ("\nMaximum error count (%d) exceeded.\n", ASL_MAX_ERROR_COUNT);
+ printf ("\nMaximum error count (%d) exceeded\n", ASL_MAX_ERROR_COUNT);
Gbl_SourceLine = 0;
Gbl_NextError = Gbl_ErrorLog;
@@ -529,6 +539,21 @@
char *ExtraMessage)
{
+ switch (Level)
+ {
+ case ASL_WARNING2:
+ case ASL_WARNING3:
+ if (Gbl_WarningLevel < Level)
+ {
+ return;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+
if (Op)
{
AslCommonError (Level, MessageId, Op->Asl.LineNumber,
@@ -598,10 +623,11 @@
*
* PARAMETERS: CompilerMessage - Error message from the parser
*
- * RETURN: Status?
+ * RETURN: Status (0 for now)
*
* DESCRIPTION: Report an error situation discovered in a production
- * NOTE: don't change the name of this function.
+ * NOTE: don't change the name of this function, it is called
+ * from the auto-generated parser.
*
******************************************************************************/
Index: aslmain.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslmain.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslmain.c -L sys/contrib/dev/acpica/compiler/aslmain.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslmain.c
+++ sys/contrib/dev/acpica/compiler/aslmain.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslmain - compiler main and utilities
- * $Revision: 77 $
+ * $Revision: 1.96 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -118,9 +118,10 @@
#define _DECLARE_GLOBALS
-#include "aslcompiler.h"
-#include "acnamesp.h"
-#include "acapps.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
+#include <contrib/dev/acpica/acnamesp.h>
+#include <contrib/dev/acpica/actables.h>
+#include <contrib/dev/acpica/acapps.h>
#ifdef _DEBUG
#include <crtdbg.h>
@@ -133,9 +134,37 @@
BOOLEAN DoCompile = TRUE;
BOOLEAN DoSignon = TRUE;
-char hex[] = {'0','1','2','3','4','5','6','7',
- '8','9','A','B','C','D','E','F'};
+char hex[] =
+{
+ '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'
+};
+
+/* Local prototypes */
+
+static void
+Options (
+ void);
+static void
+HelpMessage (
+ void);
+
+static void
+Usage (
+ void);
+
+static void
+AslInitialize (
+ void);
+
+static void
+AslCommandLine (
+ int argc,
+ char **argv);
+
+#ifdef _DEBUG
+#include <crtdbg.h>
+#endif
/*******************************************************************************
*
@@ -149,7 +178,7 @@
*
******************************************************************************/
-void
+static void
Options (
void)
{
@@ -160,6 +189,7 @@
printf (" -vo Enable optimization comments\n");
printf (" -vr Disable remarks\n");
printf (" -vs Disable signon\n");
+ printf (" -w<1|2|3> Set warning reporting level\n");
printf ("\nAML Output Files:\n");
printf (" -s<a|c> Create AML in assembler or C source file (*.asm or *.c)\n");
@@ -179,10 +209,11 @@
printf (" -ls Create combined source file (expanded includes) (*.src)\n");
printf ("\nAML Disassembler:\n");
- printf (" -d [file] Disassemble AML to ASL source code file (*.dsl)\n");
+ printf (" -d [file] Disassemble or decode binary ACPI table to file (*.dsl)\n");
printf (" -dc [file] Disassemble AML and immediately compile it\n");
printf (" (Obtain DSDT from current system if no input file)\n");
- printf (" -e Generate External() statements for unresolved symbols\n");
+ printf (" -e [file] Include ACPI table for external symbol resolution\n");
+ printf (" -2 Emit ACPI 2.0 compatible ASL code\n");
printf (" -g Get ACPI tables and write to files (*.dat)\n");
printf ("\nHelp:\n");
@@ -194,7 +225,7 @@
/*******************************************************************************
*
- * FUNCTION: Usage
+ * FUNCTION: HelpMessage
*
* PARAMETERS: None
*
@@ -204,7 +235,7 @@
*
******************************************************************************/
-void
+static void
HelpMessage (
void)
{
@@ -220,7 +251,7 @@
Options ();
- printf ("\nCompiler Debug Options:\n");
+ printf ("\nCompiler/Disassembler Debug Options:\n");
printf (" -b<p|t|b> Create compiler debug/trace file (*.txt)\n");
printf (" Types: Parse/Tree/Both\n");
printf (" -f Ignore errors, force creation of AML output file(s)\n");
@@ -242,7 +273,7 @@
*
******************************************************************************/
-void
+static void
Usage (
void)
{
@@ -264,8 +295,9 @@
*
******************************************************************************/
-void
-AslInitialize (void)
+static void
+AslInitialize (
+ void)
{
UINT32 i;
@@ -302,13 +334,13 @@
*
******************************************************************************/
-void
+static void
AslCommandLine (
int argc,
char **argv)
{
BOOLEAN BadCommandLine = FALSE;
- ACPI_NATIVE_UINT j;
+ ACPI_NATIVE_INT j;
/* Minimum command line contains at least one option or an input file */
@@ -322,10 +354,10 @@
/* Get the command line options */
- while ((j = AcpiGetopt (argc, argv, "ab:cd^efgh^i^l^o:p:r:s:t:v:x:")) != EOF) switch (j)
+ while ((j = AcpiGetopt (argc, argv, "2b:cd^e:fgh^i^l^o:p:r:s:t:v:w:x:")) != EOF) switch (j)
{
- case 'a':
- AslToFile = FALSE;
+ case '2':
+ Gbl_Acpi2 = TRUE;
break;
@@ -385,10 +417,7 @@
case 'e':
-
- /* Generate external statements for unresolved symbols */
-
- Gbl_GenerateExternals = TRUE;
+ Gbl_ExternalFilename = AcpiGbl_Optarg;
break;
@@ -632,6 +661,30 @@
break;
+ case 'w': /* Set warning levels */
+
+ switch (AcpiGbl_Optarg[0])
+ {
+ case '1':
+ Gbl_WarningLevel = ASL_WARNING;
+ break;
+
+ case '2':
+ Gbl_WarningLevel = ASL_WARNING2;
+ break;
+
+ case '3':
+ Gbl_WarningLevel = ASL_WARNING3;
+ break;
+
+ default:
+ printf ("Unknown option: -w%s\n", AcpiGbl_Optarg);
+ BadCommandLine = TRUE;
+ break;
+ }
+ break;
+
+
case 'x':
AcpiDbgLevel = strtoul (AcpiGbl_Optarg, NULL, 16);
@@ -647,7 +700,10 @@
/* Next parameter must be the input filename */
Gbl_Files[ASL_FILE_INPUT].Filename = argv[AcpiGbl_Optind];
- if (!Gbl_Files[ASL_FILE_INPUT].Filename && !Gbl_DisasmFlag && !Gbl_GetAllTables)
+
+ if (!Gbl_Files[ASL_FILE_INPUT].Filename &&
+ !Gbl_DisasmFlag &&
+ !Gbl_GetAllTables)
{
printf ("Missing input filename\n");
BadCommandLine = TRUE;
@@ -697,6 +753,11 @@
char *Prefix;
+#ifdef _DEBUG
+ _CrtSetDbgFlag (_CRTDBG_CHECK_ALWAYS_DF | _CRTDBG_LEAK_CHECK_DF |
+ _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG));
+#endif
+
/* Init and command line */
AslInitialize ();
@@ -706,32 +767,35 @@
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
- FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
+ Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
&Gbl_DirectoryPath, &Prefix);
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
if (Gbl_UseDefaultAmlFilename)
{
Gbl_OutputFilenamePrefix = Prefix;
}
- /*
- * AML Disassembly (Optional)
- */
+ /* AML Disassembly (Optional) */
+
if (Gbl_DisasmFlag || Gbl_GetAllTables)
{
/* ACPI CA subsystem initialization */
- Status = AcpiOsInitialize ();
- AcpiUtInitGlobals ();
- Status = AcpiUtMutexInitialize ();
+ Status = AdInitialize ();
if (ACPI_FAILURE (Status))
{
return -1;
}
- Status = AcpiNsRootInitialize ();
+ Status = AcpiAllocateRootTable (4);
if (ACPI_FAILURE (Status))
{
+ AcpiOsPrintf ("Could not initialize ACPI Table Manager, %s\n",
+ AcpiFormatException (Status));
return -1;
}
@@ -768,8 +832,12 @@
* If -p not specified, we will use the input filename as the
* output filename prefix
*/
- FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
+ Status = FlSplitInputPathname (Gbl_Files[ASL_FILE_INPUT].Filename,
&Gbl_DirectoryPath, &Prefix);
+ if (ACPI_FAILURE (Status))
+ {
+ return -1;
+ }
if (Gbl_UseDefaultAmlFilename)
{
Index: aslrestype1.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslrestype1.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslrestype1.c -L sys/contrib/dev/acpica/compiler/aslrestype1.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslrestype1.c
+++ sys/contrib/dev/acpica/compiler/aslrestype1.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslrestype1 - Short (type1) resource templates and descriptors
- * $Revision: 26 $
+ * $Revision: 1.40 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,7 +116,7 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
#define _COMPONENT ACPI_COMPILER
@@ -125,6 +125,40 @@
/*******************************************************************************
*
+ * FUNCTION: RsDoEndTagDescriptor
+ *
+ * PARAMETERS: Op - Parent resource descriptor parse node
+ * CurrentByteOffset - Offset into the resource template AML
+ * buffer (to track references to the desc)
+ *
+ * RETURN: Completed resource node
+ *
+ * DESCRIPTION: Construct a short "EndDependentFn" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoEndTagDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ASL_RESOURCE_NODE *Rnode;
+
+
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_TAG));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->EndTag.DescriptorType = ACPI_RESOURCE_NAME_END_TAG |
+ ASL_RDESC_END_TAG_SIZE;
+ Descriptor->EndTag.Checksum = 0;
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: RsDoDmaDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
@@ -142,23 +176,23 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
UINT8 DmaChannelMask = 0;
+ UINT8 DmaChannels = 0;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_DMA_FORMAT_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_DMA));
Descriptor = Rnode->Buffer;
- Descriptor->Dma.DescriptorType = ACPI_RDESC_TYPE_DMA_FORMAT |
+ Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
ASL_RDESC_DMA_SIZE;
- /*
- * Process all child initialization nodes
- */
+ /* Process all child initialization nodes */
+
for (i = 0; InitializerOp; i++)
{
switch (i)
@@ -166,22 +200,22 @@
case 0: /* DMA type */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DMATYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DMATYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 5);
break;
case 1: /* Bus Master */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_BUSMASTER,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_BUSMASTER,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 2);
break;
case 2: /* Xfer Type (transfer width) */
RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 0, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_XFERTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_XFERTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
break;
case 3: /* Name */
@@ -191,17 +225,45 @@
default:
- /* All DMA channel bytes are handled here, after the flags and name */
+ /* All DMA channel bytes are handled here, after flags and name */
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- DmaChannelMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
+ /* Up to 8 channels can be specified in the list */
+
+ DmaChannels++;
+ if (DmaChannels > 8)
+ {
+ AslError (ASL_ERROR, ASL_MSG_DMA_LIST,
+ InitializerOp, NULL);
+ return (Rnode);
+ }
+
+ /* Only DMA channels 0-7 are allowed (mask is 8 bits) */
+
+ if (InitializerOp->Asl.Value.Integer > 7)
+ {
+ AslError (ASL_ERROR, ASL_MSG_DMA_CHANNEL,
+ InitializerOp, NULL);
+ }
+
+ /* Build the mask */
+
+ DmaChannelMask |=
+ (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
}
if (i == 4) /* case 4: First DMA byte */
{
- RsCreateByteField (InitializerOp, ASL_RESNAME_DMA,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
+ /* Check now for duplicates in list */
+
+ RsCheckListForDuplicates (InitializerOp);
+
+ /* Create a named field at the start of the list */
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_DMA,
+ CurrentByteOffset +
+ ASL_RESDESC_OFFSET (Dma.DmaChannelMask));
}
break;
}
@@ -235,15 +297,15 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ASL_RESOURCE_NODE *Rnode;
- Rnode = RsAllocateResourceNode (sizeof (ASL_END_DEPENDENT_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_END_DEPENDENT));
Descriptor = Rnode->Buffer;
- Descriptor->End.DescriptorType = ACPI_RDESC_TYPE_END_DEPENDENT |
- ASL_RDESC_END_DEPEND_SIZE;
+ Descriptor->EndDpf.DescriptorType = ACPI_RESOURCE_NAME_END_DEPENDENT |
+ ASL_RDESC_END_DEPEND_SIZE;
return (Rnode);
}
@@ -267,38 +329,39 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_IO_PORT_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
Descriptor = Rnode->Buffer;
- Descriptor->Iop.DescriptorType = ACPI_RDESC_TYPE_FIXED_IO_PORT |
- ASL_RDESC_FIXED_IO_SIZE;
+ Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
+ ASL_RDESC_FIXED_IO_SIZE;
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Base Address */
- Descriptor->Fio.BaseAddress = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.BaseAddress));
+ Descriptor->FixedIo.Address =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
break;
case 1: /* Length */
- Descriptor->Fio.Length = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Fio.Length));
+ Descriptor->FixedIo.AddressLength =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
break;
case 2: /* Name */
@@ -338,59 +401,62 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_IO_PORT_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
Descriptor = Rnode->Buffer;
- Descriptor->Iop.DescriptorType = ACPI_RDESC_TYPE_IO_PORT |
- ASL_RDESC_IO_SIZE;
+ Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
+ ASL_RDESC_IO_SIZE;
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Decode size */
- RsSetFlagBits (&Descriptor->Iop.Information, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Information), 0);
+ RsSetFlagBits (&Descriptor->Io.Flags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Flags), 0);
break;
case 1: /* Min Address */
- Descriptor->Iop.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMin));
+ Descriptor->Io.Minimum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
break;
case 2: /* Max Address */
- Descriptor->Iop.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.AddressMax));
+ Descriptor->Io.Maximum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
break;
case 3: /* Alignment */
- Descriptor->Iop.Alignment = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Alignment));
+ Descriptor->Io.Alignment =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
break;
case 4: /* Length */
- Descriptor->Iop.Length = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Iop.Length));
+ Descriptor->Io.AddressLength =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
break;
case 5: /* Name */
@@ -430,25 +496,25 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 i;
+ UINT32 Interrupts = 0;
UINT16 IrqMask = 0;
+ UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_FORMAT_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
/* Length = 3 (with flag byte) */
Descriptor = Rnode->Buffer;
- Descriptor->Irq.DescriptorType = ACPI_RDESC_TYPE_IRQ_FORMAT |
- (ASL_RDESC_IRQ_SIZE + 0x01);
+ Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
+ (ASL_RDESC_IRQ_SIZE + 0x01);
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
@@ -456,22 +522,22 @@
case 0: /* Interrupt Type (or Mode - edge/level) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 0);
break;
case 1: /* Interrupt Level (or Polarity - Active high/low) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTLEVEL,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTLEVEL,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 3);
break;
case 2: /* Share Type - Default: exclusive (0) */
RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ASL_RESNAME_INTERRUPTSHARE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
break;
case 3: /* Name */
@@ -485,13 +551,41 @@
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
+ /* Up to 16 interrupts can be specified in the list */
+
+ Interrupts++;
+ if (Interrupts > 16)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
+ InitializerOp, NULL);
+ return (Rnode);
+ }
+
+ /* Only interrupts 0-15 are allowed (mask is 16 bits) */
+
+ if (InitializerOp->Asl.Value.Integer > 15)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
+ InitializerOp, NULL);
+ }
+ else
+ {
+ IrqMask |= (1 << (UINT8) InitializerOp->Asl.Value.Integer);
+ }
}
- if (i == 4) /* case 4: First IRQ byte */
+ /* Case 4: First IRQ value in list */
+
+ if (i == 4)
{
- RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
+ /* Check now for duplicates in list */
+
+ RsCheckListForDuplicates (InitializerOp);
+
+ /* Create a named field at the start of the list */
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
}
break;
}
@@ -525,23 +619,23 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
- UINT32 i;
UINT16 IrqMask = 0;
+ UINT32 Interrupts = 0;
+ UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_IRQ_NOFLAGS_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
Descriptor = Rnode->Buffer;
- Descriptor->Irq.DescriptorType = ACPI_RDESC_TYPE_IRQ_FORMAT |
- ASL_RDESC_IRQ_SIZE;
+ Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
+ ASL_RDESC_IRQ_SIZE;
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
@@ -557,13 +651,41 @@
if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
{
- IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
+ /* Up to 16 interrupts can be specified in the list */
+
+ Interrupts++;
+ if (Interrupts > 16)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INTERRUPT_LIST,
+ InitializerOp, NULL);
+ return (Rnode);
+ }
+
+ /* Only interrupts 0-15 are allowed (mask is 16 bits) */
+
+ if (InitializerOp->Asl.Value.Integer > 15)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INTERRUPT_NUMBER,
+ InitializerOp, NULL);
+ }
+ else
+ {
+ IrqMask |= (1 << ((UINT8) InitializerOp->Asl.Value.Integer));
+ }
}
- if (i == 1) /* case 1: First IRQ byte */
+ /* Case 1: First IRQ value in list */
+
+ if (i == 1)
{
- RsCreateByteField (InitializerOp, ASL_RESNAME_INTERRUPT,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
+ /* Check now for duplicates in list */
+
+ RsCheckListForDuplicates (InitializerOp);
+
+ /* Create a named field at the start of the list */
+
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_INTERRUPT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.IrqMask));
}
break;
}
@@ -597,59 +719,58 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_24_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY24));
Descriptor = Rnode->Buffer;
- Descriptor->M24.DescriptorType = ACPI_RDESC_TYPE_MEMORY_24;
- Descriptor->M24.Length = 9;
+ Descriptor->Memory24.DescriptorType = ACPI_RESOURCE_NAME_MEMORY24;
+ Descriptor->Memory24.ResourceLength = 9;
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Read/Write type */
- RsSetFlagBits (&Descriptor->M24.Information, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Information), 0);
+ RsSetFlagBits (&Descriptor->Memory24.Flags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Flags), 0);
break;
case 1: /* Min Address */
- Descriptor->M24.AddressMin = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMin));
+ Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
break;
case 2: /* Max Address */
- Descriptor->M24.AddressMax = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M24.AddressMax));
+ Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
break;
case 3: /* Alignment */
- Descriptor->M24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M24.Alignment));
+ Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
break;
case 4: /* Length */
- Descriptor->M24.RangeLength = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M24.RangeLength));
+ Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
break;
case 5: /* Name */
@@ -689,59 +810,58 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_MEMORY_32_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_MEMORY32));
Descriptor = Rnode->Buffer;
- Descriptor->M32.DescriptorType = ACPI_RDESC_TYPE_MEMORY_32;
- Descriptor->M32.Length = 17;
+ Descriptor->Memory32.DescriptorType = ACPI_RESOURCE_NAME_MEMORY32;
+ Descriptor->Memory32.ResourceLength = 17;
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Read/Write type */
- RsSetFlagBits (&Descriptor->M32.Information, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Information), 0);
+ RsSetFlagBits (&Descriptor->Memory32.Flags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Flags), 0);
break;
case 1: /* Min Address */
- Descriptor->M32.AddressMin = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMin));
+ Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
break;
case 2: /* Max Address */
- Descriptor->M32.AddressMax = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M32.AddressMax));
+ Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
break;
case 3: /* Alignment */
- Descriptor->M32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_ALIGNMENT,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M32.Alignment));
+ Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
break;
case 4: /* Length */
- Descriptor->M32.RangeLength = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (M32.RangeLength));
+ Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
break;
case 5: /* Name */
@@ -781,45 +901,44 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_FIXED_MEMORY_32_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_MEMORY32));
Descriptor = Rnode->Buffer;
- Descriptor->F32.DescriptorType = ACPI_RDESC_TYPE_FIXED_MEMORY_32;
- Descriptor->F32.Length = 9;
+ Descriptor->FixedMemory32.DescriptorType = ACPI_RESOURCE_NAME_FIXED_MEMORY32;
+ Descriptor->FixedMemory32.ResourceLength = 9;
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
for (i = 0; InitializerOp; i++)
{
switch (i)
{
case 0: /* Read/Write type */
- RsSetFlagBits (&Descriptor->F32.Information, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ASL_RESNAME_READWRITETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (F32.Information), 0);
+ RsSetFlagBits (&Descriptor->FixedMemory32.Flags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Flags), 0);
break;
case 1: /* Address */
- Descriptor->F32.BaseAddress = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_BASEADDRESS,
- CurrentByteOffset + ASL_RESDESC_OFFSET (F32.BaseAddress));
+ Descriptor->FixedMemory32.Address = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.Address));
break;
case 2: /* Length */
- Descriptor->F32.RangeLength = (UINT32) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ASL_RESNAME_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (F32.RangeLength));
+ Descriptor->FixedMemory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (FixedMemory32.AddressLength));
break;
case 3: /* Name */
@@ -859,7 +978,7 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
ASL_RESOURCE_NODE *PreviousRnode;
@@ -869,19 +988,18 @@
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT));
PreviousRnode = Rnode;
Descriptor = Rnode->Buffer;
/* Descriptor has priority byte */
- Descriptor->Std.DescriptorType = ACPI_RDESC_TYPE_START_DEPENDENT |
- (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
+ Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
+ (ASL_RDESC_ST_DEPEND_SIZE + 0x01);
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
State = ACPI_RSTATE_START_DEPENDENT;
for (i = 0; InitializerOp; i++)
{
@@ -891,24 +1009,27 @@
if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
{
- AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY, InitializerOp, NULL);
+ AslError (ASL_ERROR, ASL_MSG_INVALID_PRIORITY,
+ InitializerOp, NULL);
}
- RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 0, 0);
+ RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 0, 0);
break;
case 1: /* Performance/Robustness Priority */
if ((UINT8) InitializerOp->Asl.Value.Integer > 2)
{
- AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE, InitializerOp, NULL);
+ AslError (ASL_ERROR, ASL_MSG_INVALID_PERFORMANCE,
+ InitializerOp, NULL);
}
- RsSetFlagBits (&Descriptor->Std.Flags, InitializerOp, 2, 0);
+ RsSetFlagBits (&Descriptor->StartDpf.Flags, InitializerOp, 2, 0);
break;
default:
- NextRnode = RsDoOneResourceDescriptor (InitializerOp, CurrentByteOffset, &State);
+ NextRnode = RsDoOneResourceDescriptor (InitializerOp,
+ CurrentByteOffset, &State);
/*
* Update current byte offset to indicate the number of bytes from the
@@ -917,7 +1038,8 @@
* element (field) within each descriptor as well.
*/
- CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
+ CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
+ NextRnode);
break;
}
@@ -947,7 +1069,7 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
ASL_RESOURCE_NODE *PreviousRnode;
@@ -956,20 +1078,20 @@
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_START_DEPENDENT_NOPRIO_DESC));
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_START_DEPENDENT_NOPRIO));
Descriptor = Rnode->Buffer;
- Descriptor->Std.DescriptorType = ACPI_RDESC_TYPE_START_DEPENDENT |
- ASL_RDESC_ST_DEPEND_SIZE;
+ Descriptor->StartDpf.DescriptorType = ACPI_RESOURCE_NAME_START_DEPENDENT |
+ ASL_RDESC_ST_DEPEND_SIZE;
PreviousRnode = Rnode;
- /*
- * Process all child initialization nodes
- */
+ /* Process all child initialization nodes */
+
State = ACPI_RSTATE_START_DEPENDENT;
while (InitializerOp)
{
- NextRnode = RsDoOneResourceDescriptor (InitializerOp, CurrentByteOffset, &State);
+ NextRnode = RsDoOneResourceDescriptor (InitializerOp,
+ CurrentByteOffset, &State);
/*
* Update current byte offset to indicate the number of bytes from the
@@ -977,7 +1099,6 @@
* must keep track of the offset of not only each descriptor, but each
* element (field) within each descriptor as well.
*/
-
CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode, NextRnode);
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
@@ -1006,25 +1127,49 @@
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset)
{
- ASL_RESOURCE_DESC *Descriptor;
+ AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
ASL_RESOURCE_NODE *Rnode;
+ UINT8 *VendorData;
UINT32 i;
InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (ASL_SMALL_VENDOR_DESC));
+
+ /* Allocate worst case - 7 vendor bytes */
+
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_VENDOR_SMALL) + 7);
Descriptor = Rnode->Buffer;
- Descriptor->Smv.DescriptorType = ACPI_RDESC_TYPE_SMALL_VENDOR;
+ Descriptor->VendorSmall.DescriptorType = ACPI_RESOURCE_NAME_VENDOR_SMALL;
+ VendorData = ((UINT8 *) Descriptor) + sizeof (AML_RESOURCE_SMALL_HEADER);
+
+ /* Process all child initialization nodes */
- /*
- * Process all child initialization nodes
- */
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- for (i = 0; (InitializerOp && (i < 7)); i++)
+ for (i = 0; InitializerOp; i++)
{
- Descriptor->Smv.VendorDefined[i] = (UINT8) InitializerOp->Asl.Value.Integer;
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_DEFAULT_ARG)
+ {
+ break;
+ }
+
+ /* Maximum 7 vendor data bytes allowed (0-6) */
+
+ if (i >= 7)
+ {
+ AslError (ASL_ERROR, ASL_MSG_VENDOR_LIST, InitializerOp, NULL);
+
+ /* Eat the excess initializers */
+
+ while (InitializerOp)
+ {
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+ break;
+ }
+
+ VendorData[i] = (UINT8) InitializerOp->Asl.Value.Integer;
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
@@ -1034,7 +1179,7 @@
/* Set the length in the Type Tag */
- Descriptor->Smv.DescriptorType |= (UINT8) i;
+ Descriptor->VendorSmall.DescriptorType |= (UINT8) i;
return (Rnode);
}
Index: aslcompiler.l
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslcompiler.l,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslcompiler.l -L sys/contrib/dev/acpica/compiler/aslcompiler.l -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslcompiler.l
+++ sys/contrib/dev/acpica/compiler/aslcompiler.l
@@ -3,7 +3,7 @@
/******************************************************************************
*
* Module Name: aslcompiler.l - Flex input file
- * $Revision: $
+ * $Revision: 1.79 $
*
*****************************************************************************/
@@ -11,7 +11,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -119,7 +119,7 @@
#include <stdlib.h>
#include <string.h>
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
YYSTYPE AslCompilerlval;
@@ -357,6 +357,7 @@
"MutexObj" { count (0); return (PARSEOP_OBJECTTYPE_MTX); }
"OpRegionObj" { count (0); return (PARSEOP_OBJECTTYPE_OPR); }
"PowerResObj" { count (0); return (PARSEOP_OBJECTTYPE_POW); }
+"ProcessorObj" { count (0); return (PARSEOP_OBJECTTYPE_PRO); }
"ThermalZoneObj" { count (0); return (PARSEOP_OBJECTTYPE_THZ); }
"BuffFieldObj" { count (0); return (PARSEOP_OBJECTTYPE_BFF); }
"DDBHandleObj" { count (0); return (PARSEOP_OBJECTTYPE_DDB); }
@@ -476,7 +477,7 @@
if (strcmp (AslCompilertext, "\\"))
{
strcpy (s, "____");
- ACPI_STRUPR (AslCompilertext);
+ AcpiUtStrupr (AslCompilertext);
}
memcpy (s, AslCompilertext, strlen (AslCompilertext));
AslCompilerlval.s = s;
@@ -486,7 +487,7 @@
{NameString} { char *s;
count (0);
s=malloc (strlen (AslCompilertext)+1);
- ACPI_STRUPR (AslCompilertext);
+ AcpiUtStrupr (AslCompilertext);
strcpy (s, AslCompilertext);
s[strlen (AslCompilertext)] = 0;
AslCompilerlval.s = s;
@@ -578,7 +579,7 @@
/* All done with this node */
- ACPI_MEM_FREE (Fnode);
+ ACPI_FREE (Fnode);
return 0;
}
@@ -925,7 +926,8 @@
char
literal (void)
{
- char *s = MsgBuffer;
+ char *StringBuffer = MsgBuffer;
+ char *EndBuffer = MsgBuffer + ASL_MSG_BUFFER_SIZE;
char *CleanString;
char StringChar;
UINT32 State = ASL_NORMAL_CHAR;
@@ -1060,8 +1062,12 @@
}
else
{
- *s = (char) Digit;
- s++;
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
}
State = ASL_NORMAL_CHAR;
@@ -1101,8 +1107,12 @@
}
else
{
- *s = (char) Digit;
- s++;
+ *StringBuffer = (char) Digit;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
}
State = ASL_NORMAL_CHAR;
@@ -1119,8 +1129,12 @@
/* Save the finished character */
- *s = StringChar;
- s++;
+ *StringBuffer = StringChar;
+ StringBuffer++;
+ if (StringBuffer >= EndBuffer)
+ {
+ goto BufferOverflow;
+ }
}
/*
@@ -1137,7 +1151,7 @@
/*
* Null terminate the input string and copy string to a new buffer
*/
- *s = 0;
+ *StringBuffer = 0;
CleanString = UtGetStringBuffer (strlen (MsgBuffer) + 1);
if (!CleanString)
@@ -1152,6 +1166,17 @@
ACPI_STRCPY (CleanString, MsgBuffer);
AslCompilerlval.s = CleanString;
return (TRUE);
+
+
+BufferOverflow:
+
+ /* Literal was too long */
+
+ AslCommonError (ASL_ERROR, ASL_MSG_STRING_LENGTH,
+ Gbl_CurrentLineNumber, Gbl_LogicalLineNumber,
+ Gbl_CurrentLineOffset, Gbl_CurrentColumn,
+ Gbl_Files[ASL_FILE_INPUT].Filename, "Max length 4096");
+ return (FALSE);
}
Index: aslopcodes.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/acpica/compiler/aslopcodes.c,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -L sys/contrib/dev/acpica/compiler/aslopcodes.c -L sys/contrib/dev/acpica/compiler/aslopcodes.c -u -r1.1.1.2 -r1.2
--- sys/contrib/dev/acpica/compiler/aslopcodes.c
+++ sys/contrib/dev/acpica/compiler/aslopcodes.c
@@ -2,7 +2,7 @@
/******************************************************************************
*
* Module Name: aslopcode - AML opcode generation
- * $Revision: 60 $
+ * $Revision: 1.74 $
*
*****************************************************************************/
@@ -10,7 +10,7 @@
*
* 1. Copyright Notice
*
- * Some or all of this work - Copyright (c) 1999 - 2004, Intel Corp.
+ * Some or all of this work - Copyright (c) 1999 - 2007, Intel Corp.
* All rights reserved.
*
* 2. License
@@ -116,14 +116,79 @@
*****************************************************************************/
-#include "aslcompiler.h"
+#include <contrib/dev/acpica/compiler/aslcompiler.h>
#include "aslcompiler.y.h"
-#include "amlcode.h"
+#include <contrib/dev/acpica/amlcode.h>
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslopcodes")
+/* UUID support */
+
+static UINT8 OpcMapToUUID[16] =
+{
+ 6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34
+};
+
+/* Local prototypes */
+
+static void
+OpcDoAccessAs (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpcDoUnicode (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpcDoEisaId (
+ ACPI_PARSE_OBJECT *Op);
+
+static void
+OpcDoUuId (
+ ACPI_PARSE_OBJECT *Op);
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: OpcAmlOpcodeUpdateWalk
+ *
+ * PARAMETERS: ASL_WALK_CALLBACK
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Opcode update walk, ascending callback
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+OpcAmlOpcodeUpdateWalk (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 Level,
+ void *Context)
+{
+
+ /*
+ * Handle the Package() case where the actual opcode cannot be determined
+ * until the PackageLength operand has been folded and minimized.
+ * (PackageOp versus VarPackageOp)
+ *
+ * This is (as of ACPI 3.0) the only case where the AML opcode can change
+ * based upon the value of a parameter.
+ *
+ * The parser always inserts a VarPackage opcode, which can possibly be
+ * optimized to a Package opcode.
+ */
+ if (Op->Asl.ParseOpcode == PARSEOP_VAR_PACKAGE)
+ {
+ OpnDoPackage (Op);
+ }
+
+ return (AE_OK);
+}
+
+
/*******************************************************************************
*
* FUNCTION: OpcAmlOpcodeWalk
@@ -148,7 +213,6 @@
OpcGenerateAmlOpcode (Op);
OpnGenerateAmlOperands (Op);
-
return (AE_OK);
}
@@ -171,18 +235,26 @@
{
ACPI_PARSE_OBJECT *Child;
+
if (!Op)
{
return;
}
- Child = Op->Asl.Child;
- Child = Child->Asl.Next;
- Child = Child->Asl.Next;
+ if (Gbl_RevisionOverride)
+ {
+ AcpiUtSetIntegerWidth (Gbl_RevisionOverride);
+ }
+ else
+ {
+ Child = Op->Asl.Child;
+ Child = Child->Asl.Next;
+ Child = Child->Asl.Next;
- /* Use the revision to set the integer width */
+ /* Use the revision to set the integer width */
- AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
+ AcpiUtSetIntegerWidth ((UINT8) Child->Asl.Value.Integer);
+ }
}
@@ -206,17 +278,18 @@
ACPI_PARSE_OBJECT *Op)
{
-/*
- TBD: - we don't want to optimize integers in the block header, but the
- code below does not work correctly.
-
+#if 0
+ /*
+ * TBD: - we don't want to optimize integers in the block header, but the
+ * code below does not work correctly.
+ */
if (Op->Asl.Parent &&
Op->Asl.Parent->Asl.Parent &&
- (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))
+ (Op->Asl.Parent->Asl.Parent->Asl.ParseOpcode == PARSEOP_DEFINITIONBLOCK))
{
return 0;
}
-*/
+#endif
/*
* Check for the special AML integers first - Zero, One, Ones.
@@ -232,13 +305,15 @@
case 0:
Op->Asl.AmlOpcode = AML_ZERO_OP;
- AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Zero");
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
+ Op, "Zero");
return 1;
case 1:
Op->Asl.AmlOpcode = AML_ONE_OP;
- AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "One");
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
+ Op, "One");
return 1;
case ACPI_UINT32_MAX:
@@ -248,7 +323,8 @@
if (AcpiGbl_IntegerByteWidth == 4)
{
Op->Asl.AmlOpcode = AML_ONES_OP;
- AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones");
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
+ Op, "Ones");
return 1;
}
break;
@@ -260,7 +336,8 @@
if (AcpiGbl_IntegerByteWidth == 8)
{
Op->Asl.AmlOpcode = AML_ONES_OP;
- AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION, Op, "Ones");
+ AslError (ASL_OPTIMIZATION, ASL_MSG_INTEGER_OPTIMIZATION,
+ Op, "Ones");
return 1;
}
break;
@@ -289,6 +366,19 @@
}
else
{
+ if (AcpiGbl_IntegerByteWidth == 4)
+ {
+ AslError (ASL_WARNING, ASL_MSG_INTEGER_LENGTH,
+ Op, NULL);
+
+ if (!Gbl_IgnoreErrors)
+ {
+ /* Truncate the integer to 32-bit */
+ Op->Asl.AmlOpcode = AML_DWORD_OP;
+ return 4;
+ }
+ }
+
Op->Asl.AmlOpcode = AML_QWORD_OP;
return 8;
}
@@ -307,11 +397,11 @@
*
******************************************************************************/
-void
+static void
OpcDoAccessAs (
- ACPI_PARSE_OBJECT *Op)
+ ACPI_PARSE_OBJECT *Op)
{
- ACPI_PARSE_OBJECT *Next;
+ ACPI_PARSE_OBJECT *Next;
Op->Asl.AmlOpcodeLength = 1;
@@ -350,17 +440,17 @@
*
******************************************************************************/
-void
+static void
OpcDoUnicode (
- ACPI_PARSE_OBJECT *Op)
+ ACPI_PARSE_OBJECT *Op)
{
- ACPI_PARSE_OBJECT *InitializerOp;
- UINT32 Length;
- UINT32 Count;
- UINT32 i;
- UINT8 *AsciiString;
- UINT16 *UnicodeString;
- ACPI_PARSE_OBJECT *BufferLengthOp;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ UINT32 Length;
+ UINT32 Count;
+ UINT32 i;
+ UINT8 *AsciiString;
+ UINT16 *UnicodeString;
+ ACPI_PARSE_OBJECT *BufferLengthOp;
/* Change op into a buffer object */
@@ -448,7 +538,7 @@
*
******************************************************************************/
-void
+static void
OpcDoEisaId (
ACPI_PARSE_OBJECT *Op)
{
@@ -463,7 +553,7 @@
/*
* The EISAID string must be exactly 7 characters and of the form
- * "LLLXXXX" -- 3 letters and 4 hex digits (e.g., "PNP0001")
+ * "UUUXXXX" -- 3 uppercase letters and 4 hex digits (e.g., "PNP0001")
*/
if (ACPI_STRLEN (InString) != 7)
{
@@ -502,14 +592,15 @@
{
/* Create ID big-endian first (bits are contiguous) */
- BigEndianId = (UINT32) (InString[0] - 0x40) << 26 |
- (UINT32) (InString[1] - 0x40) << 21 |
- (UINT32) (InString[2] - 0x40) << 16 |
-
- (UtHexCharToValue (InString[3])) << 12 |
- (UtHexCharToValue (InString[4])) << 8 |
- (UtHexCharToValue (InString[5])) << 4 |
- UtHexCharToValue (InString[6]);
+ BigEndianId =
+ (UINT32) (InString[0] - 0x40) << 26 |
+ (UINT32) (InString[1] - 0x40) << 21 |
+ (UINT32) (InString[2] - 0x40) << 16 |
+
+ (UtHexCharToValue (InString[3])) << 12 |
+ (UtHexCharToValue (InString[4])) << 8 |
+ (UtHexCharToValue (InString[5])) << 4 |
+ UtHexCharToValue (InString[6]);
/* Swap to little-endian to get final ID (see function header) */
@@ -540,13 +631,11 @@
*
* RETURN: None
*
- * DESCRIPTION:
+ * DESCRIPTION: Convert UUID string to 16-byte buffer
*
******************************************************************************/
-static UINT8 OpcMapToUUID[16] = {6,4,2,0,11,9,16,14,19,21,24,26,28,30,32,34};
-
-void
+static void
OpcDoUuId (
ACPI_PARSE_OBJECT *Op)
{
@@ -594,15 +683,18 @@
}
else for (i = 0; i < 16; i++)
{
- Buffer[i] = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4);
- Buffer[i] = (char) UtHexCharToValue (InString[OpcMapToUUID[i] + 1]);
+ Buffer[i] = (char) (UtHexCharToValue (InString[OpcMapToUUID[i]]) << 4);
+ Buffer[i] |= (char) UtHexCharToValue (InString[OpcMapToUUID[i] + 1]);
}
/* Change Op to a Buffer */
Op->Asl.ParseOpcode = PARSEOP_BUFFER;
Op->Common.AmlOpcode = AML_BUFFER_OP;
- Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST; /* Disable further optimization */
+
+ /* Disable further optimization */
+
+ Op->Asl.CompileFlags &= ~NODE_COMPILE_TIME_CONST;
UtSetParseOpName (Op);
/* Child node is the buffer length */
@@ -709,18 +801,6 @@
Op->Asl.Child->Asl.Next->Asl.ParseOpcode = PARSEOP_DEFAULT_ARG;
break;
- case PARSEOP_PACKAGE:
- /*
- * The variable-length package has a different opcode
- */
- if ((Op->Asl.Child->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_INTEGER) &&
- (Op->Asl.Child->Asl.ParseOpcode != PARSEOP_BYTECONST))
- {
- Op->Asl.AmlOpcode = AML_VAR_PACKAGE_OP;
- }
- break;
-
default:
/* Nothing to do for other opcodes */
break;
Index: if_oltr.c
===================================================================
RCS file: /home/cvs/src/sys/contrib/dev/oltr/if_oltr.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -L sys/contrib/dev/oltr/if_oltr.c -L sys/contrib/dev/oltr/if_oltr.c -u -r1.1.1.1 -r1.2
--- sys/contrib/dev/oltr/if_oltr.c
+++ sys/contrib/dev/oltr/if_oltr.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.37.2.2 2005/10/09 04:18:17 delphij Exp $
+ * $FreeBSD: src/sys/contrib/dev/oltr/if_oltr.c,v 1.43 2007/02/23 12:18:28 piso Exp $
*/
#include <sys/param.h>
@@ -41,7 +41,7 @@
#include <sys/socket.h>
#include <net/if.h>
-#include <net/if_arp.h>
+#include <net/if_dl.h>
#include <net/iso88025.h>
#include <net/if_media.h>
#include <net/if_types.h>
@@ -58,7 +58,6 @@
#include <vm/pmap.h> /* for vtophys */
#include <machine/bus.h>
-#include <machine/clock.h>
#include <machine/resource.h>
#include <sys/bus.h>
@@ -155,7 +154,7 @@
if_free(ifp);
return (-1);
}
- if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, oltr_intr,
+ if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_NET, NULL, oltr_intr,
sc, &sc-> oltr_intrhand)) {
device_printf(dev, "couldn't setup interrupt\n");
bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res);
@@ -173,7 +172,6 @@
ifp->if_ioctl = oltr_ioctl;
ifp->if_flags = IFF_BROADCAST | IFF_NEEDSGIANT;
ifp->if_snd.ifq_maxlen = IFQ_MAXLEN;
- bcopy(sc->config.macaddress, IFP2ENADDR(sc->ifp), sizeof(sc->config.macaddress));
/*
* Do ifmedia setup.
@@ -203,7 +201,7 @@
* Attach the interface
*/
- iso88025_ifattach(ifp, ISO88025_BPF_SUPPORTED);
+ iso88025_ifattach(ifp, sc->config.macaddress, ISO88025_BPF_SUPPORTED);
return(0);
}
@@ -490,7 +488,7 @@
/*
* Open the adapter
*/
- rc = TRlldOpen(sc->TRlldAdapter, IFP2ENADDR(sc->ifp), sc->GroupAddress,
+ rc = TRlldOpen(sc->TRlldAdapter, IF_LLADDR(sc->ifp), sc->GroupAddress,
sc->FunctionalAddress, 1552, sc->AdapterMode);
switch(rc) {
case TRLLD_OPEN_OK:
More information about the Midnightbsd-cvs
mailing list