aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2010-04-28 21:50:57 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2010-04-28 21:50:57 +0000
commit5b663f0c698a9ecf7e562f7f7f730d056e499b5f (patch)
tree8e0094680041ac8d48075e0787478ffeb5d61682
parent9a8b5e6355e39ba0602a7f9484dca40f429fe6b0 (diff)
downloadsrc-vendor/acpica/20100428.tar.gz
src-vendor/acpica/20100428.zip
Import ACPICA 20100428.vendor/acpica/20100428
-rw-r--r--changes.txt66
-rw-r--r--common/adisasm.c6
-rw-r--r--compiler/Makefile38
-rw-r--r--compiler/aslcompile.c6
-rw-r--r--compiler/aslcompiler.h100
-rw-r--r--compiler/asldefine.h2
-rw-r--r--compiler/aslfiles.c30
-rw-r--r--compiler/aslglobal.h3
-rw-r--r--compiler/asllisting.c247
-rw-r--r--compiler/aslmain.c31
-rw-r--r--compiler/aslpredef.c78
-rw-r--r--compiler/aslresource.c294
-rw-r--r--compiler/aslrestype1.c562
-rw-r--r--compiler/aslrestype1i.c668
-rw-r--r--compiler/aslrestype2.c2394
-rw-r--r--compiler/aslrestype2d.c814
-rw-r--r--compiler/aslrestype2e.c646
-rw-r--r--compiler/aslrestype2q.c793
-rw-r--r--compiler/aslrestype2w.c774
-rw-r--r--compiler/asltypes.h22
-rw-r--r--debugger/dbcmds.c2
-rw-r--r--debugger/dbdisply.c14
-rw-r--r--events/evgpe.c2
-rw-r--r--events/evgpeblk.c774
-rw-r--r--events/evgpeinit.c763
-rw-r--r--events/evgpeutil.c452
-rw-r--r--executer/exconfig.c21
-rw-r--r--executer/exoparg1.c2
-rw-r--r--executer/exsystem.c8
-rw-r--r--include/acevents.h74
-rw-r--r--include/acglobal.h7
-rw-r--r--include/acinterp.h2
-rw-r--r--include/aclocal.h16
-rw-r--r--include/acpiosxf.h4
-rw-r--r--include/acpixf.h30
-rw-r--r--include/actypes.h2
-rw-r--r--include/amlresrc.h6
-rw-r--r--os_specific/service_layers/osunixxf.c4
-rw-r--r--os_specific/service_layers/oswinxf.c4
-rw-r--r--osunixxf.c4
-rw-r--r--tables/tbfind.c2
-rw-r--r--tables/tbinstal.c52
-rw-r--r--tables/tbutils.c15
-rw-r--r--tables/tbxface.c20
-rw-r--r--tests/misc/badcode.asl295
-rw-r--r--tests/misc/grammar.asl10266
-rw-r--r--tools/acpiexec/Makefile4
-rw-r--r--tools/acpiexec/aeexec.c1
-rw-r--r--tools/acpiexec/aetables.c141
-rw-r--r--tools/acpisrc/astable.c1
-rw-r--r--utilities/utcopy.c20
-rw-r--r--utilities/utglobal.c4
-rw-r--r--utilities/uttrack.c108
53 files changed, 16773 insertions, 3921 deletions
diff --git a/changes.txt b/changes.txt
index d2c8c0e41edf..fed0395e61ae 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,4 +1,70 @@
----------------------------------------
+28 April 2010. Summary of changes for version 20100428:
+
+1) ACPI CA Core Subsystem:
+
+Implemented GPE support for dynamically loaded ACPI tables. For all GPEs,
+including FADT-based and GPE Block Devices, execute any _PRW methods in the
+new table, and process any _Lxx/_Exx GPE methods in the new table. Any
+runtime GPE that is referenced by an _Lxx/_Exx method in the new table is
+immediately enabled. Handles the FADT-defined GPEs as well as GPE Block
+Devices. Provides compatibility with other ACPI implementations. Two new
+files added, evgpeinit.c and evgpeutil.c. ACPICA BZ 833. Lin Ming, Bob Moore.
+
+Fixed a regression introduced in version 20100331 within the table manager
+where initial table loading could fail. This was introduced in the fix for
+AcpiReallocateRootTable. Also, renamed some of fields in the table manager
+data structures to clarify their meaning and use.
+
+Fixed a possible allocation overrun during internal object copy in
+AcpiUtCopySimpleObject. The original code did not correctly handle the case
+where the object to be copied was a namespace node. Lin Ming. ACPICA BZ 847.
+
+Updated the allocation dump routine, AcpiUtDumpAllocation and fixed a
+possible access beyond end-of-allocation. Also, now fully validate descriptor
+(size and type) before output. Lin Ming, Bob Moore. ACPICA BZ 847
+
+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: 87.9K Code, 18.6K Data, 106.5K Total
+ Debug Version: 163.5K Code, 51.3K Data, 214.8K Total
+ Current Release:
+ Non-Debug Version: 88.4K Code, 18.8K Data, 107.2K Total
+ Debug Version: 164.2K Code, 51.5K Data, 215.7K Total
+
+2) iASL Compiler/Disassembler and Tools:
+
+iASL: Implemented Min/Max/Len/Gran validation for address resource
+descriptors. This change implements validation for the address fields that
+are common to all address-type resource descriptors. These checks are
+implemented: Checks for valid Min/Max, length within the Min/Max window,
+valid granularity, Min/Max a multiple of granularity, and _MIF/_MAF as per
+table 6-40 in the ACPI 4.0a specification. Also split the large aslrestype1.c
+and aslrestype2.c files into five new files. ACPICA BZ 840.
+
+iASL: Added support for the _Wxx predefined names. This support was missing
+and these names were not recognized by the compiler as valid predefined
+names. ACPICA BZ 851.
+
+iASL: Added an error for all predefined names that are defined to return no
+value and thus must be implemented as Control Methods. These include all of
+the _Lxx, _Exx, _Wxx, and _Qxx names, as well as some other miscellaneous
+names such as _DIS, _INI, _IRC, _OFF, _ON, and _PSx. ACPICA BZ 850, 856.
+
+iASL: Implemented the -ts option to emit hex AML data in ASL format, as an
+ASL Buffer. Allows ACPI tables to be easily included within ASL files, to be
+dynamically loaded via the Load() operator. Also cleaned up output for the -
+ta and -tc options. ACPICA BZ 853.
+
+Tests: Added a new file with examples of extended iASL error checking.
+Demonstrates the advanced error checking ability of the iASL compiler.
+Available at tests/misc/badcode.asl.
+
+----------------------------------------
31 March 2010. Summary of changes for version 20100331:
1) ACPI CA Core Subsystem:
diff --git a/common/adisasm.c b/common/adisasm.c
index 093cfe5536eb..eced93d536bc 100644
--- a/common/adisasm.c
+++ b/common/adisasm.c
@@ -282,8 +282,8 @@ AdInitialize (
/* Setup the Table Manager (cheat - there is no RSDT) */
- AcpiGbl_RootTableList.Size = 1;
- AcpiGbl_RootTableList.Count = 0;
+ AcpiGbl_RootTableList.MaxTableCount = 1;
+ AcpiGbl_RootTableList.CurrentTableCount = 0;
AcpiGbl_RootTableList.Tables = LocalTables;
return (Status);
@@ -1156,7 +1156,7 @@ AdParseTable (
/* If LoadTable is FALSE, we are parsing the last loaded table */
- TableIndex = AcpiGbl_RootTableList.Count - 1;
+ TableIndex = AcpiGbl_RootTableList.CurrentTableCount - 1;
/* Pass 2 */
diff --git a/compiler/Makefile b/compiler/Makefile
index b4c03fd06279..2bdd0d31d264 100644
--- a/compiler/Makefile
+++ b/compiler/Makefile
@@ -1,11 +1,37 @@
-
PROG= iasl
-SRCS= aslcompilerparse.c aslcompilerlex.c aslanalyze.c aslcodegen.c \
- aslcompile.c aslerror.c aslfiles.c asllength.c \
- asllisting.c aslload.c asllookup.c aslmain.c aslmap.c aslopcodes.c \
- asloperands.c aslpredef.c aslresource.c aslrestype1.c aslrestype2.c aslstartup.c \
- asltree.c aslutils.c asltransform.c aslfold.c aslstubs.c aslopt.c \
+SRCS= \
+ aslcompilerparse.c \
+ aslcompilerlex.c \
+ aslanalyze.c \
+ aslcodegen.c \
+ aslcompile.c \
+ aslerror.c \
+ aslfiles.c \
+ aslfold.c \
+ asllength.c \
+ asllisting.c \
+ aslload.c \
+ asllookup.c \
+ aslmain.c \
+ aslmap.c \
+ aslopcodes.c \
+ asloperands.c \
+ aslopt.c \
+ aslpredef.c \
+ aslresource.c \
+ aslrestype1.c \
+ aslrestype1i.c \
+ aslrestype2.c \
+ aslrestype2d.c \
+ aslrestype2e.c \
+ aslrestype2q.c \
+ aslrestype2w.c \
+ aslstartup.c \
+ aslstubs.c \
+ asltransform.c \
+ asltree.c \
+ aslutils.c \
../common/getopt.c \
../utilities/utalloc.c \
../utilities/utcache.c \
diff --git a/compiler/aslcompile.c b/compiler/aslcompile.c
index 90e90991b7e9..d6cb8adc7387 100644
--- a/compiler/aslcompile.c
+++ b/compiler/aslcompile.c
@@ -177,7 +177,8 @@ AslCompilerSignon (
{
Prefix = "; ";
}
- else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
+ else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
+ (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
{
FlPrintFile (ASL_FILE_HEX_OUTPUT, "/*\n");
Prefix = " * ";
@@ -265,7 +266,8 @@ AslCompilerFileHeader (
{
Prefix = "; ";
}
- else if (Gbl_HexOutputFlag == HEX_OUTPUT_C)
+ else if ((Gbl_HexOutputFlag == HEX_OUTPUT_C) ||
+ (Gbl_HexOutputFlag == HEX_OUTPUT_ASL))
{
Prefix = " * ";
}
diff --git a/compiler/aslcompiler.h b/compiler/aslcompiler.h
index 508379829894..804713b00d97 100644
--- a/compiler/aslcompiler.h
+++ b/compiler/aslcompiler.h
@@ -592,6 +592,10 @@ FlFileError (
UINT32 FileId,
UINT8 ErrorId);
+UINT32
+FlGetFileSize (
+ UINT32 FileId);
+
ACPI_STATUS
FlReadFile (
UINT32 FileId,
@@ -750,6 +754,34 @@ UtDoConstant (
/*
* aslresource - Resource template generation utilities
*/
+void
+RsSmallAddressCheck (
+ UINT8 Type,
+ UINT32 Minimum,
+ UINT32 Maximum,
+ UINT32 Length,
+ UINT32 Alignment,
+ ACPI_PARSE_OBJECT *MinOp,
+ ACPI_PARSE_OBJECT *MaxOp,
+ ACPI_PARSE_OBJECT *LengthOp,
+ ACPI_PARSE_OBJECT *AlignOp);
+
+void
+RsLargeAddressCheck (
+ UINT64 Minimum,
+ UINT64 Maximum,
+ UINT64 Length,
+ UINT64 Granularity,
+ UINT8 Flags,
+ ACPI_PARSE_OBJECT *MinOp,
+ ACPI_PARSE_OBJECT *MaxOp,
+ ACPI_PARSE_OBJECT *LengthOp,
+ ACPI_PARSE_OBJECT *GranOp);
+
+UINT16
+RsGetStringDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp);
+
ASL_RESOURCE_NODE *
RsAllocateResourceNode (
UINT32 Size);
@@ -805,7 +837,7 @@ RsDoResourceTemplate (
/*
- * aslrestype1 - generate Small descriptors
+ * aslrestype1 - Miscellaneous Small descriptors
*/
ASL_RESOURCE_NODE *
RsDoEndTagDescriptor (
@@ -813,68 +845,72 @@ RsDoEndTagDescriptor (
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoDmaDescriptor (
+RsDoEndDependentDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoEndDependentDescriptor (
+RsDoMemory24Descriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoFixedIoDescriptor (
+RsDoMemory32Descriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoIoDescriptor (
+RsDoMemory32FixedDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoIrqDescriptor (
+RsDoStartDependentDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoIrqNoFlagsDescriptor (
+RsDoStartDependentNoPriDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoMemory24Descriptor (
+RsDoVendorSmallDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
+
+/*
+ * aslrestype1i - I/O-related Small descriptors
+ */
ASL_RESOURCE_NODE *
-RsDoMemory32Descriptor (
+RsDoDmaDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoMemory32FixedDescriptor (
+RsDoFixedIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoStartDependentDescriptor (
+RsDoIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoStartDependentNoPriDescriptor (
+RsDoIrqDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
-RsDoVendorSmallDescriptor (
+RsDoIrqNoFlagsDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
/*
- * aslrestype2 - generate Large descriptors
+ * aslrestype2 - Large resource descriptors
*/
ASL_RESOURCE_NODE *
RsDoInterruptDescriptor (
@@ -882,6 +918,20 @@ RsDoInterruptDescriptor (
UINT32 CurrentByteOffset);
ASL_RESOURCE_NODE *
+RsDoVendorLargeDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+ASL_RESOURCE_NODE *
+RsDoGeneralRegisterDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset);
+
+
+/*
+ * aslrestype2d - DWord address descriptors
+ */
+ASL_RESOURCE_NODE *
RsDoDwordIoDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
@@ -896,6 +946,10 @@ RsDoDwordSpaceDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
+
+/*
+ * aslrestype2e - Extended address descriptors
+ */
ASL_RESOURCE_NODE *
RsDoExtendedIoDescriptor (
ACPI_PARSE_OBJECT *Op,
@@ -911,6 +965,10 @@ RsDoExtendedSpaceDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
+
+/*
+ * aslrestype2q - QWord address descriptors
+ */
ASL_RESOURCE_NODE *
RsDoQwordIoDescriptor (
ACPI_PARSE_OBJECT *Op,
@@ -926,6 +984,10 @@ RsDoQwordSpaceDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
+
+/*
+ * aslrestype2w - Word address descriptors
+ */
ASL_RESOURCE_NODE *
RsDoWordIoDescriptor (
ACPI_PARSE_OBJECT *Op,
@@ -941,15 +1003,5 @@ RsDoWordBusNumberDescriptor (
ACPI_PARSE_OBJECT *Op,
UINT32 CurrentByteOffset);
-ASL_RESOURCE_NODE *
-RsDoVendorLargeDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset);
-
-ASL_RESOURCE_NODE *
-RsDoGeneralRegisterDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset);
-
#endif /* __ASLCOMPILER_H */
diff --git a/compiler/asldefine.h b/compiler/asldefine.h
index 75345a5d7f4b..cff4ecf410e4 100644
--- a/compiler/asldefine.h
+++ b/compiler/asldefine.h
@@ -128,7 +128,7 @@
#define CompilerId "ASL Optimizing Compiler"
#define DisassemblerId "AML Disassembler"
#define CompilerCopyright "Copyright (c) 2000 - 2010 Intel Corporation"
-#define CompilerCompliance "Supports ACPI Specification Revision 4.0"
+#define CompilerCompliance "Supports ACPI Specification Revision 4.0a"
#define CompilerName "iasl"
#define CompilerCreatorId "INTL"
diff --git a/compiler/aslfiles.c b/compiler/aslfiles.c
index ebf59a408e8b..8f498a1b9df7 100644
--- a/compiler/aslfiles.c
+++ b/compiler/aslfiles.c
@@ -236,6 +236,36 @@ FlOpenFile (
/*******************************************************************************
*
+ * FUNCTION: FlGetFileSize
+ *
+ * PARAMETERS: FileId - Index into file info array
+ *
+ * RETURN: File Size
+ *
+ * DESCRIPTION: Get current file size. Uses seek-to-EOF. File must be open.
+ *
+ ******************************************************************************/
+
+UINT32
+FlGetFileSize (
+ UINT32 FileId)
+{
+ FILE *fp;
+ UINT32 FileSize;
+
+
+ fp = Gbl_Files[FileId].Handle;
+
+ fseek (fp, 0, SEEK_END);
+ FileSize = (UINT32) ftell (fp);
+ fseek (fp, 0, SEEK_SET);
+
+ return (FileSize);
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: FlReadFile
*
* PARAMETERS: FileId - Index into file info array
diff --git a/compiler/aslglobal.h b/compiler/aslglobal.h
index 01ab931e0d0d..85bb3e2d9e6b 100644
--- a/compiler/aslglobal.h
+++ b/compiler/aslglobal.h
@@ -188,6 +188,7 @@ ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_CompileTimesFlag, FALSE
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_FoldConstants, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_VerboseErrors, TRUE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoErrors, FALSE);
+ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_NoResourceChecking, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_DisasmFlag, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_GetAllTables, FALSE);
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_IntegerOptimizationFlag, TRUE);
@@ -200,6 +201,8 @@ ASL_EXTERN UINT8 ASL_INIT_GLOBAL (Gbl_WarningLevel, ASL_WARNI
#define HEX_OUTPUT_NONE 0
#define HEX_OUTPUT_C 1
#define HEX_OUTPUT_ASM 2
+#define HEX_OUTPUT_ASL 3
+
ASL_EXTERN BOOLEAN ASL_INIT_GLOBAL (Gbl_HexOutputFlag, HEX_OUTPUT_NONE);
diff --git a/compiler/asllisting.c b/compiler/asllisting.c
index c4253c2e115f..93f83ad84279 100644
--- a/compiler/asllisting.c
+++ b/compiler/asllisting.c
@@ -198,6 +198,10 @@ static void
LsDoHexOutputAsm (
void);
+static void
+LsDoHexOutputAsl (
+ void);
+
ACPI_STATUS
LsTreeWriteWalk (
ACPI_PARSE_OBJECT *Op,
@@ -1337,6 +1341,11 @@ LsDoHexOutput (
LsDoHexOutputAsm ();
break;
+ case HEX_OUTPUT_ASL:
+
+ LsDoHexOutputAsl ();
+ break;
+
default:
/* No other output types supported */
break;
@@ -1362,60 +1371,160 @@ static void
LsDoHexOutputC (
void)
{
- UINT32 j;
- UINT8 FileByte[HEX_TABLE_LINE_SIZE];
- UINT8 Buffer[4];
+ UINT8 FileData[HEX_TABLE_LINE_SIZE];
+ UINT32 LineLength;
UINT32 Offset = 0;
+ UINT32 AmlFileSize;
+ UINT32 i;
+
+
+ /* Get AML size, seek back to start */
+ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
- FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n *\n */\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " * C source code output\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
+ AmlFileSize);
FlPrintFile (ASL_FILE_HEX_OUTPUT, "unsigned char AmlCode[] =\n{\n");
- /* Start at the beginning of the AML file */
+ while (Offset < AmlFileSize)
+ {
+ /* Read enough bytes needed for one output line */
- FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
+ LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ if (!LineLength)
+ {
+ break;
+ }
- /* Process all AML bytes in the AML file */
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
- j = 0;
- while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
- {
- if (j == 0)
+ for (i = 0; i < LineLength; i++)
{
- FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
+ /*
+ * Print each hex byte.
+ * Add a comma until the very last byte of the AML file
+ * (Some C compilers complain about a trailing comma)
+ */
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
+ if ((Offset + i + 1) < AmlFileSize)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
+ }
+ else
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
+ }
}
- /* Convert each AML byte to hex */
+ /* Add fill spaces if needed for last line */
- UtConvertByteToHex (FileByte[j], Buffer);
- FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
- FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
+ if (LineLength < HEX_TABLE_LINE_SIZE)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
+ 5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
+ }
- /* An occasional linefeed improves readability */
+ /* Emit the offset and ascii dump for the entire line */
- Offset++;
- j++;
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
+ LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
+ HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
- if (j >= HEX_TABLE_LINE_SIZE)
- {
- /* End of line, emit the ascii dump of the entire line */
+ Offset += LineLength;
+ }
- FlPrintFile (ASL_FILE_HEX_OUTPUT,
- " /* %8.8X", Offset - HEX_TABLE_LINE_SIZE);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "};\n");
+ FlCloseFile (ASL_FILE_HEX_OUTPUT);
+}
- /* Write the ASCII character associated with each of the bytes */
- LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT,
- HEX_TABLE_LINE_SIZE, FileByte);
- FlPrintFile (ASL_FILE_HEX_OUTPUT, " */\n");
+/*******************************************************************************
+ *
+ * FUNCTION: LsDoHexOutputAsl
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: None.
+ *
+ * DESCRIPTION: Create the hex output file. This is the same data as the AML
+ * output file, but formatted into hex/ascii bytes suitable for
+ * inclusion into a C source file.
+ *
+ ******************************************************************************/
- /* Start new line */
+static void
+LsDoHexOutputAsl (
+ void)
+{
+ UINT8 FileData[HEX_TABLE_LINE_SIZE];
+ UINT32 LineLength;
+ UINT32 Offset = 0;
+ UINT32 AmlFileSize;
+ UINT32 i;
- j = 0;
+
+ /* Get AML size, seek back to start */
+
+ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " * ASL source code output\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " * AML code block contains 0x%X bytes\n *\n */\n",
+ AmlFileSize);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " Name (BUF1, Buffer()\n {\n");
+
+ while (Offset < AmlFileSize)
+ {
+ /* Read enough bytes needed for one output line */
+
+ LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ if (!LineLength)
+ {
+ break;
+ }
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
+
+ for (i = 0; i < LineLength; i++)
+ {
+ /*
+ * Print each hex byte.
+ * Add a comma until the very last byte of the AML file
+ * (Some C compilers complain about a trailing comma)
+ */
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "0x%2.2X", FileData[i]);
+ if ((Offset + i + 1) < AmlFileSize)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
+ }
+ else
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
+ }
+ }
+
+ /* Add fill spaces if needed for last line */
+
+ if (LineLength < HEX_TABLE_LINE_SIZE)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
+ 5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
}
+
+ /* Emit the offset and ascii dump for the entire line */
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " /* %8.8X", Offset);
+ LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s*/\n",
+ HEX_TABLE_LINE_SIZE - LineLength + 1, " ");
+
+ Offset += LineLength;
}
- FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n};\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " })\n");
FlCloseFile (ASL_FILE_HEX_OUTPUT);
}
@@ -1438,58 +1547,64 @@ static void
LsDoHexOutputAsm (
void)
{
- UINT32 j;
- UINT8 FileByte[HEX_TABLE_LINE_SIZE];
- UINT8 Buffer[4];
+ UINT8 FileData[HEX_TABLE_LINE_SIZE];
+ UINT32 LineLength;
UINT32 Offset = 0;
- BOOLEAN DoComma = FALSE;
+ UINT32 AmlFileSize;
+ UINT32 i;
- FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n;\n");
+ /* Get AML size, seek back to start */
- /* Start at the beginning of the AML file */
+ AmlFileSize = FlGetFileSize (ASL_FILE_AML_OUTPUT);
- FlSeekFile (ASL_FILE_AML_OUTPUT, 0);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "; Assembly code source output\n");
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "; AML code block contains 0x%X bytes\n;\n",
+ AmlFileSize);
- /* Process all AML bytes in the AML file */
-
- j = 0;
- while (FlReadFile (ASL_FILE_AML_OUTPUT, &FileByte[j], 1) == AE_OK)
+ while (Offset < AmlFileSize)
{
- if (j == 0)
+ /* Read enough bytes needed for one output line */
+
+ LineLength = fread (FileData, 1, HEX_TABLE_LINE_SIZE,
+ Gbl_Files[ASL_FILE_AML_OUTPUT].Handle);
+ if (!LineLength)
{
- FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
+ break;
}
- else if (DoComma)
+
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " db ");
+
+ for (i = 0; i < LineLength; i++)
{
- FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
- DoComma = FALSE;
+ /*
+ * Print each hex byte.
+ * Add a comma until the last byte of the line
+ */
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "0%2.2Xh", FileData[i]);
+ if ((i + 1) < LineLength)
+ {
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, ",");
+ }
}
- /* Convert each AML byte to hex */
-
- UtConvertByteToAsmHex (FileByte[j], Buffer);
- FlWriteFile (ASL_FILE_HEX_OUTPUT, Buffer, 4);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ");
- /* An occasional linefeed improves readability */
+ /* Add fill spaces if needed for last line */
- Offset++;
- j++;
- if (j >= HEX_TABLE_LINE_SIZE)
+ if (LineLength < HEX_TABLE_LINE_SIZE)
{
- FlPrintFile (ASL_FILE_HEX_OUTPUT,
- " ;%8.8X", Offset - HEX_TABLE_LINE_SIZE);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "%*s",
+ 5 * (HEX_TABLE_LINE_SIZE - LineLength), " ");
+ }
- /* Write the ASCII character associated with each of the bytes */
+ /* Emit the offset and ascii dump for the entire line */
- LsDumpAscii (ASL_FILE_HEX_OUTPUT, HEX_TABLE_LINE_SIZE, FileByte);
- FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
- j = 0;
- }
- else
- {
- DoComma = TRUE;
- }
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, " ; %8.8X", Offset);
+ LsDumpAsciiInComment (ASL_FILE_HEX_OUTPUT, LineLength, FileData);
+ FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
+
+ Offset += LineLength;
}
FlPrintFile (ASL_FILE_HEX_OUTPUT, "\n");
diff --git a/compiler/aslmain.c b/compiler/aslmain.c
index 59b5880e76da..42127c096185 100644
--- a/compiler/aslmain.c
+++ b/compiler/aslmain.c
@@ -167,7 +167,7 @@ AslDoResponseFile (
#define ASL_TOKEN_SEPARATORS " \t\n"
-#define ASL_SUPPORTED_OPTIONS "@:2b:cd^e:fgh^i^I:l^o:p:r:s:t:v:w:x:"
+#define ASL_SUPPORTED_OPTIONS "@:2b:c:d^e:fgh^i^I:l^no:p:r:s:t:v:w:x:"
/*******************************************************************************
@@ -203,13 +203,14 @@ Options (
printf ("\nAML Output Files:\n");
printf (" -s<a|c> Create AML in assembler or C source file (*.asm or *.c)\n");
printf (" -i<a|c> Create assembler or C include file (*.inc or *.h)\n");
- printf (" -t<a|c> Create AML in assembler or C hex table (*.hex)\n");
+ printf (" -t<a|c|s> Create AML in assembler, C, or ASL hex table (*.hex)\n");
printf ("\nAML Code Generation:\n");
printf (" -oa Disable all optimizations (compatibility mode)\n");
printf (" -of Disable constant folding\n");
printf (" -oi Disable integer optimization to Zero/One/Ones\n");
printf (" -on Disable named reference string optimization\n");
+ printf (" -cr Disable Resource Descriptor error checking\n");
printf (" -r<Revision> Override table header Revision (1-255)\n");
printf ("\nListings:\n");
@@ -264,7 +265,7 @@ HelpMessage (
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");
- printf (" -c Parse only, no output generation\n");
+ printf (" -n Parse only, no output generation\n");
printf (" -ot Display compile times\n");
printf (" -x<level> Set debug level for trace output\n");
}
@@ -507,10 +508,16 @@ AslDoOptions (
case 'c':
+ switch (AcpiGbl_Optarg[0])
+ {
+ case 'r':
+ Gbl_NoResourceChecking = TRUE;
+ break;
- /* Parse only */
-
- Gbl_ParseOnlyFlag = TRUE;
+ default:
+ printf ("Unknown option: -c%s\n", AcpiGbl_Optarg);
+ return (-1);
+ }
break;
@@ -688,6 +695,14 @@ AslDoOptions (
break;
+ case 'n':
+
+ /* Parse only */
+
+ Gbl_ParseOnlyFlag = TRUE;
+ break;
+
+
case 'p':
/* Override default AML output filename */
@@ -741,6 +756,10 @@ AslDoOptions (
Gbl_HexOutputFlag = HEX_OUTPUT_C;
break;
+ case 's':
+ Gbl_HexOutputFlag = HEX_OUTPUT_ASL;
+ break;
+
default:
printf ("Unknown option: -t%s\n", AcpiGbl_Optarg);
return (-1);
diff --git a/compiler/aslpredef.c b/compiler/aslpredef.c
index 6346bafd10ec..ae1b77381480 100644
--- a/compiler/aslpredef.c
+++ b/compiler/aslpredef.c
@@ -243,11 +243,11 @@ ApCheckForPredefinedMethod (
break;
- case ACPI_EVENT_RESERVED_NAME: /* _Lxx, _Exx, and _Qxx methods */
+ case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
Gbl_ReservedMethods++;
- /* NumArguments must be zero for all _Lxx, _Exx, and _Qxx methods */
+ /* NumArguments must be zero for all _Lxx/_Exx/_Wxx/_Qxx methods */
if (MethodInfo->NumArguments != 0)
{
@@ -346,12 +346,12 @@ ApCheckPredefinedReturnValue (
case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
- case ACPI_EVENT_RESERVED_NAME: /* _Lxx, _Exx, and _Qxx methods */
+ case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
/* Just return, nothing to do */
return;
- default: /* a real predefined ACPI name */
+ default: /* A standard predefined ACPI name */
/* Exit if no return value expected */
@@ -425,29 +425,59 @@ ApCheckForPredefinedObject (
* or a predefined scope name
*/
Index = ApCheckForPredefinedName (Op, Name);
- if (Index > ACPI_VALID_RESERVED_NAME_MAX)
+
+ switch (Index)
{
+ case ACPI_NOT_RESERVED_NAME: /* No underscore or _Txx or _xxx name not matched */
+ case ACPI_PREDEFINED_NAME: /* Resource Name or reserved scope name */
+ case ACPI_COMPILER_RESERVED_NAME: /* A _Txx that was not emitted by compiler */
+
+ /* Nothing to do */
return;
- }
- /*
- * We found a matching predefind name.
- * Check if this predefined name requires input arguments
- */
- if (PredefinedNames[Index].Info.ParamCount > 0)
- {
+ case ACPI_EVENT_RESERVED_NAME: /* _Lxx/_Exx/_Wxx/_Qxx methods */
+
/*
- * This predefined name must always be defined as a control
- * method because it is required to have input arguments.
+ * These names must be control methods, by definition in ACPI spec.
+ * Also because they are defined to return no value. None of them
+ * require any arguments.
*/
AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
- "with arguments");
- }
+ "with zero arguments");
+ return;
- /* Typecheck the actual object, it is the next argument */
+ default: /* A standard predefined ACPI name */
- ApCheckObjectType (Op->Asl.Child->Asl.Next,
- PredefinedNames[Index].Info.ExpectedBtypes);
+ /*
+ * If this predefined name requires input arguments, then
+ * it must be implemented as a control method
+ */
+ if (PredefinedNames[Index].Info.ParamCount > 0)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
+ "with arguments");
+ return;
+ }
+
+ /*
+ * If no return value is expected from this predefined name, then
+ * it follows that it must be implemented as a control method
+ * (with zero args, because the args > 0 case was handled above)
+ * Examples are: _DIS, _INI, _IRC, _OFF, _ON, _PSx
+ */
+ if (!PredefinedNames[Index].Info.ExpectedBtypes)
+ {
+ AslError (ASL_ERROR, ASL_MSG_RESERVED_METHOD, Op,
+ "with zero arguments");
+ return;
+ }
+
+ /* Typecheck the actual object, it is the next argument */
+
+ ApCheckObjectType (Op->Asl.Child->Asl.Next,
+ PredefinedNames[Index].Info.ExpectedBtypes);
+ return;
+ }
}
@@ -514,7 +544,7 @@ ApCheckForPredefinedName (
}
}
- /* Check for _Lxx, _Exx, _Qxx, _T_x. Warning if unknown predefined name */
+ /* Check for _Lxx/_Exx/_Wxx/_Qxx/_T_x. Warning if unknown predefined name */
return (ApCheckForSpecialName (Op, Name));
}
@@ -530,7 +560,7 @@ ApCheckForPredefinedName (
* RETURN: None
*
* DESCRIPTION: Check for the "special" predefined names -
- * _Lxx, _Exx, _Qxx, and _T_x
+ * _Lxx, _Exx, _Qxx, _Wxx, and _T_x
*
******************************************************************************/
@@ -541,14 +571,16 @@ ApCheckForSpecialName (
{
/*
- * Check for the "special" predefined names. We know the first char is an
- * underscore already.
+ * Check for the "special" predefined names. We already know that the
+ * first character is an underscore.
* GPE: _Lxx
* GPE: _Exx
+ * GPE: _Wxx
* EC: _Qxx
*/
if ((Name[1] == 'L') ||
(Name[1] == 'E') ||
+ (Name[1] == 'W') ||
(Name[1] == 'Q'))
{
/* The next two characters must be hex digits */
diff --git a/compiler/aslresource.c b/compiler/aslresource.c
index 421fde3a3671..67aabcadae1b 100644
--- a/compiler/aslresource.c
+++ b/compiler/aslresource.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: aslresource - Resource templates and descriptors
+ * Module Name: aslresource - Resource template/descriptor utilities
*
*****************************************************************************/
@@ -126,6 +126,298 @@
/*******************************************************************************
*
+ * FUNCTION: RsSmallAddressCheck
+ *
+ * PARAMETERS: Minimum - Address Min value
+ * Maximum - Address Max value
+ * Length - Address range value
+ * Alignment - Address alignment value
+ * MinOp - Original Op for Address Min
+ * MaxOp - Original Op for Address Max
+ * LengthOp - Original Op for address range
+ * AlignOp - Original Op for address alignment. If
+ * NULL, means "zero value for alignment is
+ * OK, and means 64K alignment" (for
+ * Memory24 descriptor)
+ *
+ * RETURN: None. Adds error messages to error log if necessary
+ *
+ * DESCRIPTION: Perform common value checks for "small" address descriptors.
+ * Currently:
+ * Io, Memory24, Memory32
+ *
+ ******************************************************************************/
+
+void
+RsSmallAddressCheck (
+ UINT8 Type,
+ UINT32 Minimum,
+ UINT32 Maximum,
+ UINT32 Length,
+ UINT32 Alignment,
+ ACPI_PARSE_OBJECT *MinOp,
+ ACPI_PARSE_OBJECT *MaxOp,
+ ACPI_PARSE_OBJECT *LengthOp,
+ ACPI_PARSE_OBJECT *AlignOp)
+{
+
+ if (Gbl_NoResourceChecking)
+ {
+ return;
+ }
+
+ /* Special case for Memory24, values are compressed */
+
+ if (Type == ACPI_RESOURCE_NAME_MEMORY24)
+ {
+ if (!Alignment) /* Alignment==0 means 64K - no invalid alignment */
+ {
+ Alignment = ACPI_UINT16_MAX + 1;
+ }
+
+ Minimum <<= 8;
+ Maximum <<= 8;
+ Length *= 256;
+ }
+
+ /* IO descriptor has different definition of min/max, don't check */
+
+ if (Type != ACPI_RESOURCE_NAME_IO)
+ {
+ /* Basic checks on Min/Max/Length */
+
+ if (Minimum > Maximum)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL);
+ }
+ else if (Length > (Maximum - Minimum + 1))
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL);
+ }
+ }
+
+ /* Alignment of zero is not in ACPI spec, but is used to mean byte acc */
+
+ if (!Alignment)
+ {
+ Alignment = 1;
+ }
+
+ /* Addresses must be an exact multiple of the alignment value */
+
+ if (Minimum % Alignment)
+ {
+ AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL);
+ }
+ if (Maximum % Alignment)
+ {
+ AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, NULL);
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsLargeAddressCheck
+ *
+ * PARAMETERS: Minimum - Address Min value
+ * Maximum - Address Max value
+ * Length - Address range value
+ * Granularity - Address granularity value
+ * Flags - General flags for address descriptors:
+ * _MIF, _MAF, _DEC
+ * MinOp - Original Op for Address Min
+ * MaxOp - Original Op for Address Max
+ * LengthOp - Original Op for address range
+ * GranOp - Original Op for address granularity
+ *
+ * RETURN: None. Adds error messages to error log if necessary
+ *
+ * DESCRIPTION: Perform common value checks for "large" address descriptors.
+ * Currently:
+ * WordIo, WordBusNumber, WordSpace
+ * DWordIo, DWordMemory, DWordSpace
+ * QWordIo, QWordMemory, QWordSpace
+ * ExtendedIo, ExtendedMemory, ExtendedSpace
+ *
+ * _MIF flag set means that the minimum address is fixed and is not relocatable
+ * _MAF flag set means that the maximum address is fixed and is not relocatable
+ * Length of zero means that the record size is variable
+ *
+ * This function implements the LEN/MIF/MAF/MIN/MAX/GRA rules within Table 6-40
+ * of the ACPI 4.0a specification. Added 04/2010.
+ *
+ ******************************************************************************/
+
+void
+RsLargeAddressCheck (
+ UINT64 Minimum,
+ UINT64 Maximum,
+ UINT64 Length,
+ UINT64 Granularity,
+ UINT8 Flags,
+ ACPI_PARSE_OBJECT *MinOp,
+ ACPI_PARSE_OBJECT *MaxOp,
+ ACPI_PARSE_OBJECT *LengthOp,
+ ACPI_PARSE_OBJECT *GranOp)
+{
+
+ if (Gbl_NoResourceChecking)
+ {
+ return;
+ }
+
+ /* Basic checks on Min/Max/Length */
+
+ if (Minimum > Maximum)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_MIN_MAX, MinOp, NULL);
+ return;
+ }
+ else if (Length > (Maximum - Minimum + 1))
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH, LengthOp, NULL);
+ return;
+ }
+
+ /* If specified (non-zero), ensure granularity is a power-of-two minus one */
+
+ if (Granularity)
+ {
+ if ((Granularity + 1) &
+ Granularity)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_GRANULARITY, GranOp, NULL);
+ return;
+ }
+ }
+
+ /*
+ * Check the various combinations of Length, MinFixed, and MaxFixed
+ */
+ if (Length)
+ {
+ /* Fixed non-zero length */
+
+ switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF))
+ {
+ case 0:
+ /*
+ * Fixed length, variable locations (both _MIN and _MAX).
+ * Length must be a multiple of granularity
+ */
+ if (Granularity & Length)
+ {
+ AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, LengthOp, NULL);
+ }
+ break;
+
+ case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF):
+
+ /* Fixed length, fixed location. Granularity must be zero */
+
+ if (Granularity != 0)
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_GRAN_FIXED, GranOp, NULL);
+ }
+
+ /* Length must be exactly the size of the min/max window */
+
+ if (Length != (Maximum - Minimum + 1))
+ {
+ AslError (ASL_ERROR, ASL_MSG_INVALID_LENGTH_FIXED, LengthOp, NULL);
+ }
+ break;
+
+ /* All other combinations are invalid */
+
+ case ACPI_RESOURCE_FLAG_MIF:
+ case ACPI_RESOURCE_FLAG_MAF:
+ default:
+ AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL);
+ }
+ }
+ else
+ {
+ /* Variable length (length==0) */
+
+ switch (Flags & (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF))
+ {
+ case 0:
+ /*
+ * Both _MIN and _MAX are variable.
+ * No additional requirements, just exit
+ */
+ break;
+
+ case ACPI_RESOURCE_FLAG_MIF:
+
+ /* _MIN is fixed. _MIN must be multiple of _GRA */
+
+ /*
+ * The granularity is defined by the ACPI specification to be a
+ * power-of-two minus one, therefore the granularity is a
+ * bitmask which can be used to easily validate the addresses.
+ */
+ if (Granularity & Minimum)
+ {
+ AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MinOp, NULL);
+ }
+ break;
+
+ case ACPI_RESOURCE_FLAG_MAF:
+
+ /* _MAX is fixed. (_MAX + 1) must be multiple of _GRA */
+
+ if (Granularity & (Maximum + 1))
+ {
+ AslError (ASL_ERROR, ASL_MSG_ALIGNMENT, MaxOp, "-1");
+ }
+ break;
+
+ /* Both MIF/MAF set is invalid if length is zero */
+
+ case (ACPI_RESOURCE_FLAG_MIF | ACPI_RESOURCE_FLAG_MAF):
+ default:
+ AslError (ASL_ERROR, ASL_MSG_INVALID_ADDR_FLAGS, LengthOp, NULL);
+ }
+ }
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsGetStringDataLength
+ *
+ * PARAMETERS: InitializerOp - Start of a subtree of init nodes
+ *
+ * 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.
+ *
+ ******************************************************************************/
+
+UINT16
+RsGetStringDataLength (
+ ACPI_PARSE_OBJECT *InitializerOp)
+{
+
+ while (InitializerOp)
+ {
+ if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
+ {
+ return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1));
+ }
+ InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
+ }
+
+ return 0;
+}
+
+
+/*******************************************************************************
+ *
* FUNCTION: RsAllocateResourceNode
*
* PARAMETERS: Size - Size of node in bytes
diff --git a/compiler/aslrestype1.c b/compiler/aslrestype1.c
index 1dbff0310fd8..381fb53cc25b 100644
--- a/compiler/aslrestype1.c
+++ b/compiler/aslrestype1.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: aslrestype1 - Short (type1) resource templates and descriptors
+ * Module Name: aslrestype1 - Miscellaneous small resource descriptors
*
*****************************************************************************/
@@ -121,6 +121,18 @@
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslrestype1")
+/*
+ * This module contains miscellaneous small resource descriptors:
+ *
+ * EndTag
+ * EndDependentFn
+ * Memory24
+ * Memory32
+ * Memory32Fixed
+ * StartDependentFn
+ * StartDependentFnNoPri
+ * VendorShort
+ */
/*******************************************************************************
*
@@ -158,127 +170,6 @@ RsDoEndTagDescriptor (
/*******************************************************************************
*
- * FUNCTION: RsDoDmaDescriptor
- *
- * 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 "DMA" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoDmaDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset)
-{
- 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 (AML_RESOURCE_DMA));
-
- Descriptor = Rnode->Buffer;
- Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
- ASL_RDESC_DMA_SIZE;
-
- /* Process all child initialization nodes */
-
- for (i = 0; InitializerOp; i++)
- {
- switch (i)
- {
- case 0: /* DMA type */
-
- RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
- 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, 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, ACPI_RESTAG_XFERTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
- break;
-
- case 3: /* Name */
-
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- default:
-
- /* All DMA channel bytes are handled here, after flags and name */
-
- if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
- {
- /* 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 */
- {
- /* 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;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- /* Now we can set the channel mask */
-
- Descriptor->Dma.DmaChannelMask = DmaChannelMask;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: RsDoEndDependentDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
@@ -311,396 +202,6 @@ RsDoEndDependentDescriptor (
/*******************************************************************************
*
- * FUNCTION: RsDoFixedIoDescriptor
- *
- * 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 "FixedIO" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoFixedIoDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset)
-{
- AML_RESOURCE *Descriptor;
- ACPI_PARSE_OBJECT *InitializerOp;
- ASL_RESOURCE_NODE *Rnode;
- UINT32 i;
-
-
- InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
-
- Descriptor = Rnode->Buffer;
- Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
- ASL_RDESC_FIXED_IO_SIZE;
-
- /* Process all child initialization nodes */
-
- for (i = 0; InitializerOp; i++)
- {
- switch (i)
- {
- case 0: /* Base Address */
-
- Descriptor->FixedIo.Address =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
- CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
- break;
-
- case 1: /* Length */
-
- Descriptor->FixedIo.AddressLength =
- (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
- break;
-
- case 2: /* Name */
-
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- default:
-
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
- break;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoIoDescriptor
- *
- * 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 "IO" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoIoDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset)
-{
- AML_RESOURCE *Descriptor;
- ACPI_PARSE_OBJECT *InitializerOp;
- ASL_RESOURCE_NODE *Rnode;
- UINT32 i;
-
-
- InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
-
- Descriptor = Rnode->Buffer;
- Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
- ASL_RDESC_IO_SIZE;
-
- /* Process all child initialization nodes */
-
- for (i = 0; InitializerOp; i++)
- {
- switch (i)
- {
- case 0: /* Decode size */
-
- 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->Io.Minimum =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
- break;
-
- case 2: /* Max Address */
-
- Descriptor->Io.Maximum =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
- break;
-
- case 3: /* 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->Io.AddressLength =
- (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
- break;
-
- case 5: /* Name */
-
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- default:
-
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
- break;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoIrqDescriptor
- *
- * 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 "IRQ" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoIrqDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset)
-{
- AML_RESOURCE *Descriptor;
- ACPI_PARSE_OBJECT *InitializerOp;
- ASL_RESOURCE_NODE *Rnode;
- UINT32 Interrupts = 0;
- UINT16 IrqMask = 0;
- UINT32 i;
-
-
- InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
-
- /* Length = 3 (with flag byte) */
-
- Descriptor = Rnode->Buffer;
- Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
- (ASL_RDESC_IRQ_SIZE + 0x01);
-
- /* Process all child initialization nodes */
-
- for (i = 0; InitializerOp; i++)
- {
- switch (i)
- {
- case 0: /* Interrupt Type (or Mode - edge/level) */
-
- RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
- 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, 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, ACPI_RESTAG_INTERRUPTSHARE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
- break;
-
- case 3: /* Name */
-
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- default:
-
- /* All IRQ bytes are handled here, after the flags and name */
-
- if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
- {
- /* 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);
- }
- }
-
- /* Case 4: First IRQ value in list */
-
- if (i == 4)
- {
- /* 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;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- /* Now we can set the channel mask */
-
- Descriptor->Irq.IrqMask = IrqMask;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoIrqNoFlagsDescriptor
- *
- * 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 "IRQNoFlags" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoIrqNoFlagsDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset)
-{
- AML_RESOURCE *Descriptor;
- ACPI_PARSE_OBJECT *InitializerOp;
- ASL_RESOURCE_NODE *Rnode;
- UINT16 IrqMask = 0;
- UINT32 Interrupts = 0;
- UINT32 i;
-
-
- InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
-
- Descriptor = Rnode->Buffer;
- Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
- ASL_RDESC_IRQ_SIZE;
-
- /* Process all child initialization nodes */
-
- for (i = 0; InitializerOp; i++)
- {
- switch (i)
- {
- case 0: /* Name */
-
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- default:
-
- /* IRQ bytes are handled here, after the flags and name */
-
- if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
- {
- /* 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));
- }
- }
-
- /* Case 1: First IRQ value in list */
-
- if (i == 1)
- {
- /* 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;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- /* Now we can set the interrupt mask */
-
- Descriptor->Irq.IrqMask = IrqMask;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: RsDoMemory24Descriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
@@ -720,6 +221,10 @@ RsDoMemory24Descriptor (
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *AlignOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
@@ -749,6 +254,7 @@ RsDoMemory24Descriptor (
Descriptor->Memory24.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Minimum));
+ MinOp = InitializerOp;
break;
case 2: /* Max Address */
@@ -756,6 +262,7 @@ RsDoMemory24Descriptor (
Descriptor->Memory24.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Maximum));
+ MaxOp = InitializerOp;
break;
case 3: /* Alignment */
@@ -763,6 +270,7 @@ RsDoMemory24Descriptor (
Descriptor->Memory24.Alignment = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.Alignment));
+ AlignOp = InitializerOp;
break;
case 4: /* Length */
@@ -770,6 +278,7 @@ RsDoMemory24Descriptor (
Descriptor->Memory24.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory24.AddressLength));
+ LengthOp = InitializerOp;
break;
case 5: /* Name */
@@ -786,6 +295,15 @@ RsDoMemory24Descriptor (
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
+ /* Validate the Min/Max/Len/Align values (Alignment==0 means 64K) */
+
+ RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY24,
+ Descriptor->Memory24.Minimum,
+ Descriptor->Memory24.Maximum,
+ Descriptor->Memory24.AddressLength,
+ Descriptor->Memory24.Alignment,
+ MinOp, MaxOp, LengthOp, NULL);
+
return (Rnode);
}
@@ -811,6 +329,10 @@ RsDoMemory32Descriptor (
{
AML_RESOURCE *Descriptor;
ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *AlignOp = NULL;
ASL_RESOURCE_NODE *Rnode;
UINT32 i;
@@ -840,6 +362,7 @@ RsDoMemory32Descriptor (
Descriptor->Memory32.Minimum = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Minimum));
+ MinOp = InitializerOp;
break;
case 2: /* Max Address */
@@ -847,6 +370,7 @@ RsDoMemory32Descriptor (
Descriptor->Memory32.Maximum = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Maximum));
+ MaxOp = InitializerOp;
break;
case 3: /* Alignment */
@@ -854,6 +378,7 @@ RsDoMemory32Descriptor (
Descriptor->Memory32.Alignment = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.Alignment));
+ AlignOp = InitializerOp;
break;
case 4: /* Length */
@@ -861,6 +386,7 @@ RsDoMemory32Descriptor (
Descriptor->Memory32.AddressLength = (UINT32) InitializerOp->Asl.Value.Integer;
RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
CurrentByteOffset + ASL_RESDESC_OFFSET (Memory32.AddressLength));
+ LengthOp = InitializerOp;
break;
case 5: /* Name */
@@ -877,6 +403,15 @@ RsDoMemory32Descriptor (
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
+ /* Validate the Min/Max/Len/Align values */
+
+ RsSmallAddressCheck (ACPI_RESOURCE_NAME_MEMORY32,
+ Descriptor->Memory32.Minimum,
+ Descriptor->Memory32.Maximum,
+ Descriptor->Memory32.AddressLength,
+ Descriptor->Memory32.Alignment,
+ MinOp, MaxOp, LengthOp, AlignOp);
+
return (Rnode);
}
@@ -1027,6 +562,7 @@ RsDoStartDependentDescriptor (
break;
default:
+
NextRnode = RsDoOneResourceDescriptor (InitializerOp,
CurrentByteOffset, &State);
@@ -1036,7 +572,6 @@ RsDoStartDependentDescriptor (
* must keep track of the offset of not only each descriptor, but each
* element (field) within each descriptor as well.
*/
-
CurrentByteOffset += RsLinkDescriptorChain (&PreviousRnode,
NextRnode);
break;
@@ -1182,4 +717,3 @@ RsDoVendorSmallDescriptor (
return (Rnode);
}
-
diff --git a/compiler/aslrestype1i.c b/compiler/aslrestype1i.c
new file mode 100644
index 000000000000..239c500cb6fc
--- /dev/null
+++ b/compiler/aslrestype1i.c
@@ -0,0 +1,668 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslrestype1i - Small I/O-related resource descriptors
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslrestype1i")
+
+/*
+ * This module contains the I/O-related small resource descriptors:
+ *
+ * DMA
+ * FixedIO
+ * IO
+ * IRQ
+ * IRQNoFlags
+ */
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoDmaDescriptor
+ *
+ * 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 "DMA" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoDmaDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ 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 (AML_RESOURCE_DMA));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Dma.DescriptorType = ACPI_RESOURCE_NAME_DMA |
+ ASL_RDESC_DMA_SIZE;
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* DMA type */
+
+ RsSetFlagBits (&Descriptor->Dma.Flags, InitializerOp, 5, 0);
+ 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, 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, ACPI_RESTAG_XFERTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Dma.Flags), 0);
+ break;
+
+ case 3: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ /* All DMA channel bytes are handled here, after flags and name */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ /* 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 */
+ {
+ /* 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;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Now we can set the channel mask */
+
+ Descriptor->Dma.DmaChannelMask = DmaChannelMask;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoFixedIoDescriptor
+ *
+ * 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 "FixedIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoFixedIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *AddressOp = NULL;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_FIXED_IO));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_FIXED_IO |
+ ASL_RDESC_FIXED_IO_SIZE;
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Base Address */
+
+ Descriptor->FixedIo.Address =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_BASEADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.Address));
+ AddressOp = InitializerOp;
+ break;
+
+ case 1: /* Length */
+
+ Descriptor->FixedIo.AddressLength =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (FixedIo.AddressLength));
+ break;
+
+ case 2: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Error checks */
+
+ if (Descriptor->FixedIo.Address > 0x03FF)
+ {
+ AslError (ASL_WARNING, ASL_MSG_ISA_ADDRESS, AddressOp, NULL);
+ }
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoIoDescriptor
+ *
+ * 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 "IO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *AlignOp = NULL;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IO));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Io.DescriptorType = ACPI_RESOURCE_NAME_IO |
+ ASL_RDESC_IO_SIZE;
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Decode size */
+
+ 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->Io.Minimum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 2: /* Max Address */
+
+ Descriptor->Io.Maximum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Maximum));
+ MaxOp = InitializerOp;
+ break;
+
+ case 3: /* Alignment */
+
+ Descriptor->Io.Alignment =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ALIGNMENT,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.Alignment));
+ AlignOp = InitializerOp;
+ break;
+
+ case 4: /* Length */
+
+ Descriptor->Io.AddressLength =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Io.AddressLength));
+ LengthOp = InitializerOp;
+ break;
+
+ case 5: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Validate the Min/Max/Len/Align values */
+
+ RsSmallAddressCheck (ACPI_RESOURCE_NAME_IO,
+ Descriptor->Io.Minimum,
+ Descriptor->Io.Maximum,
+ Descriptor->Io.AddressLength,
+ Descriptor->Io.Alignment,
+ MinOp, MaxOp, LengthOp, AlignOp);
+
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoIrqDescriptor
+ *
+ * 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 "IRQ" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoIrqDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT32 Interrupts = 0;
+ UINT16 IrqMask = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ));
+
+ /* Length = 3 (with flag byte) */
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
+ (ASL_RDESC_IRQ_SIZE + 0x01);
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Interrupt Type (or Mode - edge/level) */
+
+ RsSetFlagBits (&Descriptor->Irq.Flags, InitializerOp, 0, 1);
+ 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, 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, ACPI_RESTAG_INTERRUPTSHARE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Irq.Flags), 4);
+ break;
+
+ case 3: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ /* All IRQ bytes are handled here, after the flags and name */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ /* 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);
+ }
+ }
+
+ /* Case 4: First IRQ value in list */
+
+ if (i == 4)
+ {
+ /* 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;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Now we can set the channel mask */
+
+ Descriptor->Irq.IrqMask = IrqMask;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoIrqNoFlagsDescriptor
+ *
+ * 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 "IRQNoFlags" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoIrqNoFlagsDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT16 IrqMask = 0;
+ UINT32 Interrupts = 0;
+ UINT32 i;
+
+
+ InitializerOp = Op->Asl.Child;
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_IRQ_NOFLAGS));
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Irq.DescriptorType = ACPI_RESOURCE_NAME_IRQ |
+ ASL_RDESC_IRQ_SIZE;
+
+ /* Process all child initialization nodes */
+
+ for (i = 0; InitializerOp; i++)
+ {
+ switch (i)
+ {
+ case 0: /* Name */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ /* IRQ bytes are handled here, after the flags and name */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ /* 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));
+ }
+ }
+
+ /* Case 1: First IRQ value in list */
+
+ if (i == 1)
+ {
+ /* 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;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Now we can set the interrupt mask */
+
+ Descriptor->Irq.IrqMask = IrqMask;
+ return (Rnode);
+}
diff --git a/compiler/aslrestype2.c b/compiler/aslrestype2.c
index 7ca8eeb70c8c..a9aeda73ad90 100644
--- a/compiler/aslrestype2.c
+++ b/compiler/aslrestype2.c
@@ -1,7 +1,7 @@
/******************************************************************************
*
- * Module Name: aslrestype2 - Long (type2) resource templates and descriptors
+ * Module Name: aslrestype2 - Miscellaneous Large resource descriptors
*
*****************************************************************************/
@@ -117,1145 +117,22 @@
#include "aslcompiler.h"
#include "aslcompiler.y.h"
+#include "amlcode.h"
#define _COMPONENT ACPI_COMPILER
ACPI_MODULE_NAME ("aslrestype2")
-/* Local prototypes */
-
-static UINT16
-RsGetStringDataLength (
- ACPI_PARSE_OBJECT *InitializerOp);
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsGetStringDataLength
- *
- * PARAMETERS: InitializerOp - Start of a subtree of init nodes
- *
- * 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.
- *
- ******************************************************************************/
-
-static UINT16
-RsGetStringDataLength (
- ACPI_PARSE_OBJECT *InitializerOp)
-{
-
- while (InitializerOp)
- {
- if (InitializerOp->Asl.ParseOpcode == PARSEOP_STRING_LITERAL)
- {
- return ((UINT16) (strlen (InitializerOp->Asl.Value.String) + 1));
- }
- InitializerOp = ASL_GET_PEER_NODE (InitializerOp);
- }
-
- return 0;
-}
-
-
-/*******************************************************************************
+/*
+ * This module contains miscellaneous large resource descriptors:
*
- * FUNCTION: RsDoDwordIoDescriptor
- *
- * 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 "DwordIO" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoDwordIoDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset)
-{
- AML_RESOURCE *Descriptor;
- ACPI_PARSE_OBJECT *InitializerOp;
- ASL_RESOURCE_NODE *Rnode;
- UINT16 StringLength = 0;
- UINT32 OptionIndex = 0;
- UINT8 *OptionalFields;
- 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_IO_RANGE;
-
- /*
- * 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: /* 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);
-}
-
+ * Register
+ * Interrupt
+ * VendorLong
+ */
/*******************************************************************************
*
- * 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;
-
- /*
- * 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
+ * FUNCTION: RsDoGeneralRegisterDescriptor
*
* PARAMETERS: Op - Parent resource descriptor parse node
* CurrentByteOffset - Offset into the resource template AML
@@ -1263,43 +140,27 @@ RsDoExtendedSpaceDescriptor (
*
* RETURN: Completed resource node
*
- * DESCRIPTION: Construct a long "QwordIO" descriptor
+ * DESCRIPTION: Construct a long "Register" descriptor
*
******************************************************************************/
ASL_RESOURCE_NODE *
-RsDoQwordIoDescriptor (
+RsDoGeneralRegisterDescriptor (
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);
+ Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GENERIC_REGISTER));
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));
+ Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
+ Descriptor->GenericReg.ResourceLength = 12;
/* Process all child initialization nodes */
@@ -1307,1134 +168,48 @@ RsDoQwordIoDescriptor (
{
switch (i)
{
- case 0: /* Resource Usage */
-
- RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
- break;
-
- case 1: /* MinType */
-
- 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->Address64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
- break;
-
- case 3: /* DecodeType */
-
- 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->Address64.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
- break;
-
- case 5: /* Address Granularity */
+ case 0: /* Address space */
- Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
+ Descriptor->GenericReg.AddressSpaceId = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESSSPACE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AddressSpaceId));
break;
- case 6: /* Address Min */
-
- Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
- break;
-
- case 7: /* Address Max */
-
- Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
- break;
-
- case 8: /* Translation Offset */
-
- Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
- break;
-
- case 9: /* Address Length */
-
- 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)
- {
- OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
- OptionIndex++;
- Descriptor->Address64.ResourceLength++;
- ResSourceIndex = TRUE;
- }
- break;
-
- case 11: /* ResSource [Optional Field - STRING] */
-
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
- {
- if (StringLength)
- {
- Descriptor->Address64.ResourceLength = (UINT16)
- (Descriptor->Address64.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->Address64.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4);
- break;
-
- case 14: /* Translation Type */
-
- RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
- break;
-
- default:
-
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
- break;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
- OptionIndex + StringLength;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoQwordMemoryDescriptor
- *
- * 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 "QwordMemory" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoQwordMemoryDescriptor (
- 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_MEMORY_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 Usage */
-
- RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
- break;
-
- case 1: /* DecodeType */
-
- 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->Address64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
- break;
-
- case 3: /* MaxType */
-
- 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->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->Address64.SpecificFlags, InitializerOp, 0, 1);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
- break;
-
- case 6: /* Address 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->Address64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
- break;
-
- case 8: /* Max Address */
-
- Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
- break;
-
- case 9: /* Translation Offset */
-
- Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
- break;
-
- 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)
- {
- OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
- OptionIndex++;
- Descriptor->Address64.ResourceLength++;
- ResSourceIndex = TRUE;
- }
- break;
-
- case 12: /* ResSource [Optional Field - STRING] */
-
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
- {
- if (StringLength)
- {
- Descriptor->Address64.ResourceLength = (UINT16)
- (Descriptor->Address64.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->Address64.SpecificFlags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3);
- break;
-
- case 15: /* Type */
-
- RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
- break;
-
- default:
-
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
- break;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
- OptionIndex + StringLength;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoQwordSpaceDescriptor
- *
- * 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 "QwordSpace" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoQwordSpaceDescriptor (
- 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;
-
- /*
- * 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 */
-
- Descriptor->Address64.ResourceType =
- (UINT8) InitializerOp->Asl.Value.Integer;
- break;
-
- case 1: /* Resource Usage */
-
- RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
- break;
-
- case 2: /* DecodeType */
-
- RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
- break;
-
- case 3: /* MinType */
-
- RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
- break;
-
- case 4: /* MaxType */
-
- RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
- break;
-
- case 5: /* Type-Specific flags */
-
- Descriptor->Address64.SpecificFlags =
- (UINT8) InitializerOp->Asl.Value.Integer;
- break;
-
- case 6: /* Address 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->Address64.Minimum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
- break;
-
- case 8: /* Max Address */
-
- Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
- break;
-
- case 9: /* Translation Offset */
-
- Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
- break;
-
- 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)
- {
- OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
- OptionIndex++;
- Descriptor->Address64.ResourceLength++;
- ResSourceIndex = TRUE;
- }
- break;
-
- case 12: /* ResSource [Optional Field - STRING] */
-
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
- {
- if (StringLength)
- {
- Descriptor->Address64.ResourceLength = (UINT16)
- (Descriptor->Address64.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_ADDRESS64) +
- OptionIndex + StringLength;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoWordIoDescriptor
- *
- * 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 "WordIO" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoWordIoDescriptor (
- 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_ADDRESS16) + 1 + StringLength);
-
- Descriptor = Rnode->Buffer;
- 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
- */
- 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 Usage */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
- break;
-
- case 1: /* MinType */
-
- 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->Address16.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
- break;
-
- case 3: /* DecodeType */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
- break;
-
- case 4: /* Range Type */
-
- RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0);
- break;
-
- case 5: /* Address 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 */
-
- Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
- break;
-
- case 7: /* Address Max */
-
- Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
- break;
-
- case 8: /* Translation Offset */
-
- Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
- break;
-
- case 9: /* Address Length */
-
- 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] */
-
- if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
- {
- OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
- OptionIndex++;
- Descriptor->Address16.ResourceLength++;
- ResSourceIndex = TRUE;
- }
- break;
-
- case 11: /* ResSource [Optional Field - STRING] */
-
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
- {
- if (StringLength)
- {
- Descriptor->Address16.ResourceLength = (UINT16)
- (Descriptor->Address16.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->Address16.SpecificFlags, InitializerOp, 4, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4);
- break;
-
- case 14: /* Translation Type */
-
- RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5);
- break;
-
- default:
-
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
- break;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
- OptionIndex + StringLength;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoWordBusNumberDescriptor
- *
- * 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 "WordBusNumber" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoWordBusNumberDescriptor (
- 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_ADDRESS16) + 1 + StringLength);
-
- Descriptor = Rnode->Buffer;
- 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
- */
- 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 Usage */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
- break;
-
- case 1: /* MinType */
-
- 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->Address16.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
- break;
-
- case 3: /* DecodeType */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
- break;
-
- case 4: /* Address Granularity */
-
- Descriptor->Address16.Granularity =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
- break;
-
- case 5: /* Min Address */
-
- Descriptor->Address16.Minimum =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
- break;
-
- case 6: /* Max Address */
-
- Descriptor->Address16.Maximum =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
- break;
-
- case 7: /* Translation Offset */
-
- Descriptor->Address16.TranslationOffset =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
- break;
-
- case 8: /* Address Length */
-
- Descriptor->Address16.AddressLength =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
- break;
-
- case 9: /* ResSourceIndex [Optional Field - BYTE] */
-
- if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
- {
- OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
- OptionIndex++;
- Descriptor->Address16.ResourceLength++;
- ResSourceIndex = TRUE;
- }
- break;
-
- case 10: /* ResSource [Optional Field - STRING] */
-
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
- {
- if (StringLength)
- {
- Descriptor->Address16.ResourceLength = (UINT16)
- (Descriptor->Address16.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 11: /* ResourceTag */
-
- UtAttachNamepathToOwner (Op, InitializerOp);
- break;
-
- default:
-
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
- break;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
-
- Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
- OptionIndex + StringLength;
- return (Rnode);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoWordSpaceDescriptor
- *
- * 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 "WordSpace" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoWordSpaceDescriptor (
- 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_ADDRESS16) + 1 + StringLength);
-
- Descriptor = Rnode->Buffer;
- Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
-
- /*
- * Initial descriptor length -- may be enlarged if there are
- * optional fields present
- */
- 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 */
-
- Descriptor->Address16.ResourceType =
- (UINT8) InitializerOp->Asl.Value.Integer;
- break;
-
- case 1: /* Resource Usage */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
- break;
-
- case 2: /* DecodeType */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
- break;
-
- case 3: /* MinType */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
- break;
-
- case 4: /* MaxType */
-
- RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
- RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
- break;
-
- case 5: /* Type-Specific flags */
-
- Descriptor->Address16.SpecificFlags =
- (UINT8) InitializerOp->Asl.Value.Integer;
- break;
-
- case 6: /* Address 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 */
-
- Descriptor->Address16.Minimum =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
- break;
-
- case 8: /* Max Address */
-
- 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 1: /* Register Bit Width */
- Descriptor->Address16.TranslationOffset =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
+ Descriptor->GenericReg.BitWidth = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITWIDTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitWidth));
break;
- case 10: /* Address Length */
+ case 2: /* Register Bit Offset */
- Descriptor->Address16.AddressLength =
- (UINT16) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
- CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
+ Descriptor->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset));
break;
- case 11: /* ResSourceIndex [Optional Field - BYTE] */
+ case 3: /* Register Address */
- if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
- {
- OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
- OptionIndex++;
- Descriptor->Address16.ResourceLength++;
- ResSourceIndex = TRUE;
- }
+ Descriptor->GenericReg.Address = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ADDRESS,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.Address));
break;
- case 12: /* ResSource [Optional Field - STRING] */
-
- if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
- (InitializerOp->Asl.Value.String))
- {
- if (StringLength)
- {
- Descriptor->Address16.ResourceLength = (UINT16)
- (Descriptor->Address16.ResourceLength + StringLength);
-
- strcpy ((char *)
- &OptionalFields[OptionIndex],
- InitializerOp->Asl.Value.String);
-
- /* ResourceSourceIndex must also be valid */
+ case 4: /* Access Size (ACPI 3.0) */
- if (!ResSourceIndex)
- {
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_INDEX,
- InitializerOp, NULL);
- }
- }
- }
+ Descriptor->GenericReg.AccessSize = (UINT8) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_ACCESSSIZE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.AccessSize));
-#if 0
- /*
- * Not a valid ResourceSource, ResourceSourceIndex must also
- * be invalid
- */
- else if (ResSourceIndex)
+ if (Descriptor->GenericReg.AccessSize > AML_FIELD_ACCESS_QWORD)
{
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_SOURCE,
+ AslError (ASL_ERROR, ASL_MSG_INVALID_ACCESS_SIZE,
InitializerOp, NULL);
}
-#endif
break;
- case 13: /* ResourceTag */
+ case 5: /* ResourceTag (ACPI 3.0b) */
UtAttachNamepathToOwner (Op, InitializerOp);
break;
@@ -2447,9 +222,6 @@ RsDoWordSpaceDescriptor (
InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
}
-
- Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
- OptionIndex + StringLength;
return (Rnode);
}
@@ -2760,95 +532,3 @@ RsDoVendorLargeDescriptor (
return (Rnode);
}
-
-
-/*******************************************************************************
- *
- * FUNCTION: RsDoGeneralRegisterDescriptor
- *
- * 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 "Register" descriptor
- *
- ******************************************************************************/
-
-ASL_RESOURCE_NODE *
-RsDoGeneralRegisterDescriptor (
- ACPI_PARSE_OBJECT *Op,
- UINT32 CurrentByteOffset)
-{
- AML_RESOURCE *Descriptor;
- ACPI_PARSE_OBJECT *InitializerOp;
- ASL_RESOURCE_NODE *Rnode;
- UINT32 i;
-
-
- InitializerOp = Op->Asl.Child;
- Rnode = RsAllocateResourceNode (sizeof (AML_RESOURCE_GENERIC_REGISTER));
-
- Descriptor = Rnode->Buffer;
- Descriptor->GenericReg.DescriptorType = ACPI_RESOURCE_NAME_GENERIC_REGISTER;
- Descriptor->GenericReg.ResourceLength = 12;
-
- /* Process all child initialization nodes */
-
- for (i = 0; InitializerOp; i++)
- {
- switch (i)
- {
- case 0: /* Address space */
-
- 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->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->GenericReg.BitOffset = (UINT8) InitializerOp->Asl.Value.Integer;
- RsCreateByteField (InitializerOp, ACPI_RESTAG_REGISTERBITOFFSET,
- CurrentByteOffset + ASL_RESDESC_OFFSET (GenericReg.BitOffset));
- break;
-
- case 3: /* Register 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:
-
- AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
- break;
- }
-
- InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
- }
- return (Rnode);
-}
-
-
diff --git a/compiler/aslrestype2d.c b/compiler/aslrestype2d.c
new file mode 100644
index 000000000000..7725bf9a8da7
--- /dev/null
+++ b/compiler/aslrestype2d.c
@@ -0,0 +1,814 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslrestype2d - Large DWord address resource descriptors
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslrestype2d")
+
+/*
+ * This module contains the Dword (32-bit) address space descriptors:
+ *
+ * DwordIO
+ * DwordMemory
+ * DwordSpace
+ */
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoDwordIoDescriptor
+ *
+ * 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 "DwordIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoDwordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ ASL_RESOURCE_NODE *Rnode;
+ UINT16 StringLength = 0;
+ UINT32 OptionIndex = 0;
+ UINT8 *OptionalFields;
+ 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_IO_RANGE;
+
+ /*
+ * 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: /* 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));
+ GranOp = InitializerOp;
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->Address32.Minimum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->Address32.Maximum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
+ MaxOp = InitializerOp;
+ 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));
+ LengthOp = InitializerOp;
+ 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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address32.Minimum,
+ Descriptor->Address32.Maximum,
+ Descriptor->Address32.AddressLength,
+ Descriptor->Address32.Granularity,
+ Descriptor->Address32.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ 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;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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;
+
+ /*
+ * 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));
+ GranOp = InitializerOp;
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Address32.Minimum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Address32.Maximum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
+ MaxOp = InitializerOp;
+ 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));
+ LengthOp = InitializerOp;
+ 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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address32.Minimum,
+ Descriptor->Address32.Maximum,
+ Descriptor->Address32.AddressLength,
+ Descriptor->Address32.Granularity,
+ Descriptor->Address32.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ 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;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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));
+ GranOp = InitializerOp;
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Address32.Minimum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Address32.Maximum =
+ (UINT32) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address32.Maximum));
+ MaxOp = InitializerOp;
+ 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));
+ LengthOp = InitializerOp;
+ 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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address32.Minimum,
+ Descriptor->Address32.Maximum,
+ Descriptor->Address32.AddressLength,
+ Descriptor->Address32.Granularity,
+ Descriptor->Address32.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS32) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
diff --git a/compiler/aslrestype2e.c b/compiler/aslrestype2e.c
new file mode 100644
index 000000000000..46f56cec1360
--- /dev/null
+++ b/compiler/aslrestype2e.c
@@ -0,0 +1,646 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslrestype2e - Large Extended address resource descriptors
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslrestype2e")
+
+/*
+ * This module contains the Extended (64-bit) address space descriptors:
+ *
+ * ExtendedIO
+ * ExtendedMemory
+ * ExtendedSpace
+ */
+
+/*******************************************************************************
+ *
+ * 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;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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));
+ GranOp = InitializerOp;
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
+ MaxOp = InitializerOp;
+ 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));
+ LengthOp = InitializerOp;
+ 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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->ExtAddress64.Minimum,
+ Descriptor->ExtAddress64.Maximum,
+ Descriptor->ExtAddress64.AddressLength,
+ Descriptor->ExtAddress64.Granularity,
+ Descriptor->ExtAddress64.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ 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;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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));
+ GranOp = InitializerOp;
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
+ MaxOp = InitializerOp;
+ 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));
+ LengthOp = InitializerOp;
+ 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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->ExtAddress64.Minimum,
+ Descriptor->ExtAddress64.Maximum,
+ Descriptor->ExtAddress64.AddressLength,
+ Descriptor->ExtAddress64.Granularity,
+ Descriptor->ExtAddress64.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ 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;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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));
+ GranOp = InitializerOp;
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->ExtAddress64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->ExtAddress64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (ExtAddress64.Maximum));
+ MaxOp = InitializerOp;
+ 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));
+ LengthOp = InitializerOp;
+ 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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->ExtAddress64.Minimum,
+ Descriptor->ExtAddress64.Maximum,
+ Descriptor->ExtAddress64.AddressLength,
+ Descriptor->ExtAddress64.Granularity,
+ Descriptor->ExtAddress64.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_EXTENDED_ADDRESS64) + StringLength;
+ return (Rnode);
+}
diff --git a/compiler/aslrestype2q.c b/compiler/aslrestype2q.c
new file mode 100644
index 000000000000..591ac25c42b9
--- /dev/null
+++ b/compiler/aslrestype2q.c
@@ -0,0 +1,793 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslrestype2q - Large QWord address resource descriptors
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslrestype2q")
+
+/*
+ * This module contains the QWord (64-bit) address space descriptors:
+ *
+ * QWordIO
+ * QWordMemory
+ * QWordSpace
+ */
+
+/*******************************************************************************
+ *
+ * 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;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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 Usage */
+
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ 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->Address64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ 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->Address64.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
+ break;
+
+ case 5: /* Address Granularity */
+
+ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
+ GranOp = InitializerOp;
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
+ MaxOp = InitializerOp;
+ break;
+
+ case 8: /* Translation Offset */
+
+ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
+ break;
+
+ case 9: /* Address Length */
+
+ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
+ LengthOp = InitializerOp;
+ break;
+
+ case 10: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address64.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 11: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (Descriptor->Address64.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->Address64.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 4);
+ break;
+
+ case 14: /* Translation Type */
+
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address64.Minimum,
+ Descriptor->Address64.Maximum,
+ Descriptor->Address64.AddressLength,
+ Descriptor->Address64.Granularity,
+ Descriptor->Address64.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoQwordMemoryDescriptor
+ *
+ * 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 "QwordMemory" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoQwordMemoryDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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_MEMORY_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 Usage */
+
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* DecodeType */
+
+ 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->Address64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
+ break;
+
+ case 3: /* MaxType */
+
+ 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->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->Address64.SpecificFlags, InitializerOp, 0, 1);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_READWRITETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 0);
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
+ GranOp = InitializerOp;
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
+ MaxOp = InitializerOp;
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
+ LengthOp = InitializerOp;
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address64.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 12: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (Descriptor->Address64.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->Address64.SpecificFlags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MEMATTRIBUTES,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 3);
+ break;
+
+ case 15: /* Type */
+
+ RsSetFlagBits (&Descriptor->Address64.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address64.Minimum,
+ Descriptor->Address64.Maximum,
+ Descriptor->Address64.AddressLength,
+ Descriptor->Address64.Granularity,
+ Descriptor->Address64.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoQwordSpaceDescriptor
+ *
+ * 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 "QwordSpace" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoQwordSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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;
+
+ /*
+ * 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 */
+
+ Descriptor->Address64.ResourceType =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 1: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 2: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 1);
+ break;
+
+ case 3: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 2);
+ break;
+
+ case 4: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Address64.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Flags), 3);
+ break;
+
+ case 5: /* Type-Specific flags */
+
+ Descriptor->Address64.SpecificFlags =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->Address64.Granularity = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Granularity));
+ GranOp = InitializerOp;
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Address64.Minimum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Address64.Maximum = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.Maximum));
+ MaxOp = InitializerOp;
+ break;
+
+ case 9: /* Translation Offset */
+
+ Descriptor->Address64.TranslationOffset = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.TranslationOffset));
+ break;
+
+ case 10: /* Address Length */
+
+ Descriptor->Address64.AddressLength = InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address64.AddressLength));
+ LengthOp = InitializerOp;
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address64.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 12: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address64.ResourceLength = (UINT16)
+ (Descriptor->Address64.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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address64.Minimum,
+ Descriptor->Address64.Maximum,
+ Descriptor->Address64.AddressLength,
+ Descriptor->Address64.Granularity,
+ Descriptor->Address64.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS64) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
diff --git a/compiler/aslrestype2w.c b/compiler/aslrestype2w.c
new file mode 100644
index 000000000000..45f1858fccfb
--- /dev/null
+++ b/compiler/aslrestype2w.c
@@ -0,0 +1,774 @@
+
+/******************************************************************************
+ *
+ * Module Name: aslrestype2w - Large Word address resource descriptors
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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 "aslcompiler.h"
+#include "aslcompiler.y.h"
+
+#define _COMPONENT ACPI_COMPILER
+ ACPI_MODULE_NAME ("aslrestype2w")
+
+/*
+ * This module contains the Word (16-bit) address space descriptors:
+ *
+ * WordIO
+ * WordMemory
+ * WordSpace
+ */
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoWordIoDescriptor
+ *
+ * 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 "WordIO" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoWordIoDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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_ADDRESS16) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ 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
+ */
+ 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 Usage */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ 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->Address16.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
+ break;
+
+ case 4: /* Range Type */
+
+ RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 0, 3);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_RANGETYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 0);
+ break;
+
+ case 5: /* Address Granularity */
+
+ Descriptor->Address16.Granularity = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
+ GranOp = InitializerOp;
+ break;
+
+ case 6: /* Address Min */
+
+ Descriptor->Address16.Minimum = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 7: /* Address Max */
+
+ Descriptor->Address16.Maximum = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
+ MaxOp = InitializerOp;
+ break;
+
+ case 8: /* Translation Offset */
+
+ Descriptor->Address16.TranslationOffset = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
+ break;
+
+ case 9: /* Address Length */
+
+ Descriptor->Address16.AddressLength = (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
+ LengthOp = InitializerOp;
+ break;
+
+ case 10: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address16.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 11: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (Descriptor->Address16.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->Address16.SpecificFlags, InitializerOp, 4, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 4);
+ break;
+
+ case 14: /* Translation Type */
+
+ RsSetFlagBits (&Descriptor->Address16.SpecificFlags, InitializerOp, 5, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_TRANSTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.SpecificFlags), 5);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address16.Minimum,
+ Descriptor->Address16.Maximum,
+ Descriptor->Address16.AddressLength,
+ Descriptor->Address16.Granularity,
+ Descriptor->Address16.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoWordBusNumberDescriptor
+ *
+ * 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 "WordBusNumber" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoWordBusNumberDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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_ADDRESS16) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ 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
+ */
+ 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 Usage */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 1: /* MinType */
+
+ 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->Address16.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
+ break;
+
+ case 3: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
+ break;
+
+ case 4: /* Address Granularity */
+
+ Descriptor->Address16.Granularity =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
+ GranOp = InitializerOp;
+ break;
+
+ case 5: /* Min Address */
+
+ Descriptor->Address16.Minimum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 6: /* Max Address */
+
+ Descriptor->Address16.Maximum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
+ MaxOp = InitializerOp;
+ break;
+
+ case 7: /* Translation Offset */
+
+ Descriptor->Address16.TranslationOffset =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_TRANSLATION,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.TranslationOffset));
+ break;
+
+ case 8: /* Address Length */
+
+ Descriptor->Address16.AddressLength =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_LENGTH,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.AddressLength));
+ LengthOp = InitializerOp;
+ break;
+
+ case 9: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address16.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 10: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (Descriptor->Address16.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 11: /* ResourceTag */
+
+ UtAttachNamepathToOwner (Op, InitializerOp);
+ break;
+
+ default:
+
+ AslError (ASL_ERROR, ASL_MSG_RESOURCE_LIST, InitializerOp, NULL);
+ break;
+ }
+
+ InitializerOp = RsCompleteNodeAndGetNext (InitializerOp);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address16.Minimum,
+ Descriptor->Address16.Maximum,
+ Descriptor->Address16.AddressLength,
+ Descriptor->Address16.Granularity,
+ Descriptor->Address16.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: RsDoWordSpaceDescriptor
+ *
+ * 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 "WordSpace" descriptor
+ *
+ ******************************************************************************/
+
+ASL_RESOURCE_NODE *
+RsDoWordSpaceDescriptor (
+ ACPI_PARSE_OBJECT *Op,
+ UINT32 CurrentByteOffset)
+{
+ AML_RESOURCE *Descriptor;
+ ACPI_PARSE_OBJECT *InitializerOp;
+ ACPI_PARSE_OBJECT *MinOp = NULL;
+ ACPI_PARSE_OBJECT *MaxOp = NULL;
+ ACPI_PARSE_OBJECT *LengthOp = NULL;
+ ACPI_PARSE_OBJECT *GranOp = NULL;
+ 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_ADDRESS16) + 1 + StringLength);
+
+ Descriptor = Rnode->Buffer;
+ Descriptor->Address16.DescriptorType = ACPI_RESOURCE_NAME_ADDRESS16;
+
+ /*
+ * Initial descriptor length -- may be enlarged if there are
+ * optional fields present
+ */
+ 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 */
+
+ Descriptor->Address16.ResourceType =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 1: /* Resource Usage */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 0, 1);
+ break;
+
+ case 2: /* DecodeType */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 1, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_DECODE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 1);
+ break;
+
+ case 3: /* MinType */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 2, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MINTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 2);
+ break;
+
+ case 4: /* MaxType */
+
+ RsSetFlagBits (&Descriptor->Address16.Flags, InitializerOp, 3, 0);
+ RsCreateBitField (InitializerOp, ACPI_RESTAG_MAXTYPE,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Flags), 3);
+ break;
+
+ case 5: /* Type-Specific flags */
+
+ Descriptor->Address16.SpecificFlags =
+ (UINT8) InitializerOp->Asl.Value.Integer;
+ break;
+
+ case 6: /* Address Granularity */
+
+ Descriptor->Address16.Granularity =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_GRANULARITY,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Granularity));
+ GranOp = InitializerOp;
+ break;
+
+ case 7: /* Min Address */
+
+ Descriptor->Address16.Minimum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MINADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Minimum));
+ MinOp = InitializerOp;
+ break;
+
+ case 8: /* Max Address */
+
+ Descriptor->Address16.Maximum =
+ (UINT16) InitializerOp->Asl.Value.Integer;
+ RsCreateByteField (InitializerOp, ACPI_RESTAG_MAXADDR,
+ CurrentByteOffset + ASL_RESDESC_OFFSET (Address16.Maximum));
+ MaxOp = InitializerOp;
+ break;
+
+ 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));
+ LengthOp = InitializerOp;
+ break;
+
+ case 11: /* ResSourceIndex [Optional Field - BYTE] */
+
+ if (InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG)
+ {
+ OptionalFields[0] = (UINT8) InitializerOp->Asl.Value.Integer;
+ OptionIndex++;
+ Descriptor->Address16.ResourceLength++;
+ ResSourceIndex = TRUE;
+ }
+ break;
+
+ case 12: /* ResSource [Optional Field - STRING] */
+
+ if ((InitializerOp->Asl.ParseOpcode != PARSEOP_DEFAULT_ARG) &&
+ (InitializerOp->Asl.Value.String))
+ {
+ if (StringLength)
+ {
+ Descriptor->Address16.ResourceLength = (UINT16)
+ (Descriptor->Address16.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);
+ }
+
+ /* Validate the Min/Max/Len/Gran values */
+
+ RsLargeAddressCheck (
+ Descriptor->Address16.Minimum,
+ Descriptor->Address16.Maximum,
+ Descriptor->Address16.AddressLength,
+ Descriptor->Address16.Granularity,
+ Descriptor->Address16.Flags,
+ MinOp, MaxOp, LengthOp, GranOp);
+
+ Rnode->BufferLength = sizeof (AML_RESOURCE_ADDRESS16) +
+ OptionIndex + StringLength;
+ return (Rnode);
+}
diff --git a/compiler/asltypes.h b/compiler/asltypes.h
index 30b8fdfe7d04..815763499d51 100644
--- a/compiler/asltypes.h
+++ b/compiler/asltypes.h
@@ -420,7 +420,16 @@ typedef enum
ASL_MSG_SERIALIZED,
ASL_MSG_COMPILER_RESERVED,
ASL_MSG_NAMED_OBJECT_IN_WHILE,
- ASL_MSG_LOCAL_OUTSIDE_METHOD
+ ASL_MSG_LOCAL_OUTSIDE_METHOD,
+ ASL_MSG_ALIGNMENT,
+ ASL_MSG_ISA_ADDRESS,
+ ASL_MSG_INVALID_MIN_MAX,
+ ASL_MSG_INVALID_LENGTH,
+ ASL_MSG_INVALID_LENGTH_FIXED,
+ ASL_MSG_INVALID_GRANULARITY,
+ ASL_MSG_INVALID_GRAN_FIXED,
+ ASL_MSG_INVALID_ACCESS_SIZE,
+ ASL_MSG_INVALID_ADDR_FLAGS
} ASL_MESSAGE_IDS;
@@ -540,7 +549,16 @@ char *AslMessages [] = {
/* ASL_MSG_SERIALIZED */ "Control Method marked Serialized",
/* ASL_MSG_COMPILER_RESERVED */ "Use of compiler reserved name",
/* ASL_MSG_NAMED_OBJECT_IN_WHILE */ "Creating a named object in a While loop",
-/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method"
+/* ASL_MSG_LOCAL_OUTSIDE_METHOD */ "Local or Arg used outside a control method",
+/* ASL_MSG_ALIGNMENT */ "Must be a multiple of alignment/granularity value",
+/* ASL_MSG_ISA_ADDRESS */ "Maximum 10-bit ISA address (0x3FF)",
+/* ASL_MSG_INVALID_MIN_MAX */ "Address Min is greater than Address Max",
+/* ASL_MSG_INVALID_LENGTH */ "Length is larger than Min/Max window",
+/* ASL_MSG_INVALID_LENGTH_FIXED */ "Length is not equal to fixed Min/Max window",
+/* ASL_MSG_INVALID_GRANULARITY */ "Granularity must be zero or a power of two minus one",
+/* ASL_MSG_INVALID_GRAN_FIXED */ "Granularity must be zero for fixed Min/Max",
+/* ASL_MSG_INVALID_ACCESS_SIZE */ "Invalid AccessSize (Maximum is 4 - QWord access)",
+/* ASL_MSG_INVALID_ADDR_FLAGS */ "Invalid combination of Length and Min/Max fixed flags"
};
diff --git a/debugger/dbcmds.c b/debugger/dbcmds.c
index 50a8b2e037e3..f8c6496a7dfa 100644
--- a/debugger/dbcmds.c
+++ b/debugger/dbcmds.c
@@ -675,7 +675,7 @@ AcpiDbDisplayTableInfo (
/* Walk the entire root table list */
- for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
+ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
TableDesc = &AcpiGbl_RootTableList.Tables[i];
AcpiOsPrintf ("%d ", i);
diff --git a/debugger/dbdisply.c b/debugger/dbdisply.c
index ec4715bddf69..a610d802c8d7 100644
--- a/debugger/dbdisply.c
+++ b/debugger/dbdisply.c
@@ -816,6 +816,7 @@ AcpiDbDisplayGpes (
ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
ACPI_GPE_REGISTER_INFO *GpeRegisterInfo;
+ char *GpeType;
UINT32 GpeIndex;
UINT32 Block = 0;
UINT32 i;
@@ -844,8 +845,17 @@ AcpiDbDisplayGpes (
AcpiOsPrintf ("Could not convert name to pathname\n");
}
- AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s]\n",
- Block, GpeBlock, GpeBlock->Node, Buffer);
+ if (GpeBlock->Node == AcpiGbl_FadtGpeDevice)
+ {
+ GpeType = "FADT-defined GPE block";
+ }
+ else
+ {
+ GpeType = "GPE Block Device";
+ }
+
+ AcpiOsPrintf ("\nBlock %d - Info %p DeviceNode %p [%s] - %s\n",
+ Block, GpeBlock, GpeBlock->Node, Buffer, GpeType);
AcpiOsPrintf (" Registers: %u (%u GPEs)\n",
GpeBlock->RegisterCount, GpeBlock->GpeCount);
diff --git a/events/evgpe.c b/events/evgpe.c
index d3569b188400..604f23d6c20f 100644
--- a/events/evgpe.c
+++ b/events/evgpe.c
@@ -370,7 +370,7 @@ AcpiEvGetGpeEventInfo (
ACPI_FUNCTION_ENTRY ();
- /* A NULL GpeBlock means use the FADT-defined GPE block(s) */
+ /* A NULL GpeDevice means use the FADT-defined GPE block(s) */
if (!GpeDevice)
{
diff --git a/events/evgpeblk.c b/events/evgpeblk.c
index b109673ba8ee..721411703e85 100644
--- a/events/evgpeblk.c
+++ b/events/evgpeblk.c
@@ -124,28 +124,6 @@
/* Local prototypes */
static ACPI_STATUS
-AcpiEvMatchGpeMethod (
- 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);
@@ -157,581 +135,6 @@ AcpiEvCreateGpeInfoBlocks (
/*******************************************************************************
*
- * FUNCTION: AcpiEvValidGpeEvent
- *
- * PARAMETERS: GpeEventInfo - Info for this GPE
- *
- * RETURN: TRUE if the GpeEvent is valid
- *
- * 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.
- *
- ******************************************************************************/
-
-BOOLEAN
-AcpiEvValidGpeEvent (
- ACPI_GPE_EVENT_INFO *GpeEventInfo)
-{
- ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
- ACPI_GPE_BLOCK_INFO *GpeBlock;
-
-
- ACPI_FUNCTION_ENTRY ();
-
-
- /* No need for spin lock since we are not changing any list elements */
-
- /* Walk the GPE interrupt levels */
-
- GpeXruptBlock = AcpiGbl_GpeXruptListHead;
- while (GpeXruptBlock)
- {
- GpeBlock = GpeXruptBlock->GpeBlockListHead;
-
- /* Walk the GPE blocks on this interrupt level */
-
- while (GpeBlock)
- {
- if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
- (&GpeBlock->EventInfo[GpeBlock->GpeCount] > GpeEventInfo))
- {
- return (TRUE);
- }
-
- GpeBlock = GpeBlock->Next;
- }
-
- GpeXruptBlock = GpeXruptBlock->Next;
- }
-
- return (FALSE);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvWalkGpeList
- *
- * PARAMETERS: GpeWalkCallback - Routine called for each GPE block
- * Context - Value passed to callback
- *
- * RETURN: Status
- *
- * DESCRIPTION: Walk the GPE lists.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEvWalkGpeList (
- ACPI_GPE_CALLBACK GpeWalkCallback,
- void *Context)
-{
- ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
- ACPI_STATUS Status = AE_OK;
- ACPI_CPU_FLAGS Flags;
-
-
- ACPI_FUNCTION_TRACE (EvWalkGpeList);
-
-
- Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
-
- /* Walk the interrupt level descriptor list */
-
- GpeXruptInfo = AcpiGbl_GpeXruptListHead;
- while (GpeXruptInfo)
- {
- /* Walk all Gpe Blocks attached to this interrupt level */
-
- GpeBlock = GpeXruptInfo->GpeBlockListHead;
- while (GpeBlock)
- {
- /* One callback per GPE block */
-
- Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
- if (ACPI_FAILURE (Status))
- {
- if (Status == AE_CTRL_END) /* Callback abort */
- {
- Status = AE_OK;
- }
- goto UnlockAndExit;
- }
-
- GpeBlock = GpeBlock->Next;
- }
-
- GpeXruptInfo = GpeXruptInfo->Next;
- }
-
-UnlockAndExit:
- AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
- return_ACPI_STATUS (Status);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvDeleteGpeHandlers
- *
- * PARAMETERS: GpeXruptInfo - GPE Interrupt info
- * GpeBlock - Gpe Block info
- *
- * RETURN: Status
- *
- * DESCRIPTION: Delete all Handler objects found in the GPE data structs.
- * Used only prior to termination.
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEvDeleteGpeHandlers (
- ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
- ACPI_GPE_BLOCK_INFO *GpeBlock,
- void *Context)
-{
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
- UINT32 i;
- UINT32 j;
-
-
- ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
-
-
- /* Examine each GPE Register within the block */
-
- for (i = 0; i < GpeBlock->RegisterCount; i++)
- {
- /* Now look at the individual GPEs in this byte register */
-
- for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
- {
- GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
- ACPI_GPE_REGISTER_WIDTH) + j];
-
- if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
- ACPI_GPE_DISPATCH_HANDLER)
- {
- ACPI_FREE (GpeEventInfo->Dispatch.Handler);
- GpeEventInfo->Dispatch.Handler = NULL;
- GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
- }
- }
- }
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvMatchGpeMethod
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * RETURN: Status
- *
- * 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
- *
- * The name of each GPE control method is of the form:
- * "_Lxx" or "_Exx", where:
- * L - means that the GPE is level triggered
- * E - means that the GPE is edge triggered
- * xx - is the GPE number [in HEX]
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiEvMatchGpeMethod (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *ObjDesc,
- void **ReturnValue)
-{
- ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
- ACPI_GPE_BLOCK_INFO *GpeBlock = (void *) ObjDesc;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
- UINT32 GpeNumber;
- char Name[ACPI_NAME_SIZE + 1];
- UINT8 Type;
-
-
- ACPI_FUNCTION_TRACE (EvMatchGpeMethod);
-
-
- /*
- * Match and decode the _Lxx and _Exx GPE method names
- *
- * 1) Extract the method name and null terminate it
- */
- ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer);
- Name[ACPI_NAME_SIZE] = 0;
-
- /* 2) Name must begin with an underscore */
-
- if (Name[0] != '_')
- {
- return_ACPI_STATUS (AE_OK); /* Ignore this method */
- }
-
- /*
- * 3) Edge/Level determination is based on the 2nd character
- * of the method name
- *
- * NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is
- * found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set.
- */
- switch (Name[1])
- {
- case 'L':
- Type = ACPI_GPE_LEVEL_TRIGGERED;
- break;
-
- case 'E':
- Type = ACPI_GPE_EDGE_TRIGGERED;
- break;
-
- default:
- /* Unknown method type, just ignore it */
-
- 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);
- }
-
- /* 4) The last two characters of the name are the hex GPE Number */
-
- GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
- if (GpeNumber == ACPI_UINT32_MAX)
- {
- /* Conversion failed; invalid method, just ignore it */
-
- 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);
- }
-
- /* Ensure that we have a valid GPE number for this GPE block */
-
- GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock);
- if (!GpeEventInfo)
- {
- /*
- * This GpeNumber is not valid for this GPE block, just ignore it.
- * However, it may be valid for a different GPE block, since GPE0
- * and GPE1 methods both appear under \_GPE.
- */
- return_ACPI_STATUS (AE_OK);
- }
-
- /*
- * Add the GPE information from above to the GpeEventInfo block for
- * use during dispatch of this GPE.
- */
- GpeEventInfo->Flags = (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD);
- GpeEventInfo->Dispatch.MethodNode = MethodNode;
-
- ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
- "Registered GPE method %s as GPE number 0x%.2X\n",
- Name, GpeNumber));
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvMatchPrwAndGpe
- *
- * PARAMETERS: Callback from WalkNamespace
- *
- * 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
- * number and mark the GPE as a CAN_WAKE GPE.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiEvMatchPrwAndGpe (
- ACPI_HANDLE ObjHandle,
- UINT32 Level,
- void *Info,
- void **ReturnValue)
-{
- ACPI_GPE_WALK_INFO *GpeInfo = (void *) Info;
- ACPI_NAMESPACE_NODE *GpeDevice;
- ACPI_GPE_BLOCK_INFO *GpeBlock;
- ACPI_NAMESPACE_NODE *TargetGpeDevice;
- ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_OPERAND_OBJECT *PkgDesc;
- ACPI_OPERAND_OBJECT *ObjDesc;
- UINT32 GpeNumber;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe);
-
-
- /* Check for a _PRW method under this device */
-
- Status = AcpiUtEvaluateObject (ObjHandle, METHOD_NAME__PRW,
- ACPI_BTYPE_PACKAGE, &PkgDesc);
- if (ACPI_FAILURE (Status))
- {
- /* Ignore all errors from _PRW, we don't want to abort the walk */
-
- return_ACPI_STATUS (AE_OK);
- }
-
- /* The returned _PRW package must have at least two elements */
-
- if (PkgDesc->Package.Count < 2)
- {
- goto Cleanup;
- }
-
- /* Extract pointers from the input context */
-
- GpeDevice = GpeInfo->GpeDevice;
- GpeBlock = GpeInfo->GpeBlock;
-
- /*
- * The _PRW object must return a package, we are only interested in the
- * first element
- */
- ObjDesc = PkgDesc->Package.Elements[0];
-
- if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
- {
- /* Use FADT-defined GPE device (from definition of _PRW) */
-
- TargetGpeDevice = AcpiGbl_FadtGpeDevice;
-
- /* Integer is the GPE number in the FADT described GPE blocks */
-
- GpeNumber = (UINT32) ObjDesc->Integer.Value;
- }
- else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
- {
- /* Package contains a GPE reference and GPE number within a GPE block */
-
- if ((ObjDesc->Package.Count < 2) ||
- ((ObjDesc->Package.Elements[0])->Common.Type !=
- ACPI_TYPE_LOCAL_REFERENCE) ||
- ((ObjDesc->Package.Elements[1])->Common.Type !=
- ACPI_TYPE_INTEGER))
- {
- goto Cleanup;
- }
-
- /* Get GPE block reference and decode */
-
- TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node;
- GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value;
- }
- else
- {
- /* Unknown type, just ignore it */
-
- goto Cleanup;
- }
-
- /*
- * Is this GPE within this block?
- *
- * TRUE if and only if these conditions are true:
- * 1) The GPE devices match.
- * 2) The GPE index(number) is within the range of the Gpe Block
- * associated with the GPE device.
- */
- if (GpeDevice != TargetGpeDevice)
- {
- goto Cleanup;
- }
-
- GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock);
- if (GpeEventInfo)
- {
- /* This GPE can wake the system */
-
- GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
- }
-
-Cleanup:
- AcpiUtRemoveReference (PkgDesc);
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvGetGpeXruptBlock
- *
- * PARAMETERS: InterruptNumber - Interrupt for a GPE block
- *
- * RETURN: A GPE interrupt block
- *
- * 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.
- *
- ******************************************************************************/
-
-static ACPI_GPE_XRUPT_INFO *
-AcpiEvGetGpeXruptBlock (
- UINT32 InterruptNumber)
-{
- ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
- ACPI_GPE_XRUPT_INFO *GpeXrupt;
- ACPI_STATUS Status;
- ACPI_CPU_FLAGS Flags;
-
-
- ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
-
-
- /* No need for lock since we are not changing any list elements here */
-
- NextGpeXrupt = AcpiGbl_GpeXruptListHead;
- while (NextGpeXrupt)
- {
- if (NextGpeXrupt->InterruptNumber == InterruptNumber)
- {
- return_PTR (NextGpeXrupt);
- }
-
- NextGpeXrupt = NextGpeXrupt->Next;
- }
-
- /* Not found, must allocate a new xrupt descriptor */
-
- GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
- if (!GpeXrupt)
- {
- return_PTR (NULL);
- }
-
- GpeXrupt->InterruptNumber = InterruptNumber;
-
- /* Install new interrupt descriptor with spin lock */
-
- Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
- if (AcpiGbl_GpeXruptListHead)
- {
- NextGpeXrupt = AcpiGbl_GpeXruptListHead;
- while (NextGpeXrupt->Next)
- {
- NextGpeXrupt = NextGpeXrupt->Next;
- }
-
- NextGpeXrupt->Next = GpeXrupt;
- GpeXrupt->Previous = NextGpeXrupt;
- }
- else
- {
- AcpiGbl_GpeXruptListHead = GpeXrupt;
- }
- AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
-
- /* Install new interrupt handler if not SCI_INT */
-
- if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
- {
- Status = AcpiOsInstallInterruptHandler (InterruptNumber,
- AcpiEvGpeXruptHandler, GpeXrupt);
- if (ACPI_FAILURE (Status))
- {
- ACPI_ERROR ((AE_INFO,
- "Could not install GPE interrupt handler at level 0x%X",
- InterruptNumber));
- return_PTR (NULL);
- }
- }
-
- return_PTR (GpeXrupt);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvDeleteGpeXrupt
- *
- * PARAMETERS: GpeXrupt - A GPE interrupt info block
- *
- * RETURN: Status
- *
- * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
- * interrupt handler if not the SCI interrupt.
- *
- ******************************************************************************/
-
-static ACPI_STATUS
-AcpiEvDeleteGpeXrupt (
- ACPI_GPE_XRUPT_INFO *GpeXrupt)
-{
- ACPI_STATUS Status;
- ACPI_CPU_FLAGS Flags;
-
-
- ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
-
-
- /* We never want to remove the SCI interrupt handler */
-
- if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
- {
- GpeXrupt->GpeBlockListHead = NULL;
- return_ACPI_STATUS (AE_OK);
- }
-
- /* Disable this interrupt */
-
- Status = AcpiOsRemoveInterruptHandler (
- GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /* Unlink the interrupt block with lock */
-
- Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
- if (GpeXrupt->Previous)
- {
- GpeXrupt->Previous->Next = GpeXrupt->Next;
- }
- else
- {
- /* No previous, update list head */
-
- AcpiGbl_GpeXruptListHead = GpeXrupt->Next;
- }
-
- if (GpeXrupt->Next)
- {
- GpeXrupt->Next->Previous = GpeXrupt->Previous;
- }
- AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
-
- /* Free the block */
-
- ACPI_FREE (GpeXrupt);
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
* FUNCTION: AcpiEvInstallGpeBlock
*
* PARAMETERS: GpeBlock - New GPE block
@@ -1041,6 +444,7 @@ AcpiEvCreateGpeBlock (
{
ACPI_STATUS Status;
ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_WALK_INFO WalkInfo;
ACPI_FUNCTION_TRACE (EvCreateGpeBlock);
@@ -1089,11 +493,16 @@ AcpiEvCreateGpeBlock (
return_ACPI_STATUS (Status);
}
- /* Find all GPE methods (_Lxx, _Exx) for this block */
+ /* Find all GPE methods (_Lxx or_Exx) for this block */
+
+ WalkInfo.GpeBlock = GpeBlock;
+ WalkInfo.GpeDevice = GpeDevice;
+ WalkInfo.EnableThisGpe = FALSE;
+ WalkInfo.ExecuteByOwnerId = FALSE;
Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD, GpeDevice,
ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
- AcpiEvMatchGpeMethod, NULL, GpeBlock, NULL);
+ AcpiEvMatchGpeMethod, NULL, &WalkInfo, NULL);
/* Return the new block */
@@ -1139,7 +548,7 @@ AcpiEvInitializeGpeBlock (
{
ACPI_STATUS Status;
ACPI_GPE_EVENT_INFO *GpeEventInfo;
- ACPI_GPE_WALK_INFO GpeInfo;
+ ACPI_GPE_WALK_INFO WalkInfo;
UINT32 WakeGpeCount;
UINT32 GpeEnabledCount;
UINT32 GpeIndex;
@@ -1170,12 +579,13 @@ AcpiEvInitializeGpeBlock (
* definition a wake GPE and will not be enabled while the machine
* is running.
*/
- GpeInfo.GpeBlock = GpeBlock;
- GpeInfo.GpeDevice = GpeDevice;
+ WalkInfo.GpeBlock = GpeBlock;
+ WalkInfo.GpeDevice = GpeDevice;
+ WalkInfo.ExecuteByOwnerId = FALSE;
Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
ACPI_UINT32_MAX, ACPI_NS_WALK_UNLOCK,
- AcpiEvMatchPrwAndGpe, NULL, &GpeInfo, NULL);
+ AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "While executing _PRW methods"));
@@ -1238,165 +648,13 @@ AcpiEvInitializeGpeBlock (
}
}
- ACPI_DEBUG_PRINT ((ACPI_DB_INIT,
- "Found %u Wake, Enabled %u Runtime GPEs in this block\n",
- WakeGpeCount, GpeEnabledCount));
-
- return_ACPI_STATUS (AE_OK);
-}
-
-
-/*******************************************************************************
- *
- * FUNCTION: AcpiEvGpeInitialize
- *
- * PARAMETERS: None
- *
- * RETURN: Status
- *
- * DESCRIPTION: Initialize the GPE data structures
- *
- ******************************************************************************/
-
-ACPI_STATUS
-AcpiEvGpeInitialize (
- void)
-{
- UINT32 RegisterCount0 = 0;
- UINT32 RegisterCount1 = 0;
- UINT32 GpeNumberMax = 0;
- ACPI_STATUS Status;
-
-
- ACPI_FUNCTION_TRACE (EvGpeInitialize);
-
-
- Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
- if (ACPI_FAILURE (Status))
- {
- return_ACPI_STATUS (Status);
- }
-
- /*
- * Initialize the GPE Block(s) defined in the FADT
- *
- * Why the GPE register block lengths are divided by 2: From the ACPI
- * Spec, section "General-Purpose Event Registers", we have:
- *
- * "Each register block contains two registers of equal length
- * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
- * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
- * The length of the GPE1_STS and GPE1_EN registers is equal to
- * half the GPE1_LEN. If a generic register block is not supported
- * then its respective block pointer and block length values in the
- * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
- * to be the same size."
- */
-
- /*
- * Determine the maximum GPE number for this machine.
- *
- * Note: both GPE0 and GPE1 are optional, and either can exist without
- * the other.
- *
- * If EITHER the register length OR the block address are zero, then that
- * particular block is not supported.
- */
- if (AcpiGbl_FADT.Gpe0BlockLength &&
- AcpiGbl_FADT.XGpe0Block.Address)
- {
- /* GPE block 0 exists (has both length and address > 0) */
-
- RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
-
- GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
-
- /* Install GPE Block 0 */
-
- Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
- &AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0,
- AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
-
- if (ACPI_FAILURE (Status))
- {
- ACPI_EXCEPTION ((AE_INFO, Status,
- "Could not create GPE Block 0"));
- }
- }
-
- if (AcpiGbl_FADT.Gpe1BlockLength &&
- AcpiGbl_FADT.XGpe1Block.Address)
- {
- /* GPE block 1 exists (has both length and address > 0) */
-
- RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
-
- /* Check for GPE0/GPE1 overlap (if both banks exist) */
-
- if ((RegisterCount0) &&
- (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
- {
- ACPI_ERROR ((AE_INFO,
- "GPE0 block (GPE 0 to %u) overlaps the GPE1 block "
- "(GPE %u to %u) - 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 */
-
- RegisterCount1 = 0;
- }
- else
- {
- /* Install GPE Block 1 */
-
- Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
- &AcpiGbl_FADT.XGpe1Block, RegisterCount1,
- AcpiGbl_FADT.Gpe1Base,
- AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
-
- if (ACPI_FAILURE (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);
- }
- }
-
- /* Exit if there are no GPE registers */
-
- if ((RegisterCount0 + RegisterCount1) == 0)
+ if (GpeEnabledCount || WakeGpeCount)
{
- /* 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"));
- Status = AE_OK;
- goto Cleanup;
+ "Enabled %u Runtime GPEs, added %u Wake GPEs in this block\n",
+ GpeEnabledCount, WakeGpeCount));
}
- /* Check for Max GPE number out-of-range */
-
- if (GpeNumberMax > ACPI_GPE_MAX)
- {
- ACPI_ERROR ((AE_INFO,
- "Maximum GPE number from FADT is too large: 0x%X",
- GpeNumberMax));
- Status = AE_BAD_VALUE;
- goto Cleanup;
- }
-
-Cleanup:
- (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
return_ACPI_STATUS (AE_OK);
}
-
diff --git a/events/evgpeinit.c b/events/evgpeinit.c
new file mode 100644
index 000000000000..1720250cc85f
--- /dev/null
+++ b/events/evgpeinit.c
@@ -0,0 +1,763 @@
+/******************************************************************************
+ *
+ * Module Name: evgpeinit - System GPE initialization and update
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h"
+#include "accommon.h"
+#include "acevents.h"
+#include "acnamesp.h"
+#include "acinterp.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evgpeinit")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGpeInitialize
+ *
+ * PARAMETERS: None
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Initialize the GPE data structures and the FADT GPE 0/1 blocks
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvGpeInitialize (
+ void)
+{
+ UINT32 RegisterCount0 = 0;
+ UINT32 RegisterCount1 = 0;
+ UINT32 GpeNumberMax = 0;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (EvGpeInitialize);
+
+
+ Status = AcpiUtAcquireMutex (ACPI_MTX_NAMESPACE);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /*
+ * Initialize the GPE Block(s) defined in the FADT
+ *
+ * Why the GPE register block lengths are divided by 2: From the ACPI
+ * Spec, section "General-Purpose Event Registers", we have:
+ *
+ * "Each register block contains two registers of equal length
+ * GPEx_STS and GPEx_EN (where x is 0 or 1). The length of the
+ * GPE0_STS and GPE0_EN registers is equal to half the GPE0_LEN
+ * The length of the GPE1_STS and GPE1_EN registers is equal to
+ * half the GPE1_LEN. If a generic register block is not supported
+ * then its respective block pointer and block length values in the
+ * FADT table contain zeros. The GPE0_LEN and GPE1_LEN do not need
+ * to be the same size."
+ */
+
+ /*
+ * Determine the maximum GPE number for this machine.
+ *
+ * Note: both GPE0 and GPE1 are optional, and either can exist without
+ * the other.
+ *
+ * If EITHER the register length OR the block address are zero, then that
+ * particular block is not supported.
+ */
+ if (AcpiGbl_FADT.Gpe0BlockLength &&
+ AcpiGbl_FADT.XGpe0Block.Address)
+ {
+ /* GPE block 0 exists (has both length and address > 0) */
+
+ RegisterCount0 = (UINT16) (AcpiGbl_FADT.Gpe0BlockLength / 2);
+
+ GpeNumberMax = (RegisterCount0 * ACPI_GPE_REGISTER_WIDTH) - 1;
+
+ /* Install GPE Block 0 */
+
+ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
+ &AcpiGbl_FADT.XGpe0Block, RegisterCount0, 0,
+ AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[0]);
+
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not create GPE Block 0"));
+ }
+ }
+
+ if (AcpiGbl_FADT.Gpe1BlockLength &&
+ AcpiGbl_FADT.XGpe1Block.Address)
+ {
+ /* GPE block 1 exists (has both length and address > 0) */
+
+ RegisterCount1 = (UINT16) (AcpiGbl_FADT.Gpe1BlockLength / 2);
+
+ /* Check for GPE0/GPE1 overlap (if both banks exist) */
+
+ if ((RegisterCount0) &&
+ (GpeNumberMax >= AcpiGbl_FADT.Gpe1Base))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "GPE0 block (GPE 0 to %u) overlaps the GPE1 block "
+ "(GPE %u to %u) - 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 */
+
+ RegisterCount1 = 0;
+ }
+ else
+ {
+ /* Install GPE Block 1 */
+
+ Status = AcpiEvCreateGpeBlock (AcpiGbl_FadtGpeDevice,
+ &AcpiGbl_FADT.XGpe1Block, RegisterCount1,
+ AcpiGbl_FADT.Gpe1Base,
+ AcpiGbl_FADT.SciInterrupt, &AcpiGbl_GpeFadtBlocks[1]);
+
+ if (ACPI_FAILURE (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);
+ }
+ }
+
+ /* Exit if there are no GPE registers */
+
+ if ((RegisterCount0 + RegisterCount1) == 0)
+ {
+ /* 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"));
+ Status = AE_OK;
+ goto Cleanup;
+ }
+
+ /* Check for Max GPE number out-of-range */
+
+ if (GpeNumberMax > ACPI_GPE_MAX)
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Maximum GPE number from FADT is too large: 0x%X",
+ GpeNumberMax));
+ Status = AE_BAD_VALUE;
+ goto Cleanup;
+ }
+
+Cleanup:
+ (void) AcpiUtReleaseMutex (ACPI_MTX_NAMESPACE);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvUpdateGpes
+ *
+ * PARAMETERS: TableOwnerId - ID of the newly-loaded ACPI table
+ *
+ * RETURN: None
+ *
+ * DESCRIPTION: Check for new GPE methods (_Lxx/_Exx) made available as a
+ * result of a Load() or LoadTable() operation. If new GPE
+ * methods have been installed, register the new methods and
+ * enable and runtime GPEs that are associated with them. Also,
+ * run any newly loaded _PRW methods in order to discover any
+ * new CAN_WAKE GPEs.
+ *
+ ******************************************************************************/
+
+void
+AcpiEvUpdateGpes (
+ ACPI_OWNER_ID TableOwnerId)
+{
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_WALK_INFO WalkInfo;
+ ACPI_STATUS Status = AE_OK;
+ UINT32 NewWakeGpeCount = 0;
+
+
+ /* We will examine only _PRW/_Lxx/_Exx methods owned by this table */
+
+ WalkInfo.OwnerId = TableOwnerId;
+ WalkInfo.ExecuteByOwnerId = TRUE;
+ WalkInfo.Count = 0;
+
+ if (AcpiGbl_LeaveWakeGpesDisabled)
+ {
+ /*
+ * 1) Run any newly-loaded _PRW methods to find any GPEs that
+ * can now be marked as CAN_WAKE GPEs. Note: We must run the
+ * _PRW methods before we process the _Lxx/_Exx methods because
+ * we will enable all runtime GPEs associated with the new
+ * _Lxx/_Exx methods at the time we process those methods.
+ *
+ * Unlock interpreter so that we can run the _PRW methods.
+ */
+ WalkInfo.GpeBlock = NULL;
+ WalkInfo.GpeDevice = NULL;
+
+ AcpiExExitInterpreter ();
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
+ ACPI_UINT32_MAX, ACPI_NS_WALK_NO_UNLOCK,
+ AcpiEvMatchPrwAndGpe, NULL, &WalkInfo, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While executing _PRW methods"));
+ }
+
+ AcpiExEnterInterpreter ();
+ NewWakeGpeCount = WalkInfo.Count;
+ }
+
+ /*
+ * 2) Find any _Lxx/_Exx GPE methods that have just been loaded.
+ *
+ * Any GPEs that correspond to new _Lxx/_Exx methods and are not
+ * marked as CAN_WAKE are immediately enabled.
+ *
+ * Examine the namespace underneath each GpeDevice within the
+ * GpeBlock lists.
+ */
+ Status = AcpiUtAcquireMutex (ACPI_MTX_EVENTS);
+ if (ACPI_FAILURE (Status))
+ {
+ return;
+ }
+
+ WalkInfo.Count = 0;
+ WalkInfo.EnableThisGpe = TRUE;
+
+ /* Walk the interrupt level descriptor list */
+
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
+ {
+ /* Walk all Gpe Blocks attached to this interrupt level */
+
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ WalkInfo.GpeBlock = GpeBlock;
+ WalkInfo.GpeDevice = GpeBlock->Node;
+
+ Status = AcpiNsWalkNamespace (ACPI_TYPE_METHOD,
+ WalkInfo.GpeDevice, ACPI_UINT32_MAX,
+ ACPI_NS_WALK_NO_UNLOCK, AcpiEvMatchGpeMethod,
+ NULL, &WalkInfo, NULL);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "While decoding _Lxx/_Exx methods"));
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptInfo = GpeXruptInfo->Next;
+ }
+
+ if (WalkInfo.Count || NewWakeGpeCount)
+ {
+ ACPI_INFO ((AE_INFO,
+ "Enabled %u new runtime GPEs, added %u new wakeup GPEs",
+ WalkInfo.Count, NewWakeGpeCount));
+ }
+
+ (void) AcpiUtReleaseMutex (ACPI_MTX_EVENTS);
+ return;
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvMatchGpeMethod
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * RETURN: Status
+ *
+ * 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. Allows a
+ * per-OwnerId evaluation if ExecuteByOwnerId is TRUE in the
+ * WalkInfo parameter block.
+ *
+ * The name of each GPE control method is of the form:
+ * "_Lxx" or "_Exx", where:
+ * L - means that the GPE is level triggered
+ * E - means that the GPE is edge triggered
+ * xx - is the GPE number [in HEX]
+ *
+ * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute examine GPE methods
+ * with that owner.
+ * If WalkInfo->EnableThisGpe is TRUE, the GPE that is referred to by a GPE
+ * method is immediately enabled (Used for Load/LoadTable operators)
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvMatchGpeMethod (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_NAMESPACE_NODE *MethodNode = ACPI_CAST_PTR (ACPI_NAMESPACE_NODE, ObjHandle);
+ ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ ACPI_NAMESPACE_NODE *GpeDevice;
+ ACPI_STATUS Status;
+ UINT32 GpeNumber;
+ char Name[ACPI_NAME_SIZE + 1];
+ UINT8 Type;
+
+
+ ACPI_FUNCTION_TRACE (EvMatchGpeMethod);
+
+
+ /* Check if requested OwnerId matches this OwnerId */
+
+ if ((WalkInfo->ExecuteByOwnerId) &&
+ (MethodNode->OwnerId != WalkInfo->OwnerId))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Match and decode the _Lxx and _Exx GPE method names
+ *
+ * 1) Extract the method name and null terminate it
+ */
+ ACPI_MOVE_32_TO_32 (Name, &MethodNode->Name.Integer);
+ Name[ACPI_NAME_SIZE] = 0;
+
+ /* 2) Name must begin with an underscore */
+
+ if (Name[0] != '_')
+ {
+ return_ACPI_STATUS (AE_OK); /* Ignore this method */
+ }
+
+ /*
+ * 3) Edge/Level determination is based on the 2nd character
+ * of the method name
+ *
+ * NOTE: Default GPE type is RUNTIME only. Later, if a _PRW object is
+ * found that points to this GPE, the ACPI_GPE_CAN_WAKE flag is set.
+ */
+ switch (Name[1])
+ {
+ case 'L':
+ Type = ACPI_GPE_LEVEL_TRIGGERED;
+ break;
+
+ case 'E':
+ Type = ACPI_GPE_EDGE_TRIGGERED;
+ break;
+
+ default:
+ /* Unknown method type, just ignore it */
+
+ 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);
+ }
+
+ /* 4) The last two characters of the name are the hex GPE Number */
+
+ GpeNumber = ACPI_STRTOUL (&Name[2], NULL, 16);
+ if (GpeNumber == ACPI_UINT32_MAX)
+ {
+ /* Conversion failed; invalid method, just ignore it */
+
+ 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);
+ }
+
+ /* Ensure that we have a valid GPE number for this GPE block */
+
+ GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, WalkInfo->GpeBlock);
+ if (!GpeEventInfo)
+ {
+ /*
+ * This GpeNumber is not valid for this GPE block, just ignore it.
+ * However, it may be valid for a different GPE block, since GPE0
+ * and GPE1 methods both appear under \_GPE.
+ */
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+ ACPI_GPE_DISPATCH_HANDLER)
+ {
+ /* If there is already a handler, ignore this GPE method */
+
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+ ACPI_GPE_DISPATCH_METHOD)
+ {
+ /*
+ * If there is already a method, ignore this method. But check
+ * for a type mismatch (if both the _Lxx AND _Exx exist)
+ */
+ if (Type != (GpeEventInfo->Flags & ACPI_GPE_XRUPT_TYPE_MASK))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "For GPE 0x%.2X, found both _L%2.2X and _E%2.2X methods",
+ GpeNumber, GpeNumber, GpeNumber));
+ }
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /*
+ * Add the GPE information from above to the GpeEventInfo block for
+ * use during dispatch of this GPE.
+ */
+ GpeEventInfo->Flags |= (UINT8) (Type | ACPI_GPE_DISPATCH_METHOD);
+ GpeEventInfo->Dispatch.MethodNode = MethodNode;
+
+ /*
+ * Enable this GPE if requested. This only happens when during the
+ * execution of a Load or LoadTable operator. We have found a new
+ * GPE method and want to immediately enable the GPE if it is a
+ * runtime GPE.
+ */
+ if (WalkInfo->EnableThisGpe)
+ {
+ /* Ignore GPEs that can wake the system */
+
+ if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE) ||
+ !AcpiGbl_LeaveWakeGpesDisabled)
+ {
+ WalkInfo->Count++;
+ GpeDevice = WalkInfo->GpeDevice;
+
+ if (GpeDevice == AcpiGbl_FadtGpeDevice)
+ {
+ GpeDevice = NULL;
+ }
+
+ Status = AcpiEnableGpe (GpeDevice, GpeNumber,
+ ACPI_GPE_TYPE_RUNTIME);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_EXCEPTION ((AE_INFO, Status,
+ "Could not enable GPE 0x%02X", GpeNumber));
+ }
+ }
+ }
+
+ ACPI_DEBUG_PRINT ((ACPI_DB_LOAD,
+ "Registered GPE method %s as GPE number 0x%.2X\n",
+ Name, GpeNumber));
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvMatchPrwAndGpe
+ *
+ * PARAMETERS: Callback from WalkNamespace
+ *
+ * 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
+ * number and mark the GPE as a CAN_WAKE GPE. Allows a
+ * per-OwnerId execution if ExecuteByOwnerId is TRUE in the
+ * WalkInfo parameter block.
+ *
+ * If WalkInfo->ExecuteByOwnerId is TRUE, we only execute _PRWs with that
+ * owner.
+ * If WalkInfo->GpeDevice is NULL, we execute every _PRW found. Otherwise,
+ * we only execute _PRWs that refer to the input GpeDevice.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvMatchPrwAndGpe (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue)
+{
+ ACPI_GPE_WALK_INFO *WalkInfo = ACPI_CAST_PTR (ACPI_GPE_WALK_INFO, Context);
+ ACPI_NAMESPACE_NODE *GpeDevice;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_NAMESPACE_NODE *TargetGpeDevice;
+ ACPI_NAMESPACE_NODE *PrwNode;
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ ACPI_OPERAND_OBJECT *PkgDesc;
+ ACPI_OPERAND_OBJECT *ObjDesc;
+ UINT32 GpeNumber;
+ ACPI_STATUS Status;
+
+
+ ACPI_FUNCTION_TRACE (EvMatchPrwAndGpe);
+
+
+ /* Check for a _PRW method under this device */
+
+ Status = AcpiNsGetNode (ObjHandle, METHOD_NAME__PRW,
+ ACPI_NS_NO_UPSEARCH, &PrwNode);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Check if requested OwnerId matches this OwnerId */
+
+ if ((WalkInfo->ExecuteByOwnerId) &&
+ (PrwNode->OwnerId != WalkInfo->OwnerId))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Execute the _PRW */
+
+ Status = AcpiUtEvaluateObject (PrwNode, NULL,
+ ACPI_BTYPE_PACKAGE, &PkgDesc);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* The returned _PRW package must have at least two elements */
+
+ if (PkgDesc->Package.Count < 2)
+ {
+ goto Cleanup;
+ }
+
+ /* Extract pointers from the input context */
+
+ GpeDevice = WalkInfo->GpeDevice;
+ GpeBlock = WalkInfo->GpeBlock;
+
+ /*
+ * The _PRW object must return a package, we are only interested
+ * in the first element
+ */
+ ObjDesc = PkgDesc->Package.Elements[0];
+
+ if (ObjDesc->Common.Type == ACPI_TYPE_INTEGER)
+ {
+ /* Use FADT-defined GPE device (from definition of _PRW) */
+
+ TargetGpeDevice = NULL;
+ if (GpeDevice)
+ {
+ TargetGpeDevice = AcpiGbl_FadtGpeDevice;
+ }
+
+ /* Integer is the GPE number in the FADT described GPE blocks */
+
+ GpeNumber = (UINT32) ObjDesc->Integer.Value;
+ }
+ else if (ObjDesc->Common.Type == ACPI_TYPE_PACKAGE)
+ {
+ /* Package contains a GPE reference and GPE number within a GPE block */
+
+ if ((ObjDesc->Package.Count < 2) ||
+ ((ObjDesc->Package.Elements[0])->Common.Type !=
+ ACPI_TYPE_LOCAL_REFERENCE) ||
+ ((ObjDesc->Package.Elements[1])->Common.Type !=
+ ACPI_TYPE_INTEGER))
+ {
+ goto Cleanup;
+ }
+
+ /* Get GPE block reference and decode */
+
+ TargetGpeDevice = ObjDesc->Package.Elements[0]->Reference.Node;
+ GpeNumber = (UINT32) ObjDesc->Package.Elements[1]->Integer.Value;
+ }
+ else
+ {
+ /* Unknown type, just ignore it */
+
+ goto Cleanup;
+ }
+
+ /* Get the GpeEventInfo for this GPE */
+
+ if (GpeDevice)
+ {
+ /*
+ * Is this GPE within this block?
+ *
+ * TRUE if and only if these conditions are true:
+ * 1) The GPE devices match.
+ * 2) The GPE index(number) is within the range of the Gpe Block
+ * associated with the GPE device.
+ */
+ if (GpeDevice != TargetGpeDevice)
+ {
+ goto Cleanup;
+ }
+
+ GpeEventInfo = AcpiEvLowGetGpeInfo (GpeNumber, GpeBlock);
+ }
+ else
+ {
+ /* GpeDevice is NULL, just match the TargetDevice and GpeNumber */
+
+ GpeEventInfo = AcpiEvGetGpeEventInfo (TargetGpeDevice, GpeNumber);
+ }
+
+ if (GpeEventInfo)
+ {
+ if (!(GpeEventInfo->Flags & ACPI_GPE_CAN_WAKE))
+ {
+ /* This GPE can wake the system */
+
+ GpeEventInfo->Flags |= ACPI_GPE_CAN_WAKE;
+ WalkInfo->Count++;
+ }
+ }
+
+Cleanup:
+ AcpiUtRemoveReference (PkgDesc);
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/events/evgpeutil.c b/events/evgpeutil.c
new file mode 100644
index 000000000000..2ac0ad448090
--- /dev/null
+++ b/events/evgpeutil.c
@@ -0,0 +1,452 @@
+/******************************************************************************
+ *
+ * Module Name: evgpeutil - GPE utilities
+ *
+ *****************************************************************************/
+
+/******************************************************************************
+ *
+ * 1. Copyright Notice
+ *
+ * Some or all of this work - Copyright (c) 1999 - 2010, 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 "acpi.h"
+#include "accommon.h"
+#include "acevents.h"
+
+#define _COMPONENT ACPI_EVENTS
+ ACPI_MODULE_NAME ("evgpeutil")
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvWalkGpeList
+ *
+ * PARAMETERS: GpeWalkCallback - Routine called for each GPE block
+ * Context - Value passed to callback
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Walk the GPE lists.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvWalkGpeList (
+ ACPI_GPE_CALLBACK GpeWalkCallback,
+ void *Context)
+{
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo;
+ ACPI_STATUS Status = AE_OK;
+ ACPI_CPU_FLAGS Flags;
+
+
+ ACPI_FUNCTION_TRACE (EvWalkGpeList);
+
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+
+ /* Walk the interrupt level descriptor list */
+
+ GpeXruptInfo = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptInfo)
+ {
+ /* Walk all Gpe Blocks attached to this interrupt level */
+
+ GpeBlock = GpeXruptInfo->GpeBlockListHead;
+ while (GpeBlock)
+ {
+ /* One callback per GPE block */
+
+ Status = GpeWalkCallback (GpeXruptInfo, GpeBlock, Context);
+ if (ACPI_FAILURE (Status))
+ {
+ if (Status == AE_CTRL_END) /* Callback abort */
+ {
+ Status = AE_OK;
+ }
+ goto UnlockAndExit;
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptInfo = GpeXruptInfo->Next;
+ }
+
+UnlockAndExit:
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+ return_ACPI_STATUS (Status);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvValidGpeEvent
+ *
+ * PARAMETERS: GpeEventInfo - Info for this GPE
+ *
+ * RETURN: TRUE if the GpeEvent is valid
+ *
+ * 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.
+ *
+ ******************************************************************************/
+
+BOOLEAN
+AcpiEvValidGpeEvent (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo)
+{
+ ACPI_GPE_XRUPT_INFO *GpeXruptBlock;
+ ACPI_GPE_BLOCK_INFO *GpeBlock;
+
+
+ ACPI_FUNCTION_ENTRY ();
+
+
+ /* No need for spin lock since we are not changing any list elements */
+
+ /* Walk the GPE interrupt levels */
+
+ GpeXruptBlock = AcpiGbl_GpeXruptListHead;
+ while (GpeXruptBlock)
+ {
+ GpeBlock = GpeXruptBlock->GpeBlockListHead;
+
+ /* Walk the GPE blocks on this interrupt level */
+
+ while (GpeBlock)
+ {
+ if ((&GpeBlock->EventInfo[0] <= GpeEventInfo) &&
+ (&GpeBlock->EventInfo[GpeBlock->GpeCount] > GpeEventInfo))
+ {
+ return (TRUE);
+ }
+
+ GpeBlock = GpeBlock->Next;
+ }
+
+ GpeXruptBlock = GpeXruptBlock->Next;
+ }
+
+ return (FALSE);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvGetGpeXruptBlock
+ *
+ * PARAMETERS: InterruptNumber - Interrupt for a GPE block
+ *
+ * RETURN: A GPE interrupt block
+ *
+ * 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.
+ *
+ ******************************************************************************/
+
+ACPI_GPE_XRUPT_INFO *
+AcpiEvGetGpeXruptBlock (
+ UINT32 InterruptNumber)
+{
+ ACPI_GPE_XRUPT_INFO *NextGpeXrupt;
+ ACPI_GPE_XRUPT_INFO *GpeXrupt;
+ ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
+
+
+ ACPI_FUNCTION_TRACE (EvGetGpeXruptBlock);
+
+
+ /* No need for lock since we are not changing any list elements here */
+
+ NextGpeXrupt = AcpiGbl_GpeXruptListHead;
+ while (NextGpeXrupt)
+ {
+ if (NextGpeXrupt->InterruptNumber == InterruptNumber)
+ {
+ return_PTR (NextGpeXrupt);
+ }
+
+ NextGpeXrupt = NextGpeXrupt->Next;
+ }
+
+ /* Not found, must allocate a new xrupt descriptor */
+
+ GpeXrupt = ACPI_ALLOCATE_ZEROED (sizeof (ACPI_GPE_XRUPT_INFO));
+ if (!GpeXrupt)
+ {
+ return_PTR (NULL);
+ }
+
+ GpeXrupt->InterruptNumber = InterruptNumber;
+
+ /* Install new interrupt descriptor with spin lock */
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+ if (AcpiGbl_GpeXruptListHead)
+ {
+ NextGpeXrupt = AcpiGbl_GpeXruptListHead;
+ while (NextGpeXrupt->Next)
+ {
+ NextGpeXrupt = NextGpeXrupt->Next;
+ }
+
+ NextGpeXrupt->Next = GpeXrupt;
+ GpeXrupt->Previous = NextGpeXrupt;
+ }
+ else
+ {
+ AcpiGbl_GpeXruptListHead = GpeXrupt;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+
+ /* Install new interrupt handler if not SCI_INT */
+
+ if (InterruptNumber != AcpiGbl_FADT.SciInterrupt)
+ {
+ Status = AcpiOsInstallInterruptHandler (InterruptNumber,
+ AcpiEvGpeXruptHandler, GpeXrupt);
+ if (ACPI_FAILURE (Status))
+ {
+ ACPI_ERROR ((AE_INFO,
+ "Could not install GPE interrupt handler at level 0x%X",
+ InterruptNumber));
+ return_PTR (NULL);
+ }
+ }
+
+ return_PTR (GpeXrupt);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDeleteGpeXrupt
+ *
+ * PARAMETERS: GpeXrupt - A GPE interrupt info block
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Remove and free a GpeXrupt block. Remove an associated
+ * interrupt handler if not the SCI interrupt.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvDeleteGpeXrupt (
+ ACPI_GPE_XRUPT_INFO *GpeXrupt)
+{
+ ACPI_STATUS Status;
+ ACPI_CPU_FLAGS Flags;
+
+
+ ACPI_FUNCTION_TRACE (EvDeleteGpeXrupt);
+
+
+ /* We never want to remove the SCI interrupt handler */
+
+ if (GpeXrupt->InterruptNumber == AcpiGbl_FADT.SciInterrupt)
+ {
+ GpeXrupt->GpeBlockListHead = NULL;
+ return_ACPI_STATUS (AE_OK);
+ }
+
+ /* Disable this interrupt */
+
+ Status = AcpiOsRemoveInterruptHandler (
+ GpeXrupt->InterruptNumber, AcpiEvGpeXruptHandler);
+ if (ACPI_FAILURE (Status))
+ {
+ return_ACPI_STATUS (Status);
+ }
+
+ /* Unlink the interrupt block with lock */
+
+ Flags = AcpiOsAcquireLock (AcpiGbl_GpeLock);
+ if (GpeXrupt->Previous)
+ {
+ GpeXrupt->Previous->Next = GpeXrupt->Next;
+ }
+ else
+ {
+ /* No previous, update list head */
+
+ AcpiGbl_GpeXruptListHead = GpeXrupt->Next;
+ }
+
+ if (GpeXrupt->Next)
+ {
+ GpeXrupt->Next->Previous = GpeXrupt->Previous;
+ }
+ AcpiOsReleaseLock (AcpiGbl_GpeLock, Flags);
+
+ /* Free the block */
+
+ ACPI_FREE (GpeXrupt);
+ return_ACPI_STATUS (AE_OK);
+}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiEvDeleteGpeHandlers
+ *
+ * PARAMETERS: GpeXruptInfo - GPE Interrupt info
+ * GpeBlock - Gpe Block info
+ *
+ * RETURN: Status
+ *
+ * DESCRIPTION: Delete all Handler objects found in the GPE data structs.
+ * Used only prior to termination.
+ *
+ ******************************************************************************/
+
+ACPI_STATUS
+AcpiEvDeleteGpeHandlers (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock,
+ void *Context)
+{
+ ACPI_GPE_EVENT_INFO *GpeEventInfo;
+ UINT32 i;
+ UINT32 j;
+
+
+ ACPI_FUNCTION_TRACE (EvDeleteGpeHandlers);
+
+
+ /* Examine each GPE Register within the block */
+
+ for (i = 0; i < GpeBlock->RegisterCount; i++)
+ {
+ /* Now look at the individual GPEs in this byte register */
+
+ for (j = 0; j < ACPI_GPE_REGISTER_WIDTH; j++)
+ {
+ GpeEventInfo = &GpeBlock->EventInfo[((ACPI_SIZE) i *
+ ACPI_GPE_REGISTER_WIDTH) + j];
+
+ if ((GpeEventInfo->Flags & ACPI_GPE_DISPATCH_MASK) ==
+ ACPI_GPE_DISPATCH_HANDLER)
+ {
+ ACPI_FREE (GpeEventInfo->Dispatch.Handler);
+ GpeEventInfo->Dispatch.Handler = NULL;
+ GpeEventInfo->Flags &= ~ACPI_GPE_DISPATCH_MASK;
+ }
+ }
+ }
+
+ return_ACPI_STATUS (AE_OK);
+}
+
diff --git a/executer/exconfig.c b/executer/exconfig.c
index 034afb65c34d..ab2be8a83de7 100644
--- a/executer/exconfig.c
+++ b/executer/exconfig.c
@@ -164,8 +164,9 @@ AcpiExAddTable (
ACPI_NAMESPACE_NODE *ParentNode,
ACPI_OPERAND_OBJECT **DdbHandle)
{
- ACPI_STATUS Status;
ACPI_OPERAND_OBJECT *ObjDesc;
+ ACPI_STATUS Status;
+ ACPI_OWNER_ID OwnerId;
ACPI_FUNCTION_TRACE (ExAddTable);
@@ -205,7 +206,15 @@ AcpiExAddTable (
AcpiNsExecModuleCodeList ();
AcpiExEnterInterpreter ();
- return_ACPI_STATUS (Status);
+ /* Update GPEs for any new _PRW or _Lxx/_Exx methods. Ignore errors */
+
+ Status = AcpiTbGetOwnerId (TableIndex, &OwnerId);
+ if (ACPI_SUCCESS (Status))
+ {
+ AcpiEvUpdateGpes (OwnerId);
+ }
+
+ return_ACPI_STATUS (AE_OK);
}
@@ -347,9 +356,8 @@ AcpiExLoadTableOp (
Status = AcpiGetTableByIndex (TableIndex, &Table);
if (ACPI_SUCCESS (Status))
{
- ACPI_INFO ((AE_INFO,
- "Dynamic OEM Table Load - [%.4s] OemId [%.6s] OemTableId [%.8s]",
- Table->Signature, Table->OemId, Table->OemTableId));
+ ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
+ AcpiTbPrintTableHeader (0, Table);
}
/* Invoke table handler if present */
@@ -644,6 +652,9 @@ AcpiExLoadOp (
return_ACPI_STATUS (Status);
}
+ ACPI_INFO ((AE_INFO, "Dynamic OEM Table Load:"));
+ AcpiTbPrintTableHeader (0, TableDesc.Pointer);
+
/* Remove the reference by added by AcpiExStore above */
AcpiUtRemoveReference (DdbHandle);
diff --git a/executer/exoparg1.c b/executer/exoparg1.c
index 1bff09b09cc1..7a47bb102df4 100644
--- a/executer/exoparg1.c
+++ b/executer/exoparg1.c
@@ -268,7 +268,7 @@ AcpiExOpcode_1A_0T_0R (
case AML_SLEEP_OP: /* Sleep (MsecTime) */
- Status = AcpiExSystemDoSuspend (Operand[0]->Integer.Value);
+ Status = AcpiExSystemDoSleep (Operand[0]->Integer.Value);
break;
diff --git a/executer/exsystem.c b/executer/exsystem.c
index f43ef215527f..8f4ccfe37140 100644
--- a/executer/exsystem.c
+++ b/executer/exsystem.c
@@ -280,19 +280,19 @@ AcpiExSystemDoStall (
/*******************************************************************************
*
- * FUNCTION: AcpiExSystemDoSuspend
+ * FUNCTION: AcpiExSystemDoSleep
*
- * PARAMETERS: HowLong - The amount of time to suspend,
+ * PARAMETERS: HowLong - The amount of time to sleep,
* in milliseconds
*
* RETURN: None
*
- * DESCRIPTION: Suspend running thread for specified amount of time.
+ * DESCRIPTION: Sleep the running thread for specified amount of time.
*
******************************************************************************/
ACPI_STATUS
-AcpiExSystemDoSuspend (
+AcpiExSystemDoSleep (
UINT64 HowLong)
{
ACPI_FUNCTION_ENTRY ();
diff --git a/include/acevents.h b/include/acevents.h
index 4d945eff8aad..40515579e5e0 100644
--- a/include/acevents.h
+++ b/include/acevents.h
@@ -167,8 +167,12 @@ AcpiEvQueueNotifyRequest (
/*
- * evgpe - GPE handling and dispatch
+ * evgpe - Low-level GPE support
*/
+UINT32
+AcpiEvGpeDetect (
+ ACPI_GPE_XRUPT_INFO *GpeXruptList);
+
ACPI_STATUS
AcpiEvUpdateGpeEnableMasks (
ACPI_GPE_EVENT_INFO *GpeEventInfo);
@@ -193,23 +197,8 @@ AcpiEvLowGetGpeInfo (
/*
- * evgpeblk
+ * evgpeblk - Upper-level GPE block support
*/
-BOOLEAN
-AcpiEvValidGpeEvent (
- ACPI_GPE_EVENT_INFO *GpeEventInfo);
-
-ACPI_STATUS
-AcpiEvWalkGpeList (
- ACPI_GPE_CALLBACK GpeWalkCallback,
- void *Context);
-
-ACPI_STATUS
-AcpiEvDeleteGpeHandlers (
- ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
- ACPI_GPE_BLOCK_INFO *GpeBlock,
- void *Context);
-
ACPI_STATUS
AcpiEvCreateGpeBlock (
ACPI_NAMESPACE_NODE *GpeDevice,
@@ -233,14 +222,57 @@ AcpiEvGpeDispatch (
ACPI_GPE_EVENT_INFO *GpeEventInfo,
UINT32 GpeNumber);
-UINT32
-AcpiEvGpeDetect (
- ACPI_GPE_XRUPT_INFO *GpeXruptList);
-
+/*
+ * evgpeinit - GPE initialization and update
+ */
ACPI_STATUS
AcpiEvGpeInitialize (
void);
+void
+AcpiEvUpdateGpes (
+ ACPI_OWNER_ID TableOwnerId);
+
+ACPI_STATUS
+AcpiEvMatchGpeMethod (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+ACPI_STATUS
+AcpiEvMatchPrwAndGpe (
+ ACPI_HANDLE ObjHandle,
+ UINT32 Level,
+ void *Context,
+ void **ReturnValue);
+
+/*
+ * evgpeutil - GPE utilities
+ */
+ACPI_STATUS
+AcpiEvWalkGpeList (
+ ACPI_GPE_CALLBACK GpeWalkCallback,
+ void *Context);
+
+BOOLEAN
+AcpiEvValidGpeEvent (
+ ACPI_GPE_EVENT_INFO *GpeEventInfo);
+
+ACPI_GPE_XRUPT_INFO *
+AcpiEvGetGpeXruptBlock (
+ UINT32 InterruptNumber);
+
+ACPI_STATUS
+AcpiEvDeleteGpeXrupt (
+ ACPI_GPE_XRUPT_INFO *GpeXrupt);
+
+ACPI_STATUS
+AcpiEvDeleteGpeHandlers (
+ ACPI_GPE_XRUPT_INFO *GpeXruptInfo,
+ ACPI_GPE_BLOCK_INFO *GpeBlock,
+ void *Context);
+
/*
* evregion - Address Space handling
diff --git a/include/acglobal.h b/include/acglobal.h
index 4f0769e6f676..e0f8871fcd09 100644
--- a/include/acglobal.h
+++ b/include/acglobal.h
@@ -216,11 +216,10 @@ ACPI_NAME AcpiGbl_TraceMethodName;
****************************************************************************/
/*
- * AcpiGbl_RootTableList is the master list of ACPI tables found in the
- * RSDT/XSDT.
- *
+ * AcpiGbl_RootTableList is the master list of ACPI tables that were
+ * found in the RSDT/XSDT.
*/
-ACPI_EXTERN ACPI_INTERNAL_RSDT AcpiGbl_RootTableList;
+ACPI_EXTERN ACPI_TABLE_LIST AcpiGbl_RootTableList;
ACPI_EXTERN ACPI_TABLE_FACS *AcpiGbl_FACS;
/* These addresses are calculated from the FADT Event Block addresses */
diff --git a/include/acinterp.h b/include/acinterp.h
index 67142c8911b5..e3fa940a1023 100644
--- a/include/acinterp.h
+++ b/include/acinterp.h
@@ -434,7 +434,7 @@ AcpiExSystemDoNotifyOp (
ACPI_OPERAND_OBJECT *ObjDesc);
ACPI_STATUS
-AcpiExSystemDoSuspend(
+AcpiExSystemDoSleep(
UINT64 Time);
ACPI_STATUS
diff --git a/include/aclocal.h b/include/aclocal.h
index 8818a6ea9b53..1deced01136b 100644
--- a/include/aclocal.h
+++ b/include/aclocal.h
@@ -307,16 +307,16 @@ typedef struct acpi_namespace_node
#define ANOBJ_IS_REFERENCED 0x80 /* iASL only: Object was referenced */
-/* One internal RSDT for table management */
+/* Internal ACPI table management - master table list */
-typedef struct acpi_internal_rsdt
+typedef struct acpi_table_list
{
- ACPI_TABLE_DESC *Tables;
- UINT32 Count;
- UINT32 Size;
+ ACPI_TABLE_DESC *Tables; /* Table descriptor array */
+ UINT32 CurrentTableCount; /* Tables currently in the array */
+ UINT32 MaxTableCount; /* Max tables array will hold */
UINT8 Flags;
-} ACPI_INTERNAL_RSDT;
+} ACPI_TABLE_LIST;
/* Flags for above */
@@ -612,6 +612,10 @@ typedef struct acpi_gpe_walk_info
{
ACPI_NAMESPACE_NODE *GpeDevice;
ACPI_GPE_BLOCK_INFO *GpeBlock;
+ UINT16 Count;
+ ACPI_OWNER_ID OwnerId;
+ BOOLEAN EnableThisGpe;
+ BOOLEAN ExecuteByOwnerId;
} ACPI_GPE_WALK_INFO;
diff --git a/include/acpiosxf.h b/include/acpiosxf.h
index 0c22b63bb693..3a9da6c512e8 100644
--- a/include/acpiosxf.h
+++ b/include/acpiosxf.h
@@ -410,8 +410,8 @@ AcpiOsWritePciConfiguration (
*/
void
AcpiOsDerivePciId(
- ACPI_HANDLE Rhandle,
- ACPI_HANDLE Chandle,
+ ACPI_HANDLE Device,
+ ACPI_HANDLE Region,
ACPI_PCI_ID **PciId);
diff --git a/include/acpixf.h b/include/acpixf.h
index 300b2c73f5fe..0e68fabfeb05 100644
--- a/include/acpixf.h
+++ b/include/acpixf.h
@@ -120,7 +120,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
-#define ACPI_CA_VERSION 0x20100331
+#define ACPI_CA_VERSION 0x20100428
#include "actypes.h"
#include "actbl.h"
@@ -283,7 +283,7 @@ AcpiGetDevices (
ACPI_STATUS
AcpiGetName (
- ACPI_HANDLE Handle,
+ ACPI_HANDLE Object,
UINT32 NameType,
ACPI_BUFFER *RetPathPtr);
@@ -295,18 +295,18 @@ AcpiGetHandle (
ACPI_STATUS
AcpiAttachData (
- ACPI_HANDLE ObjHandle,
+ ACPI_HANDLE Object,
ACPI_OBJECT_HANDLER Handler,
void *Data);
ACPI_STATUS
AcpiDetachData (
- ACPI_HANDLE ObjHandle,
+ ACPI_HANDLE Object,
ACPI_OBJECT_HANDLER Handler);
ACPI_STATUS
AcpiGetData (
- ACPI_HANDLE ObjHandle,
+ ACPI_HANDLE Object,
ACPI_OBJECT_HANDLER Handler,
void **Data);
@@ -338,7 +338,7 @@ AcpiEvaluateObjectTyped (
ACPI_STATUS
AcpiGetObjectInfo (
- ACPI_HANDLE Handle,
+ ACPI_HANDLE Object,
ACPI_DEVICE_INFO **ReturnBuffer);
ACPI_STATUS
@@ -527,36 +527,36 @@ ACPI_STATUS (*ACPI_WALK_RESOURCE_CALLBACK) (
ACPI_STATUS
AcpiGetVendorResource (
- ACPI_HANDLE DeviceHandle,
+ ACPI_HANDLE Device,
char *Name,
ACPI_VENDOR_UUID *Uuid,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
-AcpiGetCurrentResources(
- ACPI_HANDLE DeviceHandle,
+AcpiGetCurrentResources (
+ ACPI_HANDLE Device,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
-AcpiGetPossibleResources(
- ACPI_HANDLE DeviceHandle,
+AcpiGetPossibleResources (
+ ACPI_HANDLE Device,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
AcpiWalkResources (
- ACPI_HANDLE DeviceHandle,
+ ACPI_HANDLE Device,
char *Name,
ACPI_WALK_RESOURCE_CALLBACK UserFunction,
void *Context);
ACPI_STATUS
AcpiSetCurrentResources (
- ACPI_HANDLE DeviceHandle,
+ ACPI_HANDLE Device,
ACPI_BUFFER *InBuffer);
ACPI_STATUS
-AcpiGetIrqRoutingTable (
- ACPI_HANDLE BusDeviceHandle,
+AcpiGetIrqRoutingTable (
+ ACPI_HANDLE Device,
ACPI_BUFFER *RetBuffer);
ACPI_STATUS
diff --git a/include/actypes.h b/include/actypes.h
index 3c0626ab1e35..601e87e908d9 100644
--- a/include/actypes.h
+++ b/include/actypes.h
@@ -1099,7 +1099,7 @@ ACPI_STATUS (*ACPI_ADR_SPACE_SETUP) (
typedef
ACPI_STATUS (*ACPI_WALK_CALLBACK) (
- ACPI_HANDLE ObjHandle,
+ ACPI_HANDLE Object,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
diff --git a/include/amlresrc.h b/include/amlresrc.h
index 9084e44540aa..4cd2617e22b2 100644
--- a/include/amlresrc.h
+++ b/include/amlresrc.h
@@ -300,6 +300,12 @@ typedef struct aml_resource_large_header
} AML_RESOURCE_LARGE_HEADER;
+/* General Flags for address space resource descriptors */
+
+#define ACPI_RESOURCE_FLAG_DEC 2
+#define ACPI_RESOURCE_FLAG_MIF 4
+#define ACPI_RESOURCE_FLAG_MAF 8
+
typedef struct aml_resource_memory24
{
AML_RESOURCE_LARGE_HEADER_COMMON
diff --git a/os_specific/service_layers/osunixxf.c b/os_specific/service_layers/osunixxf.c
index e62ed738be1a..b457745122a1 100644
--- a/os_specific/service_layers/osunixxf.c
+++ b/os_specific/service_layers/osunixxf.c
@@ -986,8 +986,8 @@ AcpiOsWritePciConfiguration (
/* TEMPORARY STUB FUNCTION */
void
AcpiOsDerivePciId(
- ACPI_HANDLE rhandle,
- ACPI_HANDLE chandle,
+ ACPI_HANDLE Device,
+ ACPI_HANDLE Region,
ACPI_PCI_ID **PciId)
{
diff --git a/os_specific/service_layers/oswinxf.c b/os_specific/service_layers/oswinxf.c
index 0f117772eaa6..4c50416267a2 100644
--- a/os_specific/service_layers/oswinxf.c
+++ b/os_specific/service_layers/oswinxf.c
@@ -1234,8 +1234,8 @@ AcpiOsWritePciConfiguration (
/* TEMPORARY STUB FUNCTION */
void
AcpiOsDerivePciId(
- ACPI_HANDLE rhandle,
- ACPI_HANDLE chandle,
+ ACPI_HANDLE Device,
+ ACPI_HANDLE Region,
ACPI_PCI_ID **PciId)
{
diff --git a/osunixxf.c b/osunixxf.c
index e62ed738be1a..b457745122a1 100644
--- a/osunixxf.c
+++ b/osunixxf.c
@@ -986,8 +986,8 @@ AcpiOsWritePciConfiguration (
/* TEMPORARY STUB FUNCTION */
void
AcpiOsDerivePciId(
- ACPI_HANDLE rhandle,
- ACPI_HANDLE chandle,
+ ACPI_HANDLE Device,
+ ACPI_HANDLE Region,
ACPI_PCI_ID **PciId)
{
diff --git a/tables/tbfind.c b/tables/tbfind.c
index e1c110f4523a..4fd988ef9e8d 100644
--- a/tables/tbfind.c
+++ b/tables/tbfind.c
@@ -164,7 +164,7 @@ AcpiTbFindTable (
/* Search for the table */
- for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
+ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if (ACPI_MEMCMP (&(AcpiGbl_RootTableList.Tables[i].Signature),
Header.Signature, ACPI_NAME_SIZE))
diff --git a/tables/tbinstal.c b/tables/tbinstal.c
index 78cf164a99ea..2179b6bf7b70 100644
--- a/tables/tbinstal.c
+++ b/tables/tbinstal.c
@@ -227,7 +227,7 @@ AcpiTbAddTable (
/* Check if table is already registered */
- for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
+ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if (!AcpiGbl_RootTableList.Tables[i].Pointer)
{
@@ -370,7 +370,7 @@ AcpiTbResizeRootTableList (
/* Increase the Table Array size */
Tables = ACPI_ALLOCATE_ZEROED (
- ((ACPI_SIZE) AcpiGbl_RootTableList.Size +
+ ((ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount +
ACPI_ROOT_TABLE_SIZE_INCREMENT) *
sizeof (ACPI_TABLE_DESC));
if (!Tables)
@@ -384,7 +384,7 @@ AcpiTbResizeRootTableList (
if (AcpiGbl_RootTableList.Tables)
{
ACPI_MEMCPY (Tables, AcpiGbl_RootTableList.Tables,
- (ACPI_SIZE) AcpiGbl_RootTableList.Size * sizeof (ACPI_TABLE_DESC));
+ (ACPI_SIZE) AcpiGbl_RootTableList.MaxTableCount * sizeof (ACPI_TABLE_DESC));
if (AcpiGbl_RootTableList.Flags & ACPI_ROOT_ORIGIN_ALLOCATED)
{
@@ -393,7 +393,7 @@ AcpiTbResizeRootTableList (
}
AcpiGbl_RootTableList.Tables = Tables;
- AcpiGbl_RootTableList.Size += ACPI_ROOT_TABLE_SIZE_INCREMENT;
+ AcpiGbl_RootTableList.MaxTableCount += ACPI_ROOT_TABLE_SIZE_INCREMENT;
AcpiGbl_RootTableList.Flags |= (UINT8) ACPI_ROOT_ORIGIN_ALLOCATED;
return_ACPI_STATUS (AE_OK);
@@ -423,12 +423,14 @@ AcpiTbStoreTable (
UINT8 Flags,
UINT32 *TableIndex)
{
- ACPI_STATUS Status = AE_OK;
+ ACPI_STATUS Status;
+ ACPI_TABLE_DESC *NewTable;
/* Ensure that there is room for the table in the Root Table List */
- if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
+ if (AcpiGbl_RootTableList.CurrentTableCount >=
+ AcpiGbl_RootTableList.MaxTableCount)
{
Status = AcpiTbResizeRootTableList();
if (ACPI_FAILURE (Status))
@@ -437,21 +439,21 @@ AcpiTbStoreTable (
}
}
+ NewTable = &AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount];
+
/* Initialize added table */
- 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;
+ NewTable->Address = Address;
+ NewTable->Pointer = Table;
+ NewTable->Length = Length;
+ NewTable->OwnerId = 0;
+ NewTable->Flags = Flags;
- ACPI_MOVE_32_TO_32 (
- &(AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Signature),
- Table->Signature);
+ ACPI_MOVE_32_TO_32 (&NewTable->Signature, Table->Signature);
- *TableIndex = AcpiGbl_RootTableList.Count;
- AcpiGbl_RootTableList.Count++;
- return (Status);
+ *TableIndex = AcpiGbl_RootTableList.CurrentTableCount;
+ AcpiGbl_RootTableList.CurrentTableCount++;
+ return (AE_OK);
}
@@ -523,7 +525,7 @@ AcpiTbTerminate (
/* Delete the individual tables */
- for (i = 0; i < AcpiGbl_RootTableList.Count; i++)
+ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
AcpiTbDeleteTable (&AcpiGbl_RootTableList.Tables[i]);
}
@@ -539,7 +541,7 @@ AcpiTbTerminate (
AcpiGbl_RootTableList.Tables = NULL;
AcpiGbl_RootTableList.Flags = 0;
- AcpiGbl_RootTableList.Count = 0;
+ AcpiGbl_RootTableList.CurrentTableCount = 0;
ACPI_DEBUG_PRINT ((ACPI_DB_INFO, "ACPI Tables freed\n"));
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
@@ -575,7 +577,7 @@ AcpiTbDeleteNamespaceByOwner (
return_ACPI_STATUS (Status);
}
- if (TableIndex >= AcpiGbl_RootTableList.Count)
+ if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
{
/* The table index does not exist */
@@ -634,7 +636,7 @@ AcpiTbAllocateOwnerId (
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.Count)
+ if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
{
Status = AcpiUtAllocateOwnerId
(&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
@@ -668,7 +670,7 @@ AcpiTbReleaseOwnerId (
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.Count)
+ if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
{
AcpiUtReleaseOwnerId (
&(AcpiGbl_RootTableList.Tables[TableIndex].OwnerId));
@@ -705,7 +707,7 @@ AcpiTbGetOwnerId (
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.Count)
+ if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
{
*OwnerId = AcpiGbl_RootTableList.Tables[TableIndex].OwnerId;
Status = AE_OK;
@@ -734,7 +736,7 @@ AcpiTbIsTableLoaded (
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.Count)
+ if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
{
IsLoaded = (BOOLEAN)
(AcpiGbl_RootTableList.Tables[TableIndex].Flags &
@@ -766,7 +768,7 @@ AcpiTbSetTableLoadedFlag (
{
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- if (TableIndex < AcpiGbl_RootTableList.Count)
+ if (TableIndex < AcpiGbl_RootTableList.CurrentTableCount)
{
if (IsLoaded)
{
diff --git a/tables/tbutils.c b/tables/tbutils.c
index eb8bc43597d0..100a91d9e511 100644
--- a/tables/tbutils.c
+++ b/tables/tbutils.c
@@ -184,7 +184,7 @@ AcpiTbTablesLoaded (
void)
{
- if (AcpiGbl_RootTableList.Count >= 3)
+ if (AcpiGbl_RootTableList.CurrentTableCount >= 3)
{
return (TRUE);
}
@@ -765,14 +765,15 @@ AcpiTbParseRootTable (
* come from the FADT
*/
TableEntry = ACPI_CAST_PTR (UINT8, Table) + sizeof (ACPI_TABLE_HEADER);
- AcpiGbl_RootTableList.Count = 2;
+ AcpiGbl_RootTableList.CurrentTableCount = 2;
/*
* Initialize the root table array from the RSDT/XSDT
*/
for (i = 0; i < TableCount; i++)
{
- if (AcpiGbl_RootTableList.Count >= AcpiGbl_RootTableList.Size)
+ if (AcpiGbl_RootTableList.CurrentTableCount >=
+ AcpiGbl_RootTableList.MaxTableCount)
{
/* There is no more room in the root table array, attempt resize */
@@ -781,18 +782,18 @@ AcpiTbParseRootTable (
{
ACPI_WARNING ((AE_INFO, "Truncating %u table entries!",
(unsigned) (TableCount -
- (AcpiGbl_RootTableList.Count - 2))));
+ (AcpiGbl_RootTableList.CurrentTableCount - 2))));
break;
}
}
/* Get the table physical address (32-bit for RSDT, 64-bit for XSDT) */
- AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.Count].Address =
+ AcpiGbl_RootTableList.Tables[AcpiGbl_RootTableList.CurrentTableCount].Address =
AcpiTbGetRootTableEntry (TableEntry, TableEntrySize);
TableEntry += TableEntrySize;
- AcpiGbl_RootTableList.Count++;
+ AcpiGbl_RootTableList.CurrentTableCount++;
}
/*
@@ -805,7 +806,7 @@ AcpiTbParseRootTable (
* Complete the initialization of the root table array by examining
* the header of each table
*/
- for (i = 2; i < AcpiGbl_RootTableList.Count; i++)
+ for (i = 2; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
AcpiTbInstallTable (AcpiGbl_RootTableList.Tables[i].Address,
NULL, i);
diff --git a/tables/tbxface.c b/tables/tbxface.c
index b3e09a0271f6..ba1a026e8688 100644
--- a/tables/tbxface.c
+++ b/tables/tbxface.c
@@ -150,7 +150,7 @@ AcpiAllocateRootTable (
UINT32 InitialTableCount)
{
- AcpiGbl_RootTableList.Size = InitialTableCount;
+ AcpiGbl_RootTableList.MaxTableCount = InitialTableCount;
AcpiGbl_RootTableList.Flags = ACPI_ROOT_ALLOW_RESIZE;
return (AcpiTbResizeRootTableList ());
@@ -216,7 +216,7 @@ AcpiInitializeTables (
(ACPI_SIZE) InitialTableCount * sizeof (ACPI_TABLE_DESC));
AcpiGbl_RootTableList.Tables = InitialTableArray;
- AcpiGbl_RootTableList.Size = InitialTableCount;
+ AcpiGbl_RootTableList.MaxTableCount = InitialTableCount;
AcpiGbl_RootTableList.Flags = ACPI_ROOT_ORIGIN_UNKNOWN;
if (AllowResize)
{
@@ -285,7 +285,7 @@ AcpiReallocateRootTable (
* increment to create the new table size.
*/
CurrentSize = (ACPI_SIZE)
- AcpiGbl_RootTableList.Count * sizeof (ACPI_TABLE_DESC);
+ AcpiGbl_RootTableList.CurrentTableCount * sizeof (ACPI_TABLE_DESC);
NewSize = CurrentSize +
(ACPI_ROOT_TABLE_SIZE_INCREMENT * sizeof (ACPI_TABLE_DESC));
@@ -306,8 +306,8 @@ AcpiReallocateRootTable (
* size of the original table list.
*/
AcpiGbl_RootTableList.Tables = Tables;
- AcpiGbl_RootTableList.Size =
- AcpiGbl_RootTableList.Count + ACPI_ROOT_TABLE_SIZE_INCREMENT;
+ AcpiGbl_RootTableList.MaxTableCount =
+ AcpiGbl_RootTableList.CurrentTableCount + ACPI_ROOT_TABLE_SIZE_INCREMENT;
AcpiGbl_RootTableList.Flags =
ACPI_ROOT_ORIGIN_ALLOCATED | ACPI_ROOT_ALLOW_RESIZE;
@@ -354,7 +354,7 @@ AcpiGetTableHeader (
/* Walk the root table list */
- for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
+ for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
Signature))
@@ -439,7 +439,7 @@ AcpiGetTable (
/* Walk the root table list */
- for (i = 0, j = 0; i < AcpiGbl_RootTableList.Count; i++)
+ for (i = 0, j = 0; i < AcpiGbl_RootTableList.CurrentTableCount; i++)
{
if (!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
Signature))
@@ -502,7 +502,7 @@ AcpiGetTableByIndex (
/* Validate index */
- if (TableIndex >= AcpiGbl_RootTableList.Count)
+ if (TableIndex >= AcpiGbl_RootTableList.CurrentTableCount)
{
(void) AcpiUtReleaseMutex (ACPI_MTX_TABLES);
return_ACPI_STATUS (AE_BAD_PARAMETER);
@@ -559,7 +559,7 @@ AcpiTbLoadNamespace (
* Load the namespace. The DSDT is required, but any SSDT and
* PSDT tables are optional. Verify the DSDT.
*/
- if (!AcpiGbl_RootTableList.Count ||
+ if (!AcpiGbl_RootTableList.CurrentTableCount ||
!ACPI_COMPARE_NAME (
&(AcpiGbl_RootTableList.Tables[ACPI_TABLE_INDEX_DSDT].Signature),
ACPI_SIG_DSDT) ||
@@ -613,7 +613,7 @@ AcpiTbLoadNamespace (
/* Load any SSDT or PSDT tables. Note: Loop leaves tables locked */
(void) AcpiUtAcquireMutex (ACPI_MTX_TABLES);
- for (i = 0; i < AcpiGbl_RootTableList.Count; ++i)
+ for (i = 0; i < AcpiGbl_RootTableList.CurrentTableCount; ++i)
{
if ((!ACPI_COMPARE_NAME (&(AcpiGbl_RootTableList.Tables[i].Signature),
ACPI_SIG_SSDT) &&
diff --git a/tests/misc/badcode.asl b/tests/misc/badcode.asl
new file mode 100644
index 000000000000..36ca0d582f27
--- /dev/null
+++ b/tests/misc/badcode.asl
@@ -0,0 +1,295 @@
+/*
+ * badcode.asl
+ *
+ * This file contains examples of the extended error checking and
+ * typechecking capabilities of the iASL compiler. Other ASL compilers
+ * may ignore these errors completely. Note - this is not an exhaustive
+ * list of errors detected by iASL, it shows many of the errors that
+ * are not detected by other ASL compilers.
+ *
+ * To compile, use:
+ * iasl badcode.asl
+ */
+DefinitionBlock ("badcode.aml", "DSDT", 1, "Intel", "Example", 0x00000001)
+{
+ Name (INT1, 0)
+ Name (BUF1, Buffer() {0,1,2,3})
+ Event (EVT1)
+
+ // Invalid SyncLevel in Mutex declaration
+
+ Mutex (MTX1, 32)
+
+ // Integer beyond the table integer size (32 bits)
+
+ Name (BIG, 0x1234567887654321)
+
+ // CPackage length does not match initializer list length
+
+ Name (PKG1, Package(5) {0,1})
+
+ // Inadvertent use of single backslash in a string
+
+ Name (PATH, Buffer() {"\_SB_.PCI2._CRS"})
+
+ // Invalid hex escape sequence
+
+ Name (ESC1, "abcdefg\x00hijklmn")
+
+ // Field access beyond region bounds
+
+ OperationRegion (OPR1, SystemMemory, 0x2000, 6)
+ Field (OPR1, DWordAcc, NoLock, Preserve)
+ {
+ Offset (4),
+ FLD1, 8
+ }
+
+ // Some address spaces support only ByteAcc or BufferAcc
+
+ OperationRegion (OPR2, EmbeddedControl, 0x4000, 8)
+ Field (OPR2, DWordAcc, NoLock, Preserve)
+ {
+ FLD2, 8
+ }
+ OperationRegion (OPR3, SMBus, 0x8000, 16)
+ Field (OPR3, WordAcc, NoLock, Preserve)
+ {
+ FLD3, 8
+ }
+
+ // Invalid SyncLevel in method declaration
+
+ Method (MTH1, 0, NotSerialized, 32)
+ {
+ // Invalid arguments and uninitialized locals
+
+ Store (Arg3, Local0)
+ Store (Local1, Local2)
+
+ // Parameter typechecking (MTX1 is invalid type)
+
+ Subtract (MTX1, 4, Local3)
+
+ // Various invalid parameters
+
+ CreateField (BUF1, 0, Subtract (4, 4), FLD1)
+
+ // Unchecked mutex and event timeouts
+
+ Acquire (MTX1, 100)
+ Wait (EVT1, 1)
+
+ // Result from operation is not used - statement has no effect
+
+ Add (INT1, 8)
+
+ // Unreachable code
+
+ Return (0)
+ Store (5, INT1)
+ }
+
+ Method (MTH2)
+ {
+ // Switch with no Case statements
+
+ Switch (ToInteger (INT1))
+ {
+ Default
+ {
+ }
+ }
+
+ if (LEqual (INT1, 0))
+ {
+ Return (INT1)
+ }
+
+ // Fallthrough exit path does not return a value
+ }
+
+ Method (MTH3)
+ {
+ // Method MTH2 above does not always return a value
+
+ Store (MTH2 (), Local0)
+ }
+
+ // Invalid _HID value
+
+ Name (_HID, "*PNP0C0A")
+
+ // Predefined Name typechecking
+
+ Name (_PRW, 4)
+ Name (_FDI, Buffer () {0})
+
+ // Predefined Name argument count validation
+ // and return value validation
+
+ Method (_OSC, 5)
+ {
+ }
+
+ // Predefined Names that must be implemented as control methods
+
+ Name (_L01, 1)
+ Name (_E02, 2)
+ Name (_Q03, 3)
+ Name (_ON, 0)
+ Name (_INI, 1)
+ Name (_PTP, 2)
+
+ /*
+ * Resource Descriptor error checking
+ */
+ Name (RSC1, ResourceTemplate ()
+ {
+ // Illegal nested StartDependent macros
+
+ StartDependentFn (0, 0)
+ {
+ StartDependentFn (0, 0)
+ {
+ }
+ }
+
+ // Missing EndDependentFn macro
+ })
+
+ Name (RSC2, ResourceTemplate ()
+ {
+ // AddressMin is larger than AddressMax
+ IO (Decode16,
+ 0x07D0, // Range Minimum
+ 0x03E8, // Range Maximum
+ 0x01, // Alignment
+ 0x20, // Length
+ )
+
+ // Length larger than Min/Max window size
+ Memory32 (ReadOnly,
+ 0x00001000, // Range Minimum
+ 0x00002000, // Range Maximum
+ 0x00000004, // Alignment
+ 0x00002000, // Length
+ )
+
+ // Min and Max not multiples of alignment value
+ Memory32 (ReadOnly,
+ 0x00001001, // Range Minimum
+ 0x00002002, // Range Maximum
+ 0x00000004, // Alignment
+ 0x00000200, // Length
+ )
+
+ // 10-bit ISA I/O address has a max of 0x3FF
+ FixedIO (
+ 0xFFFF, // Address
+ 0x20, // Length
+ )
+
+ // Invalid AccessSize parameter
+ Register (SystemIO,
+ 0x08, // Bit Width
+ 0x00, // Bit Offset
+ 0x0000000000000100, // Address
+ 0x05 // Access Size
+ )
+
+ // Invalid ResourceType (0xB0)
+ QWordSpace (0xB0, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
+ 0x0000, // Granularity
+ 0xA000, // Range Minimum
+ 0xBFFF, // Range Maximum
+ 0x0000, // Translation Offset
+ 0x2000, // Length
+ ,, )
+
+ // AddressMin is larger than AddressMax
+ WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000, // Granularity
+ 0x0200, // Range Minimum
+ 0x0100, // Range Maximum
+ 0x0000, // Translation Offset
+ 0x0100, // Length
+ ,, , TypeStatic)
+
+ // Length larger than Min/Max window size
+ DWordSpace (0xC3, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
+ 0x00000000, // Granularity
+ 0x000C8000, // Range Minimum
+ 0x000C9000, // Range Maximum
+ 0x00000000, // Translation Offset
+ 0x00001002, // Length
+ ,, )
+
+ // Granularity must be (power-of-two -1)
+ DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxNotFixed, NonCacheable, ReadWrite,
+ 0x00000010,
+ 0x40000000,
+ 0xFED9FFFF,
+ 0x00000000,
+ 0xBECA0000)
+
+ // Address Min (with zero length) not on granularity boundary
+ QWordIO (ResourceProducer, MinFixed, MaxNotFixed, PosDecode, EntireRange,
+ 0x0000000000000003, // Granularity
+ 0x0000000000000B02, // Range Minimum
+ 0x0000000000000C00, // Range Maximum
+ 0x0000000000000000, // Translation Offset
+ 0x0000000000000000, // Length
+ ,, , TypeStatic)
+
+ // Address Max (with zero length) not on (granularity boundary -1)
+ QWordMemory (ResourceProducer, PosDecode, MinNotFixed, MaxFixed, Cacheable, ReadWrite,
+ 0x0000000000000001, // Granularity
+ 0x0000000000100000, // Range Minimum
+ 0x00000000002FFFFE, // Range Maximum
+ 0x0000000000000000, // Translation Offset
+ 0x0000000000000000, // Length
+ ,, , AddressRangeMemory, TypeStatic)
+
+ // Invalid combination: zero length, both Min and Max are fixed
+ DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x00000000, // Granularity
+ 0x000C8000, // Range Minimum
+ 0x000C8FFF, // Range Maximum
+ 0x00000000, // Translation Offset
+ 0x00000000, // Length
+ ,, )
+
+ // Invalid combination: non-zero length, Min Fixed, Max not fixed
+ DWordIO (ResourceProducer, MinFixed, MaxNotFixed, PosDecode, EntireRange,
+ 0x00000001, // Granularity
+ 0x000C8000, // Range Minimum
+ 0x000C8FFF, // Range Maximum
+ 0x00000000, // Translation Offset
+ 0x00000100, // Length
+ ,, )
+
+ // Invalid combination: non-zero length, Min not Fixed, Max fixed
+ DWordIO (ResourceProducer, MinNotFixed, MaxFixed, PosDecode, EntireRange,
+ 0x00000001, // Granularity
+ 0x000C8000, // Range Minimum
+ 0x000C8FFF, // Range Maximum
+ 0x00000000, // Translation Offset
+ 0x00000200, // Length
+ ,, )
+
+ // Granularity must be zero if non-zero length, min/max fixed
+ DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000000F, // Granularity
+ 0x000C8000, // Range Minimum
+ 0x000C8FFF, // Range Maximum
+ 0x00000000, // Translation Offset
+ 0x00001000, // Length
+ ,, )
+
+ // Missing StartDependentFn macro
+
+ EndDependentFn ()
+ })
+}
+
diff --git a/tests/misc/grammar.asl b/tests/misc/grammar.asl
new file mode 100644
index 000000000000..8a13fd1a20cf
--- /dev/null
+++ b/tests/misc/grammar.asl
@@ -0,0 +1,10266 @@
+/*
+ * Some or all of this work - Copyright (c) 2006 - 2010, Intel Corp.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification,
+ * are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * Neither the name of Intel Corporation nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+//
+//
+// Grammar.asl - Minimally excercises most ASL constructs
+//
+// NOTE -- use: iasl -f -of grammar.asl to compile
+//
+// This 1) Ignores errors (checks compiler error handling)
+// 2) Disables constant folding
+//
+//
+
+/*******************************************************************************
+Compilation should look like this:
+
+C:\acpica\tests\misc>iasl -f -of grammar.asl
+
+Intel ACPI Component Architecture
+ASL Optimizing Compiler version 20090422 [Apr 22 2009]
+Copyright (C) 2000 - 2009 Intel Corporation
+Supports ACPI Specification Revision 3.0a
+
+grammar.asl 187: Name (_NPK, Package (8)
+Warning 1098 - ^ Unknown reserved name (_NPK)
+
+grammar.asl 510: NAME (ESC1, "abcdefg\x00hijklmn")
+Warning 1042 - ^ Invalid Hex/Octal Escape - Non-ASCII or NULL
+
+grammar.asl 511: NAME (ESC2, "abcdefg\000hijklmn")
+Warning 1042 - ^ Invalid Hex/Octal Escape - Non-ASCII or NULL
+
+grammar.asl 601: Method (RCIV, 1)
+Warning 1087 - ^ Not all control paths return a value (RCIV)
+
+grammar.asl 608: RCIV (Subtract (Arg0, 1))
+Remark 5073 - ^ Recursive method call (RCIV)
+
+grammar.asl 937: Method (_ERR, 2)
+Warning 1077 - ^ Reserved method has too few arguments (_ERR requires 3)
+
+grammar.asl 1377: Store (0x1234567887654321, QWD2)
+Warning 1032 - ^ 64-bit integer in 32-bit table, truncating
+
+grammar.asl 1379: if (LNotEqual (Local0, 0x1234567887654321))
+Warning 1032 - 64-bit integer in 32-bit table, truncating ^
+
+grammar.asl 1459: SizeOf (BUFO)
+Warning 1105 - ^ Result is not used, operator has no effect
+
+grammar.asl 1485: Acquire (MTX2, 1)
+Warning 1104 - ^ Possible operator timeout is ignored
+
+grammar.asl 1633: Add (Local0, Local1)
+Warning 1105 - ^ Result is not used, operator has no effect
+
+grammar.asl 1804: Method (COND)
+Warning 1087 - ^ Not all control paths return a value (COND)
+
+grammar.asl 6010: Name (_HID, "*PNP0A06")
+Error 4001 - ^ String must be entirely alphanumeric (*PNP0A06)
+
+grammar.asl 6461: Name (_CRS, Buffer(26) {"\_SB_.PCI2._CRS..........."})
+Warning 1038 - Invalid or unknown escape sequence ^
+
+grammar.asl 6800: And (Local0, 1, Local0) // Local0 &= 1
+Error 4050 - ^ Method local variable is not initialized (Local0)
+
+grammar.asl 6886: Name (_HID, "*PNP0C0A") // Control Method Battey ID
+Error 4001 - ^ String must be entirely alphanumeric (*PNP0C0A)
+
+ASL Input: grammar.asl - 10254 lines, 322162 bytes, 4810 keywords
+AML Output: grammar.aml - 43392 bytes, 669 named objects, 4141 executable opcodes
+
+Compilation complete. 3 Errors, 12 Warnings, 1 Remarks, 1101 Optimizations
+
+***************************************************************************************************/
+
+DefinitionBlock (
+ "grammar.aml", //Output filename
+ "DSDT", //Signature
+ 0x01, //DSDT Revision ---> 32-bit table
+ "Intel", //OEMID
+ "GRMTEST", //TABLE ID
+ 0x20090511 //OEM Revision
+ )
+{
+
+ External (\ABCD, UnknownObj)
+
+
+ /* Device with _STA and _INI */
+
+ Device (A1)
+ {
+ Method (_STA)
+ {
+ Return (0x0F)
+ }
+
+ Method (_INI)
+ {
+ Return
+ }
+ }
+
+ /* Device with no _STA, has _INI */
+
+ Device (A2)
+ {
+ Method (_INI)
+ {
+ Return
+ }
+ }
+
+ /* Device with _STA, no _INI */
+
+ Device (A3)
+ {
+ Method (_STA)
+ {
+ Return (0x0F)
+ }
+ }
+
+ /* Device with _STA and _INI, but not present */
+
+ Device (A4)
+ {
+ Method (_STA)
+ {
+ Return (Zero)
+ }
+
+ Method (_INI)
+ {
+ Return
+ }
+ }
+
+
+ /* Resource descriptors */
+
+ Device (IRES)
+ {
+ Name (PRT0, ResourceTemplate ()
+ {
+ IRQ (Edge, ActiveHigh, Exclusive) {3,4,5,6,7,9,10,11,14,15}
+
+ StartDependentFn (1,1)
+ {
+ IRQNoFlags () {0,1,2}
+ }
+ EndDependentFn ()
+ })
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Store ("_CRS:", Debug)
+ Store (PRT0, Debug)
+ Return (PRT0)
+ }
+
+ Method (_SRS, 1, Serialized)
+ {
+ Store ("_SRS:", Debug)
+ Store (Arg0, Debug)
+ Return (Zero)
+ }
+ }
+
+ Name (_NPK, Package ()
+ {
+ 0x1111,
+ 0x2222,
+ 0x3333,
+ 0x4444
+ })
+
+
+ Device (RES)
+ {
+ Name (_PRT, Package (0x04)
+ {
+ Package (0x04)
+ {
+ 0x0002FFFF,
+ Zero,
+ Zero,
+ Zero
+ },
+
+ Package (0x04)
+ {
+ 0x0002FFFF,
+ One,
+ Zero,
+ Zero
+ },
+
+ Package (0x04)
+ {
+ 0x000AFFFF,
+ Zero,
+ Zero,
+ Zero
+ },
+
+ Package (0x04)
+ {
+ 0x000BFFFF,
+ Zero,
+ Zero,
+ Zero
+ }
+ })
+
+ Method (_CRS, 0, NotSerialized)
+ {
+ Name (PRT0, ResourceTemplate ()
+ {
+ WordBusNumber (ResourceConsumer, MinFixed, MaxFixed, SubDecode,
+ 0x0000, // Address Space Granularity
+ 0xFFF2, // Address Range Minimum
+ 0xFFF3, // Address Range Maximum
+ 0x0032, // Address Translation Offset
+ 0x0002,,,)
+ WordBusNumber (ResourceProducer, MinFixed, MaxFixed, PosDecode,
+ 0x0000, // Address Space Granularity
+ 0x0000, // Address Range Minimum
+ 0x00FF, // Address Range Maximum
+ 0x0000, // Address Translation Offset
+ 0x0100,,,)
+ WordSpace (0xC3, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
+ 0x0000, // Address Space Granularity
+ 0xA000, // Address Range Minimum
+ 0xBFFF, // Address Range Maximum
+ 0x0000, // Address Translation Offset
+ 0x2000,,,)
+ IO (Decode16, 0x0CF8, 0x0CFF, 0x01, 0x08)
+ WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000, // Address Space Granularity
+ 0x0000, // Address Range Minimum
+ 0x0CF7, // Address Range Maximum
+ 0x0000, // Address Translation Offset
+ 0x0CF8,,,
+ , TypeStatic)
+ WordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000, // Address Space Granularity
+ 0x0D00, // Address Range Minimum
+ 0xFFFF, // Address Range Maximum
+ 0x0000, // Address Translation Offset
+ 0xF300,,,
+ , TypeStatic)
+ DWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x00000000, // Address Space Granularity
+ 0x00000000, // Address Range Minimum
+ 0x00000CF7, // Address Range Maximum
+ 0x00000000, // Address Translation Offset
+ 0x00000CF8,,,
+ , TypeStatic)
+ DWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
+ 0x00000000, // Address Space Granularity
+ 0x000C8000, // Address Range Minimum
+ 0x000EFFFF, // Address Range Maximum
+ 0x00000000, // Address Translation Offset
+ 0x00028000,,,
+ , AddressRangeMemory, TypeStatic)
+ DWordSpace (0xC3, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
+ 0x00000000, // Address Space Granularity
+ 0x000C8000, // Address Range Minimum
+ 0x000EFFFF, // Address Range Maximum
+ 0x00000000, // Address Translation Offset
+ 0x00028000,,,)
+ QWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000000000000000, // Address Space Granularity
+ 0x0000000000000000, // Address Range Minimum
+ 0x0000000000000CF7, // Address Range Maximum
+ 0x0000000000000000, // Address Translation Offset
+ 0x0000000000000CF8, 0x44, "This is a ResouceSource string",
+ , TypeStatic)
+ QWordIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000000000000000, // Address Space Granularity
+ 0x0000000000000000, // Address Range Minimum
+ 0x0000000000000CF7, // Address Range Maximum
+ 0x0000000000000000, // Address Translation Offset
+ 0x0000000000000CF8,,,
+ , TypeStatic)
+ QWordMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
+ 0x0000000000000000, // Address Space Granularity
+ 0x0000000000100000, // Address Range Minimum
+ 0x00000000FFDFFFFF, // Address Range Maximum
+ 0x0000000000000000, // Address Translation Offset
+ 0x00000000FFD00000,,,
+ , AddressRangeMemory, TypeStatic)
+ QWordSpace (0xC3, ResourceConsumer, PosDecode, MinFixed, MaxFixed, 0xA5,
+ 0x0000000000000000, // Address Space Granularity
+ 0x0000000000000000, // Address Range Minimum
+ 0x0000000000000CF7, // Address Range Maximum
+ 0x0000000000000000, // Address Translation Offset
+ 0x0000000000000CF8,,,)
+ ExtendedIO (ResourceProducer, MinFixed, MaxFixed, PosDecode, EntireRange,
+ 0x0000000000000000, // Address Space Granularity
+ 0x0000000000000000, // Address Range Minimum
+ 0x0000000000000CF7, // Address Range Maximum
+ 0x0000000000000000, // Address Translation Offset
+ 0x0000000000000CF8, // Address Length
+ 0x0000000000000000, // Type Specific Attributes
+ , TypeStatic)
+ ExtendedMemory (ResourceProducer, PosDecode, MinFixed, MaxFixed, Cacheable, ReadWrite,
+ 0x0000000000000000, // Address Space Granularity
+ 0x0000000000100000, // Address Range Minimum
+ 0x00000000FFDFFFFF, // Address Range Maximum
+ 0x0000000000000000, // Address Translation Offset
+ 0x00000000FFD00000, // Address Length
+ 0x0000000000000000, // Type Specific Attributes
+ , AddressRangeMemory, TypeStatic)
+ ExtendedSpace (0xC3, ResourceProducer, PosDecode, MinFixed, MaxFixed, 0xA3,
+ 0x0000000000000000, // Address Space Granularity
+ 0x0000000000100000, // Address Range Minimum
+ 0x00000000FFDFFFFF, // Address Range Maximum
+ 0x0000000000000000, // Address Translation Offset
+ 0x00000000FFD00000, // Address Length
+ 0x0000000000000000) // Type Specific Attributes
+ IO (Decode16, 0x0010, 0x0020, 0x01, 0x10)
+ IO (Decode16, 0x0090, 0x00A0, 0x01, 0x10)
+ FixedIO (0x0061, 0x01)
+ IRQNoFlags () {2}
+ DMA (Compatibility, BusMaster, Transfer8_16) {4}
+ DMA (Compatibility, BusMaster, Transfer8) {2,5,7}
+ Memory32Fixed (ReadWrite, 0x00100000, 0x00000000)
+ Memory32Fixed (ReadOnly, 0xFFFE0000, 0x00020000)
+ Memory32 (ReadOnly, 0x00020000, 0xFFFE0000, 0x00000004, 0x00000200)
+ Memory24 (ReadOnly, 0x1111, 0x2222, 0x0004, 0x0200)
+ Interrupt (ResourceConsumer, Level, ActiveLow, Exclusive, 0xE, "\\_SB_.TEST")
+ {
+ 0x00000E01,
+ }
+ Interrupt (ResourceConsumer, Edge, ActiveHigh, Exclusive, 0x6, "xxxx")
+ {
+ 0x00000601,
+ 0x00000003,
+ 0x00000002,
+ 0x00000001,
+ }
+ Interrupt (ResourceProducer, Edge, ActiveHigh, Exclusive)
+ {
+ 0xFFFF0000,
+ 0x00000003,
+ 0x00000002,
+ 0x00000001,
+ 0x00000005,
+ 0x00000007,
+ 0x00000009,
+ }
+ VendorShort () {0x01, 0x02, 0x03}
+ VendorLong ()
+ {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09
+ }
+ Register (SystemIO, 0x08, 0x00, 0x00000000000000B2, , R000)
+ Register (SystemMemory, 0x08, 0x00, 0x00000000000000B2)
+ StartDependentFnNoPri ()
+ {
+ IRQNoFlags () {0,1,2}
+ IRQ (Level, ActiveLow, Shared) {3,4,5,6,7,9,10,11,14,15}
+ }
+ EndDependentFn ()
+ })
+ CreateWordField (PRT0, 0x08, BMIN)
+ CreateByteField (PRT0, R000._ASZ, RSIZ)
+ Store (0x03, BMIN)
+ Return (PRT0)
+ }
+
+ Method (_PRS, 0, NotSerialized)
+ {
+ Name (BUF0, ResourceTemplate ()
+ {
+ StartDependentFn (0x01, 0x02)
+ {
+ IO (Decode16, 0x03D8, 0x03F8, 0x01, 0x08)
+ IRQNoFlags () {4}
+ }
+ StartDependentFn (0x02, 0x01)
+ {
+ IO (Decode16, 0x03D8, 0x03E8, 0x01, 0x08)
+ IRQNoFlags () {4}
+ }
+ StartDependentFn (0x00, 0x02)
+ {
+ IO (Decode16, 0x02E8, 0x02F8, 0x01, 0x08)
+ IRQNoFlags () {3}
+ }
+ StartDependentFn (0x00, 0x02)
+ {
+ IO (Decode16, 0x02D8, 0x02E8, 0x01, 0x08)
+ IRQNoFlags () {3}
+ }
+ StartDependentFn (0x02, 0x00)
+ {
+ IO (Decode16, 0x0100, 0x03F8, 0x08, 0x08)
+ IRQNoFlags () {1,3,4,5,6,7,8,10,11,12,13,14,15}
+ }
+ EndDependentFn ()
+ })
+ Return (BUF0)
+ }
+
+ Method (_SRS, 1, Serialized)
+ {
+ Return (Zero)
+ }
+ }
+
+
+ Name(\_S0,Package(0x04){
+ 0x00,
+ 0x00,
+ 0x00,
+ 0x00
+ })
+ Name(\_S3,Package(0x04){
+ 0x05,
+ 0x05,
+ 0x00,
+ 0x00
+ })
+ Name(\_S4,Package(0x04){
+ 0x06,
+ 0x06,
+ 0x00,
+ 0x00
+ })
+ Name(\_S5,Package(0x04){
+ 0x07,
+ 0x07,
+ 0x00,
+ 0x00
+ })
+
+/* Examine this table header (DSDT) */
+
+/*
+ DataTableRegion (HDR, "DSDT", "", "")
+ Field (HDR, AnyAcc, NoLock, Preserve)
+ {
+ SIG, 32,
+ LENG, 32,
+ REV, 8,
+ SUM, 8,
+ OID, 48,
+ OTID, 64,
+ OREV, 32,
+ CID, 32,
+ CREV, 32
+ }
+
+ Method (SIZE)
+ {
+ If (LLess (REV, 2))
+ {
+ Store ("32-bit table", Debug)
+ }
+ else
+ {
+ Store ("64-bit table", Debug)
+ }
+ Return (0)
+ }
+
+*/
+ Name (SIZE, 0)
+
+ /* Custom operation region */
+
+ OperationRegion(MYOP,0x80,0xFD60,0x6)
+ Field(MYOP,ByteAcc,NoLock,Preserve)
+ {
+ MFLD,8
+ }
+
+ Method (TCOP)
+ {
+ Name (_STR, Unicode ("test"))
+ Store (4, MFLD)
+ Store (MFLD, Local0)
+ }
+
+ Name (ERRS, 0x0)
+
+ /* Warning should be issued for premature string termination */
+
+ NAME (ESC1, "abcdefg\x00hijklmn")
+ NAME (ESC2, "abcdefg\000hijklmn")
+ Name (ESC3, "abc\a\bdef\f\n\r\t\v\x03ffff\432")
+
+
+ Name(CRSA,ResourceTemplate()
+ {
+ WORDBusNumber(ResourceProducer,MinFixed,MaxFixed,PosDecode,0x0000,0x0019,0x001D,0x0000,0x0005)
+ WORDIO(ResourceProducer,MinFixed,MaxFixed,PosDecode,NonISAOnlyRanges,0x0000,0xC000,0xCFFF,0x0000,0x1000)
+ DWORDMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,NonCacheable,ReadWrite,0x00000000,0xD8000000,0xDBFFFFFF,0x00000000,0x04000000)
+
+ })
+ Name(CRSB,ResourceTemplate()
+ {
+ DWORDMemory(ResourceProducer,PosDecode,MinFixed,MaxFixed,NonCacheable,ReadWrite,0x00000000,0xD8000000,0xDBFFFFFF,0x00000000,0x04000000)
+
+ })
+
+ Name(CRSC,ResourceTemplate()
+ {
+ VendorShort () {0x1, 0x2, 0x3}
+ })
+ Name(CRSD,ResourceTemplate()
+ {
+ VendorLong (VNDL) {0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8, 0x9}
+ })
+
+ Name(CRSE,ResourceTemplate()
+ {
+ IRQNoFlags(){3,4,10,11}
+ IRQNoFlags(xxxt){3,4,10,11}
+ })
+ Name(CRSR, Buffer (Add (SizeOf(CRSA),SizeOf(CRSB))){})
+ Method(_CRS,0,NotSerialized)
+ {
+ Return(CRSR)
+ }
+
+
+ //
+ // Unnamed scope
+ //
+ Scope (\)
+ {
+ Name(Bxxx,0xFFFFFFFF)
+ }
+
+ Name (LANS, 0x0)
+
+ PowerResource(LANP,1,0)
+ {
+ Method(_STA){
+ If(LEqual(And(LANS,0x30),0x30)){
+ Return(One)
+ } Else {
+ Return(Zero)
+ }
+ }
+ Method(_ON){
+ If(LNot(_STA())){
+ Store (0x30, LANS)
+ }
+ }
+ Method(_OFF){
+ If(_STA()){
+ Store (0, LANS)
+ }
+ }
+ }
+
+
+ /* Can a method define another method? */
+
+ /**********************************
+ Method (TASK, 2, SERIALIZED)
+ {
+ Sleep (100)
+
+ Method (TAS2)
+ {
+ Sleep (100)
+ }
+
+ TAS2()
+ Return
+
+ }
+ ************************************/
+
+ /* A recursive method */
+
+ Method (RCIV, 1)
+ {
+ Store (Arg0, Debug)
+ If (Lequal (Arg0, 0))
+ {
+ Return ()
+ }
+ RCIV (Subtract (Arg0, 1))
+ }
+
+ Method (RTOP)
+ {
+ RCIV (100)
+ }
+
+
+ Scope(\_PR)
+ {
+ Processor(CPU0,0x0,0xFFFFFFFF,0x0) {}
+ }
+
+ Name(B1TP,0xFFFFFFFF)
+
+ Name(B2TP,0xFFFFFFFF)
+ Name(ADPS,0xFFFFFFFF)
+ Name(B1PS,0xFFFFFFFF)
+ Name(B1RS,0xFFFFFFFF)
+ Name(B1CS,0xFFFFFFFF)
+ Name(B2PS,0xFFFFFFFF)
+ Name(B2RS,0xFFFFFFFF)
+ Name(B2CS,0xFFFFFFFF)
+ Name(B1DC,3000)
+ Name(B2DC,2600)
+ Name(B1LF,3000)
+ Name(B2LF,2600)
+ Name(BPIF,0)
+ Name(PBLL,0)
+
+ Name(RBIF,Package()
+ {
+ 0x1,
+ 2200,
+ 2200,
+ 0x1,
+ 10800,
+ 0,
+ 0,
+ 1,
+ 1,
+ "CA54200-5003/5",
+ "1",
+ "LION",
+ "Fujitsu"
+ })
+
+ Method(SMWE, 4)
+ {
+ return(ONES)
+ }
+
+ Method(SMRE, 4)
+ {
+ return(ONES)
+ }
+
+/*
+ Method(RDBT,0,Serialized){
+ If(LNot(SMWE(0x09,0x15,1,1))){
+ Store(0x18,Local2)
+ }
+ }
+*/
+ Scope(_SB)
+ {
+
+ Name (SBUF, Buffer (128) {})
+
+ CreateBitField (SBUF, 3, BITY)
+ CreateByteField (SBUF, 1, BYTY)
+ CreateWordField (SBUF, 2, WRDZ)
+ CreateDwordField (SBUF, 4, DWDZ)
+ CreateQwordField (SBUF, 8, QWDZ)
+ CreateField (SBUF, 128, 12, FLDZ)
+ CreateField (SBUF, 148, 96, FLDY)
+ CreateField (SBUF, 148, 96, \_SB_.FLDW)
+
+ Method (_INI)
+ {
+ CreateField (\_SB_.SBUF, 148, 96, FLDV)
+ }
+
+
+ Device(PCI0)
+ {
+ Name(_HID,EISAID("PNP0A03"))
+ Name(_ADR,0x0)
+
+ Method(_CRS)
+ {
+ Name(PRT0, ResourceTemplate() {
+ WORDBusNumber( // Bus number resource(0)
+ ResourceConsumer, // bit 0 of general flags is 1
+ MinFixed, // Range is notfixed
+ MaxFixed, // Range is not fixed
+ SubDecode, // SubDecode
+ 0x0000, // Granularity
+ 0xfff1, // Min
+ 0xfff2, // Max
+ 0x0032, // Translation
+ 0x0002,,, // Range Length
+ BUS0
+ ) } )// PRT0
+
+ CreateWordField(PRT0, BUS0._MIN, BMIN) //Minimum bus number suported under this bridge.
+
+ Store(3, BMIN)
+ Return(PRT0)
+
+ } // _CRS
+
+ Method(_SRS)
+ {
+ Return ()
+ }
+
+ Device(EIO)
+ {
+ OperationRegion(FJIO,SystemIO,0xFD60,0x6)
+ Field(FJIO,ByteAcc,NoLock,Preserve)
+ {
+ GIDX,8,
+
+ GDTA,8,
+
+ PIDX,8,
+
+ PDTA,8,
+
+ SIDX,8,
+
+ SDTA,8
+ }
+ IndexField(GIDX,GDTA,ByteAcc,NoLock,Preserve)
+ {
+ Offset(0x2),
+ ,5,
+ VGAS,2,
+ Offset(0x4),
+ ,4,
+ DCKE,1,
+ Offset(0x5),
+ ,6,
+ ACPW,1,
+
+ Offset(0xA),
+ B1P,1,
+
+ B2P,1,
+
+ B1C,1,
+
+ B2C,1,
+
+ B1ER,1,
+
+ B2ER,1,
+
+ Offset(0xB),
+ B1CP,8,
+
+ B2CP,8,
+
+ BCP,8,
+
+ B1VH,8,
+
+ B1VL,8,
+
+ B2VH,8,
+
+ B2VL,8,
+
+ B1TM,8,
+
+ B2TM,8,
+
+ B1CH,8,
+
+ B1CL,8,
+
+ B2CH,8,
+
+ B2CL,8
+ }
+ }
+ }
+ }
+
+ Method(RDBT,3,Serialized){
+ Store(0x1FFF,Local1)
+ If( Arg0 ){
+ Store(0x2FFF,Local1)
+ }
+ Store(0x18,Local2)
+ If( Arg1 ){
+ Store(0x10,Local2)
+ }
+ If(LNot(SMRE(0x09,0x15,1,RefOf(Local0)))){
+ If(LNot(SMWE(0x08,0x14,1,Local1))){
+ If(LNot(SMRE(0x09,0x17,Local2,RefOf(Local3)))){
+ Store(Local1,Arg2)
+ }
+ }
+ Or(Local0,0xFFF,Local0)
+ SMWE(0x08,0x14,1,Local0)
+ }
+ }
+ Method(MKWD,2)
+ {
+ If(And(Arg1,0x80)) {
+ Or(0xFFFF0000,Arg0,Local0)
+ Or(Local0,ShiftLeft(Arg1,8),Local0)
+ Subtract(Zero,Local0,Local0)
+ } else {
+ Store(Arg0,Local0)
+ Or(Local0,ShiftLeft(Arg1,8),Local0)
+ }
+ Return(Local0)
+ }
+
+ Device(CMB1)
+ {
+ Name(_HID,EISAID("PNP0C0A"))
+ Name(_UID,0x1)
+ Alias(\_SB.PCI0.EIO.B1P,\_SB_.PCI0.XXXX)
+ Alias(\_SB.PCI0.EIO.B1P,B1P)
+ Alias(\_SB.PCI0.EIO.B1C,B1C)
+ Alias(\_SB.PCI0.EIO.B1CH,B1CH)
+ Alias(\_SB.PCI0.EIO.B1CL,B1CL)
+ Alias(\_SB.PCI0.EIO.B1VH,B1VH)
+ Alias(\_SB.PCI0.EIO.B1VL,B1VL)
+ Alias(\_SB.PCI0.EIO.B1CP,B1CP)
+
+ Method(_INI)
+ {
+ Store(B1P, B1PS)
+ Store(B1CP,B1RS)
+ Store(B1C, B1CS)
+ }
+
+ Method(_BIF){
+ RDBT(Zero,Zero,RefOf(B1DC))
+ RDBT(Zero,One,RefOf(B1LF))
+ Store(B1DC,Index(RBIF,1))
+ Store(B1LF,Index(RBIF,2))
+ Store("CA54200-5003/5",Index(RBIF,9))
+ Store("1",Index(RBIF,10))
+ Return(RBIF)
+ }
+
+ Method(_BST) {
+
+ _INI()
+
+ Store(Zero,Local0)
+
+ if (LAnd(B1P,LNot(B1C))){
+ Or(Local0,1,Local0)
+ }
+
+ if (LAnd(B1P,B1C)) {
+ Or(Local0,2,Local0)
+ }
+
+ if (LLessEqual(B1CP,1)) {
+ Or(Local0,4,Local0)
+ }
+
+ Store(MKWD(B1CL,B1CH),Local1)
+
+ Store(Divide(Add(Multiply(B1CP,B1LF),99),100),Local2)
+
+ Store(MKWD(B1VL,B1VH),Local3)
+
+ Name(STAT,Package(4){})
+ Store(Local0,Index(STAT,0))
+ Store(Local1,Index(STAT,1))
+ Store(Local2,Index(STAT,2))
+ Store(Local3,Index(STAT,3))
+
+ If(LNot(BPIF)){
+// \_SB.PCI0.EIO.EC0.IECT()
+// \_SB.PCI0.EIO.EC0.SECT()
+ Store(One,BPIF)
+ }
+ return(STAT)
+ }
+
+ }
+
+ Device (DEV1)
+ {
+ }
+
+ Scope(\_TZ)
+ {
+ ThermalZone(TZ1)
+ {
+ Name(_PSL,Package()
+ {
+ \_PR.CPU0
+ })
+ }
+ }
+
+ Method (TZ2, 0, SERIALIZED)
+ {
+ Name(_PSL,Package()
+ {
+ \_PR.CPU0
+ })
+
+ Return (_PSL)
+ }
+
+ ThermalZone (THM1)
+ {
+ }
+
+ Method (NOTI)
+ {
+ Notify (\DEV1, 0)
+ Notify (\THM1, 0)
+ Notify (\_PR.CPU0, 0)
+ }
+
+ Method (_ERR, 2)
+ {
+ Increment (ERRS)
+ Store ("Run-time exception:", Debug)
+ Store (Arg0, Debug)
+ Store (Arg1, Debug)
+
+ Return (0) // Map error to AE_OK
+ }
+
+ Method (DIV0)
+ {
+ Store (1, Local0)
+ Store (0, Local1)
+ Divide (Local0, Local1, Local3)
+
+ Store ("DIV0 - noabort", Debug)
+ }
+
+ Method (ERR_, 1)
+ {
+ if (LEqual (Arg0, 0))
+ {
+ Store ("+*+*+*+* MTHD_ERROR: Results not equal!", Debug)
+ }
+ if (LEqual (Arg0, 1))
+ {
+ Store ("+*+*+*+* MTHD_ERROR: Numeric result is incorrect!", Debug)
+ }
+ if (LEqual (Arg0, 2))
+ {
+ Store ("+*+*+*+* MTHD_ERROR: Operand was clobbered!", Debug)
+ }
+
+ Notify (DEV1, Arg0)
+ Increment (ERRS)
+ }
+
+ Method (R226, 2)
+ {
+ }
+ Method (R225, 2)
+ {
+ R226 (Arg0, Arg1)
+ }
+ Method (R224, 2)
+ {
+ R225 (Arg1, Arg0)
+ }
+ Method (R223, 2)
+ {
+ R224 (Arg0, Arg1)
+ }
+ Method (R222, 2)
+ {
+ R223 (Arg1, Arg0)
+ }
+ Method (R111)
+ {
+ Store (0x01010101, Local0)
+ R222 (0xABAB, Local0)
+ Store (Local0, Local1)
+ }
+
+ Method (MAIN)
+ {
+
+// SIZE()
+ Store (NUM1(), Local0)
+ \CMB1._BST()
+ RDBT(1,2,3)
+ OBJ1(1)
+ OBJ2(2)
+ CHEK()
+ RETZ()
+ BITZ()
+ LOGS()
+ REFS()
+ COND()
+ TZ2()
+
+ //
+ // iPCO tests added
+ //
+ Store (\IFEL.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\NOSV.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\IDXF.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.NSTL.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\RTBF.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.RTLV.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.RETP.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\WHLR.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\ANDO.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\BRKP.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\ADSU.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\INDC.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\LOPS.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\FDSO.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\MLDV.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\NBIT.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\SHFT.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\XORD.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\CRBF.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\IDX4.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\EVNT.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\SZLV.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.BYTF.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\DWDF.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\DVAX.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\IDX6.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\IDX5.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.IDX0.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.IDX3.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\IDX7.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\MTCH.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\WHLB.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.IDX2.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\SIZO.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ Store (\_SB_.SMIS.TEST(), Local0)
+ if (LGreater (Local0, 0))
+ {
+ ERR_ (1)
+ Return(Local0)
+ }
+
+ if (LGreater (ERRS, 0))
+ {
+ Store ("****** There were errors during the execution of the test ******", Debug)
+ }
+
+ //
+ // Last Test
+ //
+
+ Return(0) // Success
+ }
+
+
+ Method (OBJ1, 1, SERIALIZED)
+ {
+
+ Store (3, Local0)
+ Name(BUFR, Buffer (Local0) {})
+ Name(BUF1, Buffer (4) {1,2,3,4})
+ Name(BUF2, Buffer (4) {})
+
+ Store (BUF1, BUF2)
+ Mutex (MTX1, 4)
+
+ Alias (MTX1, MTX2)
+ }
+
+
+ Mutex (MTXT, 0)
+ Mutex (MTXX, 0)
+
+ /*
+ * Field Creation
+ */
+
+ Method (FLDS)
+ {
+ Store ("++++++++ Creating BufferFields", Debug)
+ Name (BUF2, Buffer (128) {})
+
+ CreateBitField (BUF2, 3, BIT2)
+ CreateByteField (BUF2, 1, BYT2)
+ CreateWordField (BUF2, 2, WRD2)
+ CreateDwordField (BUF2, 4, DWD2)
+ CreateQwordField (BUF2, 8, QWD2)
+ CreateField (BUF2, 128, 12, FLD2)
+ CreateField (BUF2, 148, 96, FLD3)
+
+ Store (0x1, BIT2)
+ Store (BIT2, Local0)
+ if (LNotEqual (Local0, 0x1))
+ {
+ ERR_ (1)
+ }
+ else
+ {
+ Store (DerefOf (Index (BUF2, 0)), Local0)
+ if (LNotEqual (Local0, 0x08))
+ {
+ ERR_ (1)
+ }
+ else
+ {
+ Store ("++++++++ Bit BufferField I/O PASS", Debug)
+ }
+ }
+
+ Store (0x1A, BYT2)
+ Store (BYT2, Local0)
+ if (LNotEqual (Local0, 0x1A))
+ {
+ ERR_ (1)
+ }
+ else
+ {
+ Store ("++++++++ Byte BufferField I/O PASS", Debug)
+ }
+
+ Store (0x1234, WRD2)
+ Store (WRD2, Local0)
+ if (LNotEqual (Local0, 0x1234))
+ {
+ ERR_ (1)
+ }
+ else
+ {
+ Store ("++++++++ Word BufferField I/O PASS", Debug)
+ }
+
+ Store (0x123, FLD2)
+ Store (FLD2, Local0)
+ if (LNotEqual (Local0, 0x123))
+ {
+ ERR_ (1)
+ }
+ else
+ {
+ Store ("++++++++ 12-bit BufferField I/O PASS", Debug)
+ }
+
+ Store (0x12345678, DWD2)
+ Store (DWD2, Local0)
+ if (LNotEqual (Local0, 0x12345678))
+ {
+ ERR_ (1)
+ }
+ else
+ {
+ Store ("++++++++ Dword BufferField I/O PASS", Debug)
+ }
+
+ Store (0x1234567887654321, QWD2)
+ Store (QWD2, Local0)
+ if (LNotEqual (Local0, 0x1234567887654321))
+ {
+ ERR_ (1)
+ }
+ else
+ {
+ Store ("++++++++ Qword BufferField I/O PASS", Debug)
+ }
+ }
+
+
+ /* Field execution */
+
+ Method (FLDX)
+ {
+ Field (\_SB_.MEM.SMEM, AnyAcc, NoLock, Preserve)
+ { // Field: SMEM overlay using 32-bit field elements
+ SMD0, 32, // 32-bits
+ SMD1, 32, // 32-bits
+ SMD2, 32, // 32-bits
+ SMD3, 32 // 32-bits
+ } // Field: SMEM overlay using 32-bit field elements
+ Field (\_SB_.MEM.SMEM, AnyAcc, NoLock, Preserve)
+ { // Field: SMEM overlay using greater than 32-bit field elements
+ SME0, 69, // larger than an integer (32 or 64)
+ SME1, 97 // larger than an integer
+ } // Field: SMEM overlay using greater than 32-bit field elements
+ }
+
+
+ Method (MTX_, )
+ {
+ /* Test "Force release" of mutex on method exit */
+
+ Acquire (MTXT, 0xFFFF)
+ Acquire (MTXX, 0xFFFF)
+
+ Store ("++++++++ Acquiring Mutex MTX2", Debug)
+ Acquire (_GL_, 0xFFFF)
+
+
+ Store ("++++++++ Releasing Mutex MTX2", Debug)
+ Release (_GL_)
+ }
+
+
+ Method (OBJ2, 1)
+ {
+ Store ("++++++++ Creating Buffer BUFO", Debug)
+ Name (BUFO, Buffer (32) {})
+
+ Store ("++++++++ Creating OpRegion OPR2", Debug)
+ OperationRegion (OPR2, SystemMemory, Arg0, 256)
+
+ Store ("++++++++ Creating Field(s) in OpRegion OPR2", Debug)
+ Field (OPR2, ByteAcc, NoLock, Preserve)
+ {
+ IDX2, 8,
+ DAT2, 8,
+ BNK2, 4
+ }
+
+ Store ("++++++++ Creating BankField BNK2 in OpRegion OPR2", Debug)
+ //
+ // mcw 3/20/00 - changed FET0, 4, FET1, 3 to FET0, 1, FET1, 1
+ //
+ BankField (OPR2, BNK2, 0, ByteAcc, NoLock, Preserve)
+ {
+ FET0, 4,
+ FET1, 3
+ }
+
+ Store ("++++++++ Creating IndexField", Debug)
+ IndexField (IDX2, DAT2, ByteAcc, NoLock, Preserve)
+ {
+ FET2, 4,
+ FET3, 3
+ }
+
+ Store ("++++++++ SizeOf (BUFO)", Debug)
+ SizeOf (BUFO)
+
+ Store ("++++++++ Store (SizeOf (BUFO), Local0)", Debug)
+ Store (SizeOf (BUFO), Local0)
+
+ Store ("++++++++ Concatenate (\"abd\", \"def\", Local0)", Debug)
+ Concatenate ("abd", "def", Local0)
+ Store (Local0, Debug)
+
+ Store ("++++++++ Concatenate (\"abd\", 0x7B, Local0)", Debug)
+ Concatenate ("abd", 0x7B, Local0)
+ Store (Local0, Debug)
+
+ Store ("++++++++ Creating Event EVT2", Debug)
+ Event (EVT2)
+
+ Store ("++++++++ Creating Mutex MTX2", Debug)
+ Mutex (MTX2, 0)
+
+ Store ("++++++++ Creating Alias MTXA to MTX2", Debug)
+ Alias (MTX2, MTXA)
+
+ Store ("++++++++ Acquiring Mutex MTX2", Debug)
+ Acquire (MTX2, 0xFFFF)
+
+ Store ("++++++++ Acquiring Mutex MTX2 (2nd acquire)", Debug)
+ Acquire (MTX2, 1)
+
+ Store ("++++++++ Releasing Mutex MTX2", Debug)
+ Release (MTX2)
+
+ // Type 1 opcodes
+
+ Store ("++++++++ Signalling Event EVT2", Debug)
+ Signal (EVT2)
+
+ Store ("++++++++ Resetting Event EVT2", Debug)
+ Reset (EVT2)
+
+ Store ("++++++++ Signalling Event EVT2", Debug)
+ Signal (EVT2)
+
+ Store ("++++++++ Waiting Event EVT2", Debug)
+ Wait (EVT2, 0xFFFF)
+
+ Store ("++++++++ Sleep", Debug)
+ Sleep (100)
+
+ Store ("++++++++ Stall", Debug)
+ Stall (254)
+
+ Store ("++++++++ NoOperation", Debug)
+ Noop
+
+ // Type 2 Opcodes
+
+ Store ("++++++++ Return from Method OBJ2", Debug)
+ return (4)
+ }
+
+
+ Method (NUM1, 0)
+ {
+ /* ADD */
+
+ Store ("++++++++ Add (0x12345678, 0x11111111, Local0)", Debug)
+ Add (0x12345678, 0x11111111, Local0)
+
+ Store ("++++++++ Store (Add (0x12345678, 0x11111111), Local1)", Debug)
+ Store (Add (0x12345678, 0x11111111), Local1)
+
+ Store ("++++++++ Checking result from ADD", Debug)
+ if (LNotEqual (Local0, Local1))
+ {
+ ERR_ (0)
+ }
+
+
+ /* SUBTRACT */
+
+ Store ("++++++++ Subtract (0x87654321, 0x11111111, Local4)", Debug)
+ Subtract (0x87654321, 0x11111111, Local4)
+
+ Store ("++++++++ Store (Subtract (0x87654321, 0x11111111), Local5)", Debug)
+ Store (Subtract (0x87654321, 0x11111111), Local5)
+
+ Store ("++++++++ Checking result from SUBTRACT", Debug)
+ if (LNotEqual (Local4, Local5))
+ {
+ ERR_ (0)
+ }
+
+
+ /* MULTIPLY */
+
+ Store ("++++++++ Multiply (33, 10, Local6)", Debug)
+ Multiply (33, 10, Local6)
+
+ Store ("++++++++ Store (Multiply (33, 10), Local7)", Debug)
+ Store (Multiply (33, 10), Local7)
+
+
+ Store ("++++++++ Checking result from MULTIPLY", Debug)
+ if (LNotEqual (Local6, Local7))
+ {
+ ERR_ (0)
+ }
+
+
+ /* DIVIDE */
+
+ Store ("++++++++ Divide (100, 9, Local1, Local2)", Debug)
+ Divide (100, 9, Local1, Local2)
+
+ Store ("++++++++ Store (Divide (100, 9), Local3)", Debug)
+ Store (Divide (100, 9), Local3)
+
+ Store ("++++++++ Checking (quotient) result from DIVIDE", Debug)
+ if (LNotEqual (Local2, Local3))
+ {
+ ERR_ (0)
+ }
+
+
+ /* INCREMENT */
+
+ Store ("++++++++ Increment (Local0)", Debug)
+ Store (1, Local0)
+ Store (2, Local1)
+ Increment (Local0)
+
+ Store ("++++++++ Checking result from INCREMENT", Debug)
+ if (LNotEqual (Local0, Local1))
+ {
+ ERR_ (0)
+ }
+
+
+ /* DECREMENT */
+
+ Store ("++++++++ Decrement (Local0)", Debug)
+ Store (2, Local0)
+ Store (1, Local1)
+ Decrement (Local0)
+
+ Store ("++++++++ Checking result from DECREMENT", Debug)
+ if (LNotEqual (Local0, Local1))
+ {
+ ERR_ (0)
+ }
+
+
+ /* TOBCD */
+ /* FROMBCD */
+
+ Store ("++++++++ ToBCD (0x1234, Local5)", Debug)
+ ToBCD (0x1234, Local5)
+
+ Store ("++++++++ FromBCD (Local5, Local6)", Debug)
+ FromBCD (Local5, Local6)
+
+ Store ("++++++++ Return (Local6)", Debug)
+ Return (Local6)
+ }
+
+
+ Method (CHEK)
+ {
+
+ Store (3, Local0)
+ Store (3, Debug)
+ Store (Local0, Debug)
+ Store (7, Local1)
+
+ Add (Local0, Local1)
+ if (LNotEqual (Local0, 3))
+ {
+ ERR_ (2)
+ }
+ if (LNotEqual (Local1, 7))
+ {
+ ERR_ (2)
+ }
+
+
+ Add (Local0, Local1, Local2)
+ if (LNotEqual (Local0, 3))
+ {
+ ERR_ (2)
+ }
+ if (LNotEqual (Local1, 7))
+ {
+ ERR_ (2)
+ }
+ }
+
+
+ Method (RET1)
+ {
+ Store (3, Local0)
+ Return (Local0)
+ }
+
+ Method (RET2)
+ {
+ Return (RET1())
+ }
+
+ Method (RETZ)
+ {
+ RET2 ()
+ }
+
+
+ Method (BITZ)
+ {
+ Store ("++++++++ FindSetLeftBit (0x00100100, Local0)", Debug)
+ FindSetLeftBit (0x00100100, Local0)
+ if (LNotEqual (Local0, 21))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ FindSetRightBit (0x00100100, Local1)", Debug)
+ FindSetRightBit (0x00100100, Local1)
+ if (LNotEqual (Local1, 9))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ And (0xF0F0F0F0, 0x11111111, Local2)", Debug)
+ And (0xF0F0F0F0, 0x11111111, Local2)
+ if (LNotEqual (Local2, 0x10101010))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ NAnd (0xF0F0F0F0, 0x11111111, Local3)", Debug)
+ NAnd (0xF0F0F0F0, 0x11111111, Local3)
+ if (LNotEqual (Local3, 0xEFEFEFEF))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ Or (0x11111111, 0x22222222, Local4)", Debug)
+ Or (0x11111111, 0x22222222, Local4)
+ if (LNotEqual (Local4, 0x33333333))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ NOr (0x11111111, 0x22222222, Local5)", Debug)
+ NOr (0x11111111, 0x22222222, Local5)
+ if (LNotEqual (Local5, 0xCCCCCCCC))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ XOr (0x11113333, 0x22222222, Local6)", Debug)
+ XOr (0x11113333, 0x22222222, Local6)
+ if (LNotEqual (Local6, 0x33331111))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ ShiftLeft (0x11112222, 2, Local7)", Debug)
+ ShiftLeft (0x11112222, 2, Local7)
+ if (LNotEqual (Local7, 0x44448888))
+ {
+ ERR_ (1)
+ }
+
+ Store ("++++++++ ShiftRight (Local7, 2, Local7)", Debug)
+ ShiftRight (Local7, 2, Local7)
+ if (LNotEqual (Local7, 0x11112222))
+ {
+ ERR_ (1)
+ }
+
+
+ Store ("++++++++ Not (Local0, Local1)", Debug)
+ Store (0x22224444, Local0)
+ Not (Local0, Local1)
+ if (LNotEqual (Local0, 0x22224444))
+ {
+ ERR_ (2)
+ }
+
+ if (LNotEqual (Local1, 0xDDDDBBBB))
+ {
+ ERR_ (1)
+ }
+
+ Return (Local7)
+ }
+
+
+ Method (LOGS)
+ {
+
+ Store ("++++++++ Store (LAnd (0xFFFFFFFF, 0x11111111), Local0)", Debug)
+ Store (LAnd (0xFFFFFFFF, 0x11111111), Local0)
+
+ Store ("++++++++ Store (LEqual (0xFFFFFFFF, 0x11111111), Local)", Debug)
+ Store (LEqual (0xFFFFFFFF, 0x11111111), Local1)
+
+ Store ("++++++++ Store (LGreater (0xFFFFFFFF, 0x11111111), Local2)", Debug)
+ Store (LGreater (0xFFFFFFFF, 0x11111111), Local2)
+
+ Store ("++++++++ Store (LGreaterEqual (0xFFFFFFFF, 0x11111111), Local3)", Debug)
+ Store (LGreaterEqual (0xFFFFFFFF, 0x11111111), Local3)
+
+ Store ("++++++++ Store (LLess (0xFFFFFFFF, 0x11111111), Local4)", Debug)
+ Store (LLess (0xFFFFFFFF, 0x11111111), Local4)
+
+ Store ("++++++++ Store (LLessEqual (0xFFFFFFFF, 0x11111111), Local5)", Debug)
+ Store (LLessEqual (0xFFFFFFFF, 0x11111111), Local5)
+
+ Store ("++++++++ Store (LNot (0x31313131), Local6)", Debug)
+ Store (0x00001111, Local6)
+ Store (LNot (Local6), Local7)
+ if (LNotEqual (Local6, 0x00001111))
+ {
+ ERR_ (2)
+ }
+
+ if (LNotEqual (Local7, 0x0))
+ {
+ ERR_ (1)
+ }
+
+
+ Store ("++++++++ Store (LNotEqual (0xFFFFFFFF, 0x11111111), Local7)", Debug)
+ Store (LNotEqual (0xFFFFFFFF, 0x11111111), Local7)
+
+ Store ("++++++++ Lor (0x0, 0x1)", Debug)
+ if (Lor (0x0, 0x1))
+ {
+ Store ("+_+_+_+_+ Lor (0x0, 0x1) returned TRUE", Debug)
+ }
+
+ return (Local7)
+ }
+
+
+ Method (COND)
+ {
+ Store ("++++++++ Store (0x4, Local0)", Debug)
+ Store (0x4, Local0)
+
+ Store ("++++++++ While (Local0)", Debug)
+ While (Local0)
+ {
+ Store ("++++++++ Decrement (Local0)", Debug)
+ Decrement (Local0)
+ }
+
+
+ Store ("++++++++ Store (0x3, Local6)", Debug)
+ Store (0x3, Local6)
+
+ Store ("++++++++ While (Subtract (Local6, 1))", Debug)
+ While (Subtract (Local6, 1))
+ {
+ Store ("++++++++ Decrement (Local6)", Debug)
+ Decrement (Local6)
+ }
+
+
+ Store ("++++++++ [LVL1] If (LGreater (0x2, 0x1))", Debug)
+ If (LGreater (0x2, 0x1))
+ {
+ Store ("++++++++ [LVL2] If (LEqual (0x11111111, 0x22222222))", Debug)
+ If (LEqual (0x11111111, 0x22222222))
+ {
+ Store ("++++++++ ERROR: If (LEqual (0x11111111, 0x22222222)) returned TRUE", Debug)
+ }
+
+ else
+ {
+ Store ("++++++++ [LVL3] If (LNot (0x0))", Debug)
+ If (LNot (0x0))
+ {
+ Store ("++++++++ [LVL4] If (LAnd (0xEEEEEEEE, 0x2))", Debug)
+ If (LAnd (0xEEEEEEEE, 0x2))
+ {
+ Store ("++++++++ [LVL5] If (LLess (0x44444444, 0x3))", Debug)
+ If (LLess (0x44444444, 0x3))
+ {
+ Store ("++++++++ ERROR: If (LLess (0x44444444, 0x3)) returned TRUE", Debug)
+ }
+
+ else
+ {
+ Store ("++++++++ Exiting from nested IF/ELSE statements", Debug)
+ }
+ }
+ }
+ }
+ }
+
+
+ Store ("++++++++ [LVL1] If (LGreater (0x2, 0x1))", Debug)
+ If (LGreater (0x2, 0x1))
+ {
+ Store ("++++++++ [LVL2] If (LEqual (0x11111111, 0x22222222))", Debug)
+ If (LEqual (0x11111111, 0x22222222))
+ {
+ Store ("++++++++ ERROR: If (LEqual (0x11111111, 0x22222222)) returned TRUE", Debug)
+ }
+
+ else
+ {
+ Store ("++++++++ [LVL3] If (LNot (0x0))", Debug)
+ If (LNot (0x0))
+ {
+ Store ("++++++++ [LVL4] If (LAnd (0xEEEEEEEE, 0x2))", Debug)
+ If (LAnd (0xEEEEEEEE, 0x2))
+ {
+ Store ("++++++++ [LVL5] If (LLess (0x44444444, 0x3))", Debug)
+ If (LLess (0x44444444, 0x3))
+ {
+ Store ("++++++++ ERROR: If (LLess (0x44444444, 0x3)) returned TRUE", Debug)
+ }
+
+ else
+ {
+ Store ("++++++++ Returning from nested IF/ELSE statements", Debug)
+ Return (Local6)
+ }
+ }
+ }
+ }
+ }
+
+ }
+
+
+ Method (REFS)
+ {
+ Name (BBUF, Buffer() {0xB0, 0xB1, 0xB2, 0xB3, 0xB4, 0xB5, 0xB6, 0xB7})
+
+ Name (NEST, Package ()
+ {
+ Package ()
+ {
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06
+ },
+ Package ()
+ {
+ 0x11, 0x12, 0x12, 0x14, 0x15, 0x16
+ }
+ })
+
+ /* Parser thinks this is a method invocation!! */
+
+ Store (RefOf (MAIN), Local5)
+
+ // For this to work, ABCD must NOT exist.
+
+ Store (CondRefOf (ABCD, Local0), Local1)
+ if (LNotEqual (Local1, 0))
+ {
+ ERR_ (2)
+ }
+
+ Store (CondRefOf (BBUF, Local0), Local1)
+ if (LNotEqual (Local1, Ones))
+ {
+ ERR_ (2)
+ }
+
+ Store (DeRefOf (Index (BBUF, 3)), Local6)
+ if (LNotEqual (Local6, 0xB3))
+ {
+ ERR_ (2)
+ }
+
+ Store (DeRefOf (Index (DeRefOf (Index (NEST, 1)), 3)), Local0)
+ if (LNotEqual (Local0, 0x14))
+ {
+ ERR_ (2)
+ }
+
+
+ Store (0x11223344, Local0)
+ Store (RefOf (Local0), Local1)
+
+ Store (DerefOf (Local1), Local2)
+ If (LNotEqual (Local2, 0x11223344))
+ {
+ ERR_ (2)
+ }
+
+
+ /* Parser thinks this is a method invocation!! */
+
+ // RefOf (MAIN)
+
+
+ // RefOf (R___)
+ // RefOf (BBUF)
+
+ // Store (RefOf (Local0), Local1)
+
+ // CondRefOf (BBUF, Local2)
+ // CondRefOf (R___, Local3)
+
+ // Store (DerefOf (Local1), Local4)
+
+ // Return (Local4)
+ }
+
+
+ Method (INDX, 0)
+ {
+ Name(STAT,Package(4){})
+ Store(0x44443333,Index(STAT,0))
+ }
+
+//=================================================================
+//=================================================================
+//===================== iPCO TESTS ================================
+//=================================================================
+//=================================================================
+//
+//
+// test IfElseOp.asl
+//
+// test for IfOp and ElseOp, including validation of object stack cleanup
+//
+ Device (IFEL)
+ {
+ Name (DWRD, 1)
+ Name (RSLT, 0)
+
+ // IFNR control method executes IfOp branch with NO nested Return
+ // and no Else branch
+ Method (IFNR)
+ {
+ Store (DWRD, RSLT)
+ If (LEqual (DWRD, 1))
+ {
+ Store (0, RSLT)
+ }
+ } // IFNR
+
+ // NINR control method does not execute If branch and has no Else branch
+ Method (NINR)
+ {
+ Store (0, RSLT)
+ If (LNotEqual (DWRD, 1))
+ {
+ Store (DWRD, RSLT)
+ }
+ } // NINR
+
+ // IENR control method executes IfOp branch with NO nested Return
+ Method (IENR)
+ {
+ If (LEqual (DWRD, 1))
+ {
+ Store (0, RSLT)
+ }
+ Else
+ {
+ Store (DWRD, RSLT)
+ }
+ } // IENR
+
+ // ELNR control method executes ElseOp branch with NO nested Return
+ Method (ELNR)
+ {
+ If (LNotEqual (DWRD, 1))
+ {
+ Store (DWRD, RSLT)
+ }
+ Else
+ {
+ Store (0, RSLT)
+ }
+ } // ELNR
+
+ // IFRT control method executes IfOp branch with nested Return with
+ // no Else branch
+ Method (IFRT)
+
+ {
+ If (LEqual (DWRD, 1))
+ {
+ Return (0)
+ }
+ Return (DWRD)
+ } // IFRT
+
+ // IERT control method executes IfOp branch with nested Return with
+ // Else branch
+ Method (IERT)
+ {
+ If (LEqual (DWRD, 1))
+ {
+ Return (0)
+ }
+ Else
+ {
+ Return (DWRD)
+ }
+ } // IERT
+
+ // ELRT control method executes ElseOp branch with nested Return
+ Method (ELRT)
+ {
+ If (LNotEqual (DWRD, 1))
+ {
+ Return (DWRD)
+ }
+ Else
+ {
+ Return (0)
+ }
+ } // ELRT
+
+ Method (TEST)
+ {
+ Store ("++++++++ IfElseOp Test", Debug)
+
+ // IfOp with NO return value
+ IFNR()
+ If (LNotEqual (RSLT, 0))
+ {
+ Return (RSLT)
+ }
+
+ // IfOp with NO return value
+ NINR()
+ If (LNotEqual (RSLT, 0))
+ {
+ Return (RSLT)
+ }
+
+ // IfOp with NO return value
+ IENR()
+ If (LNotEqual (RSLT, 0))
+ {
+ Return (RSLT)
+ }
+
+ // ElseOp with NO return value
+ ELNR()
+ If (LNotEqual (RSLT, 0))
+ {
+ Return (RSLT)
+ }
+
+ // IfOp with return value
+ Store (IFRT, RSLT)
+ If (LNotEqual (RSLT, 0))
+ {
+ Return (RSLT)
+ }
+
+ // IfOp with return value
+ Store (IERT, RSLT)
+ If (LNotEqual (RSLT, 0))
+ {
+ Return (RSLT)
+ }
+
+ // ElseOp with return value
+ Store (ELRT, RSLT)
+ If (LNotEqual (RSLT, 0))
+ {
+ Return (RSLT)
+ }
+
+ Return (0)
+ } // TEST
+ } // IFEL
+
+//
+// test NoSave.asl
+//
+//
+// Internal test cases to validate IfOp (Operator (,,)) where Operator
+// target is ZeroOp to throw away the results.
+// Includes internal test cases for logical operators with no destination
+// operands.
+//
+ Device (NOSV)
+ {
+ Method (TEST)
+ {
+ Store ("++++++++ NoSave Test", Debug)
+
+ Name (WRD, 0x1234)
+
+ //
+ // Begin test of nested operators without saving results
+ //
+
+ // Test If (And ()) with no save of And result
+ If (And (3, 1, ))
+ {
+ Store (1, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (1) // fail
+ }
+
+ // Test If (And ()) with no save of And result
+ If (And (4, 1, ))
+ {
+ Return (2) // fail
+ }
+ else
+ {
+ Store (2, WRD) // pass -- just do something
+ }
+
+
+ // Test If (NAnd ()) with no save of NAnd result
+ If (NAnd (3, 1, ))
+ {
+ Store (3, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (3) // fail
+ }
+
+ // Test If (NAnd ()) with no save of NAnd result
+ If (NAnd (0xFFFFFFFF, 0xFFFFFFFF, ))
+ {
+ Return (4) // fail
+ }
+ else
+ {
+ Store (4, WRD) // pass -- just do something
+ }
+
+
+ // Test If (NOr ()) with no save of NOr result
+ If (NOr (0, 1, ))
+ {
+ Store (5, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (5) // fail
+ }
+
+ // Test If (NOr ()) with no save of NOr result
+ If (NOr (0xFFFFFFFE, 1, ))
+ {
+ Return (6) // fail
+ }
+ else
+ {
+ Store (6, WRD) // pass -- just do something
+ }
+
+
+ // Test If (Not ()) with no save of Not result
+ If (Not (1, ))
+ {
+ Store (7, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (7) // fail
+ }
+
+ // Test If (Not ()) with no save of Not result
+ If (Not (0xFFFFFFFF, ))
+ {
+ Return (8) // fail
+ }
+ else
+ {
+ Store (8, WRD) // pass -- just do something
+ }
+
+
+ // Test If (Or ()) with no save of Or result
+ If (Or (3, 1, ))
+ {
+ Store (9, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (9) // fail
+ }
+
+ // Test If (Or ()) with no save of Or result
+ If (Or (0, 0, ))
+ {
+ Return (10) // fail
+ }
+ else
+ {
+ Store (10, WRD) // pass -- just do something
+ }
+
+
+ // Test If (XOr ()) with no save of XOr result
+ If (XOr (3, 1, ))
+ {
+ Store (11, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (11) // fail
+ }
+
+ // Test If (XOr ()) with no save of XOr result
+ If (XOr (3, 3, ))
+ {
+ Return (12) // fail
+ }
+ else
+ {
+ Store (12, WRD) // pass -- just do something
+ }
+
+
+ //
+ // Begin test of logical operators with no destination operands
+ //
+
+ // Test If (LAnd ()) with no save of LAnd result
+ If (LAnd (3, 3))
+ {
+ Store (21, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (21) // fail
+ }
+
+ // Test If (LAnd ()) with no save of LAnd result
+ If (LAnd (3, 0))
+ {
+ Return (22) // fail
+ }
+ else
+ {
+ Store (22, WRD) // pass -- just do something
+ }
+
+ // Test If (LAnd ()) with no save of LAnd result
+ If (LAnd (0, 3))
+ {
+ Return (23) // fail
+ }
+ else
+ {
+ Store (23, WRD) // pass -- just do something
+ }
+
+ // Test If (LAnd ()) with no save of LAnd result
+ If (LAnd (0, 0))
+ {
+ Return (24) // fail
+ }
+ else
+ {
+ Store (24, WRD) // pass -- just do something
+ }
+
+
+ // Test If (LEqual ()) with no save of LEqual result
+ If (LEqual (3, 3))
+ {
+ Store (31, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (31) // fail
+ }
+
+ // Test If (LEqual ()) with no save of LEqual result
+ If (LEqual (1, 3))
+ {
+ Return (32) // fail
+ }
+ else
+ {
+ Store (32, WRD) // pass -- just do something
+ }
+
+
+ // Test If (LGreater ()) with no save of LGreater result
+ If (LGreater (3, 1))
+ {
+ Store (41, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (41) // fail
+ }
+
+ // Test If (LGreater ()) with no save of LGreater result
+ If (LGreater (4, 4))
+ {
+ Return (42) // fail
+ }
+ else
+ {
+ Store (42, WRD) // pass -- just do something
+ }
+
+ // Test If (LGreater ()) with no save of LGreater result
+ If (LGreater (1, 4))
+ {
+ Return (43) // fail
+ }
+ else
+ {
+ Store (43, WRD) // pass -- just do something
+ }
+
+ // Test If (LGreaterEqual ()) with no save of LGreaterEqual result
+ If (LGreaterEqual (3, 1))
+ {
+ Store (44, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (44) // fail
+ }
+
+ // Test If (LGreaterEqual ()) with no save of LGreaterEqual result
+ If (LGreaterEqual (3, 3))
+ {
+ Store (45, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (45) // fail
+ }
+
+ // Test If (LGreaterEqual ()) with no save of LGreaterEqual result
+ If (LGreaterEqual (3, 4))
+ {
+ Return (46) // fail
+ }
+ else
+ {
+ Store (46, WRD) // pass -- just do something
+ }
+
+
+ // Test If (LLess ()) with no save of LLess result
+ If (LLess (1, 3))
+ {
+ Store (51, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (51) // fail
+ }
+
+ // Test If (LLess ()) with no save of LLess result
+ If (LLess (2, 2))
+ {
+ Return (52) // fail
+ }
+ else
+ {
+ Store (52, WRD) // pass -- just do something
+ }
+
+ // Test If (LLess ()) with no save of LLess result
+ If (LLess (4, 2))
+ {
+ Return (53) // fail
+ }
+ else
+ {
+ Store (53, WRD) // pass -- just do something
+ }
+
+
+ // Test If (LLessEqual ()) with no save of LLessEqual result
+ If (LLessEqual (1, 3))
+ {
+ Store (54, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (54) // fail
+ }
+
+ // Test If (LLessEqual ()) with no save of LLessEqual result
+ If (LLessEqual (2, 2))
+ {
+ Store (55, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (55) // fail
+ }
+
+ // Test If (LLessEqual ()) with no save of LLessEqual result
+ If (LLessEqual (4, 2))
+ {
+ Return (56) // fail
+ }
+ else
+ {
+ Store (56, WRD) // pass -- just do something
+ }
+
+
+ // Test If (LNot ()) with no save of LNot result
+ If (LNot (0))
+ {
+ Store (61, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (61) // fail
+ }
+
+ // Test If (LNot ()) with no save of LNot result
+ If (LNot (1))
+ {
+ Return (62) // fail
+ }
+ else
+ {
+ Store (62, WRD) // pass -- just do something
+ }
+
+
+ // Test If (LNotEqual ()) with no save of LNotEqual result
+ If (LNotEqual (3, 3))
+ {
+ Return (63) // fail
+ }
+ else
+ {
+ Store (63, WRD) // pass -- just do something
+ }
+
+ // Test If (LNotEqual ()) with no save of LNotEqual result
+ If (LNotEqual (1, 3))
+ {
+ Store (64, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (64) // fail
+ }
+
+
+ // Test If (LOr ()) with no save of LOr result
+ If (LOr (3, 1))
+ {
+ Store (71, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (71) // fail
+ }
+
+ // Test If (LOr ()) with no save of LOr result
+ If (LOr (0, 1))
+ {
+ Store (72, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (72) // fail
+ }
+
+ // Test If (LOr ()) with no save of LOr result
+ If (LOr (3, 0))
+ {
+ Store (73, WRD) // pass -- just do something
+ }
+ else
+ {
+ Return (73) // fail
+ }
+
+ // Test If (LOr ()) with no save of LOr result
+ If (LOr (0, 0))
+ {
+ Return (74) // fail
+ }
+ else
+ {
+ Store (74, WRD) // pass -- just do something
+ }
+
+ Return (0)
+ } // TEST
+ } // NOSV
+
+
+//
+// test IndxFld.asl
+//
+// IndexFld test
+// This is just a subset of the many RegionOp/Index Field test cases.
+// Tests index field element AccessAs macro.
+//
+ Device (IDXF)
+ { // Test device name
+
+ OperationRegion (SIO, SystemIO, 0x100, 2)
+ Field (SIO, ByteAcc, NoLock, Preserve)
+ {
+ INDX, 8,
+ DATA, 8
+ }
+ IndexField (INDX, DATA, AnyAcc, NoLock, WriteAsOnes)
+ {
+ AccessAs (ByteAcc, 0),
+ IFE0, 8,
+ IFE1, 8,
+ IFE2, 8,
+ IFE3, 8,
+ IFE4, 8,
+ IFE5, 8,
+ IFE6, 8,
+ IFE7, 8,
+ IFE8, 8,
+ IFE9, 8,
+ }
+
+ Method (TEST)
+ {
+ Store ("++++++++ IndxFld Test", Debug)
+
+ Store (IFE0, Local0)
+ Store (IFE1, Local1)
+ Store (IFE2, Local2)
+
+ Return (0)
+ } // TEST
+ } // IDXF
+
+//
+// test NestdLor.asl
+//
+ Scope (\_SB) // System Bus
+ { // _SB system bus
+
+ Name (ZER0, 0)
+ Name (ZER1, 0)
+ Name (ZER2, 0)
+ Name (ONE0, 1)
+
+ Device (NSTL)
+ {
+ Method (TEST)
+ {
+ Store ("++++++++ NestdLor Test", Debug)
+
+ If (Lor (ZER0, Lor (ZER1, Lor (ZER2, ONE0))))
+ { // Indicate Pass
+ Store (0x00, Local0)
+ }
+
+ Else
+ { // Indicate Fail
+ Store (0x01, Local0)
+ }
+
+ Return (Local0)
+ } // End Method TEST
+ } // Device NSTL
+ } // _SB system bus
+
+//
+// test RetBuf.asl
+//
+// Test ReturnOp(Buffer)
+// This is required to support Control Method Batteries on
+// Dell Latitude Laptops (e.g., CP1-A)
+//
+ Device (RTBF)
+ {
+ Method (SUBR, 1)
+ {
+ Return (Arg0)
+ }
+
+ Method (RBUF)
+ { // RBUF: Return Buffer from local variable
+ Name (ABUF, Buffer() {"ARBITRARY_BUFFER"})
+
+ // store local buffer ABUF into Local0
+ Store (ABUF, Local0)
+
+ // save Local0 object type value into Local1
+ Store (ObjectType (Local0), Local1)
+
+ // validate Local0 is a Buffer
+ If (LNotEqual (Local1, 3)) // Buffer type is 3
+ {
+ Return (1) // failure
+ }
+
+ // store value returned by control method SUBR into Local0
+ Store (SUBR (ABUF), Local0)
+
+ // save Local0 object type value into Local1
+ Store (ObjectType (Local0), Local1)
+
+ // validate Local0 is a Buffer
+ If (LNotEqual (Local1, 3)) // Buffer type is 3
+ {
+ Return (2) // failure
+ }
+
+ // allocate buffer using Local1 as buffer size (run-time evaluation)
+ Store (5, Local1)
+ Name (BUFR, Buffer(Local1) {})
+
+ // store value returned by control method SUBR into Local0
+ Store (SUBR (BUFR), Local0)
+
+ // save Local0 object type value into Local1
+ Store (ObjectType (Local0), Local1)
+
+ // validate Local0 is a Buffer
+ If (LNotEqual (Local1, 3)) // Buffer type is 3
+ {
+ Return (3) // failure
+ }
+
+ // store BUFR Buffer into Local0
+ Store (BUFR, Local0)
+
+ // save Local0 object type value into Local1
+ Store (ObjectType (Local0), Local1)
+
+ // validate Local0 is a Buffer
+ If (LNotEqual (Local1, 3)) // Buffer type is 3
+ {
+ Return (4) // failure
+ }
+
+
+ // return Local0 Buffer
+ Return (Local0)
+ } // RBUF
+
+ Method (TEST)
+ {
+ Store ("++++++++ RetBuf Test", Debug)
+
+ // store RBUF Buffer return value into Local0
+ Store (RBUF, Local0)
+
+ // save Local0 object type value into Local1
+ Store (ObjectType (Local0), Local1)
+
+ // validate Local0 is a Buffer
+ If (LNotEqual (Local1, 3)) // Buffer type is 3
+ {
+ Return (10) // failure
+ }
+ Else
+ {
+ Return (0) // success
+ }
+ } // TEST
+ } // RTBF
+
+//
+// test RetLVal.asl
+//
+// Test ReturnOp(Lvalue)
+// This is required to support _PSR on IBM ThinkPad 560D and
+// _DCK on Toshiba Tecra 8000.
+//
+
+ Device (GPE2)
+ {
+ Method (_L03)
+ {
+ Store ("Method GPE2._L03 invoked", Debug)
+ Return ()
+ }
+
+ Method (_E05)
+ {
+ Store ("Method GPE2._E05 invoked", Debug)
+ Return ()
+ }
+ }
+
+ Device (PRW2)
+ {
+ Name (_PRW, Package(2) {Package(2){\GPE2, 0x05}, 3})
+ }
+
+
+ Scope (\_GPE)
+ {
+ Name (ACST, 0xFF)
+
+ Method (_L08)
+ {
+ Store ("Method _GPE._L08 invoked", Debug)
+ Return ()
+ }
+
+ Method (_E09)
+ {
+ Store ("Method _GPE._E09 invoked", Debug)
+ Return ()
+ }
+
+ Method (_E11)
+ {
+ Store ("Method _GPE._E11 invoked", Debug)
+ Notify (\PRW1, 2)
+ }
+
+ Method (_L22)
+ {
+ Store ("Method _GPE._L22 invoked", Debug)
+ Return ()
+ }
+
+ Method (_L33)
+ {
+ Store ("Method _GPE._L33 invoked", Debug)
+ Return ()
+ }
+
+ Method (_E64)
+ {
+ Store ("Method _GPE._E64 invoked", Debug)
+ Return ()
+ }
+
+ } // _GPE
+
+ Device (PRW1)
+ {
+ Name (_PRW, Package(2) {0x11, 3})
+ }
+
+ Device (PWRB)
+ {
+ Name (_HID, EISAID("PNP0C0C"))
+ Name (_PRW, Package(2) {0x33, 3})
+ }
+
+
+ Scope (\_SB) // System Bus
+ { // _SB system bus
+
+ Device (ACAD)
+ { // ACAD: AC adapter device
+ Name (_HID, "ACPI0003") // AC adapter device
+
+ Name (_PCL, Package () {\_SB})
+
+ OperationRegion (AREG, SystemIO, 0x0372, 2)
+ Field (AREG, ByteAcc, NoLock, Preserve)
+ {
+ AIDX, 8,
+ ADAT, 8
+ }
+ IndexField (AIDX, ADAT, ByteAcc, NoLock, Preserve)
+ {
+ , 1, // skips
+ ACIN, 1,
+ , 2, // skips
+ CHAG, 1,
+ , 3, // skips
+ , 7, // skips
+ ABAT, 1,
+ } // IndexField
+
+ Method (_PSR)
+ {
+ Store (\_GPE.ACST, Local0)
+ Store (ACIN, Local1)
+ If (LNotEqual (\_GPE.ACST, Local1))
+ {
+ Store (Local1, \_GPE.ACST)
+ // This Notify is commented because it causes a
+ // method error when running on a system without the
+ // specific device.
+ // Notify (\_SB_.ACAD, 0)
+ }
+ Return (Local0)
+ } // _PSR
+
+ Method (_STA)
+ {
+ Return (0x0F)
+ }
+
+ Method (_INI)
+ {
+ Store (ACIN, \_GPE.ACST)
+ }
+ } // ACAD: AC adapter device
+
+ // test implicit return from control method
+ Method (DIS_, 1)
+ {
+ Store (Arg0, Local0)
+ }
+
+ Device (RTLV)
+ {
+ // test implicit return inside nested if with explicit return of Lvalue
+ Method (_DCK, 1)
+ // Arg0: 1 == dock, 0 == undock
+ {
+ If (Arg0)
+ { // dock
+ Store (0x87, Local0)
+
+ If (Local0)
+ {
+ DIS_ (0x23)
+ Return (1)
+ }
+
+ Return (0)
+ } // dock
+ Else
+ { // undock
+ Store (Arg0, Local0)
+
+ If (Local0)
+ {
+ DIS_ (0x23)
+ Return (1)
+ }
+
+ Return (0)
+ } // undock
+ } // _DCK control method
+
+ Method (TEST)
+ {
+ Store ("++++++++ RetLVal Test", Debug)
+
+ // store _PSR return value into Local0
+ Store (\_SB_.ACAD._PSR, Local0)
+
+ // save Local0 object type value into Local1
+ Store (ObjectType (Local0), Local1)
+
+ // validate Local0 is a Number
+ If (LNotEqual (Local1, 1)) // Number/Integer type is 1
+ {
+ Return (1) // failure
+ }
+
+ // test implicit return inside nested if with explicit return of Lvalue
+ Store (_DCK (1), Local2)
+
+ // save Local2 object type value into Local3
+ Store (ObjectType (Local2), Local3)
+
+ // validate Local2 is a Number
+ If (LNotEqual (Local3, 1)) // Number/Integer type is 1
+ {
+ Return (2) // failure
+ }
+
+ If (LNotEqual (Local2, 1))
+ {
+ Return (3) // failure
+ }
+
+ Return (0) // success
+ } // TEST
+ } // RTLV
+ } // _SB system bus
+
+//
+// test RetPkg.asl
+//
+// Test ReturnOp(Package)
+// This is required to support _PRT on Dell Optiplex Workstations (e.g. GX1)
+//
+
+ Scope (\_SB) // System Bus
+ { // _SB system bus
+ Device(LNKA)
+ {
+ Name (_HID, EISAID("PNP0C0F")) // PCI interrupt link
+ Name (_UID, 1)
+ }
+ Device(LNKB)
+ {
+ Name (_HID, EISAID("PNP0C0F")) // PCI interrupt link
+ Name (_UID, 2)
+ }
+ Device(LNKC)
+ {
+ Name (_HID, EISAID("PNP0C0F")) // PCI interrupt link
+ Name (_UID, 3)
+ }
+ Device(LNKD)
+ {
+ Name (_HID, EISAID("PNP0C0F")) // PCI interrupt link
+ Name (_UID, 4)
+ }
+
+ Device (PCI1)
+ { // PCI1: Root PCI Bus
+ Name (_HID, "PNP0A03") // Need _HID for root device (String format)
+ Name (_ADR,0x00000000)
+ Name (_CRS,0)
+
+ Name (_PRT, Package ()
+ {
+ Package () {0x0004ffff, 0, LNKA, 0}, // Slot 1, INTA
+ Package () {0x0004ffff, 1, LNKB, 0}, // Slot 1, INTB
+ Package () {0x0004ffff, 2, LNKC, 0}, // Slot 1, INTC
+ Package () {0x0004ffff, 3, LNKD, 0}, // Slot 1, INTD
+ Package () {0x0005ffff, 0, \_SB_.LNKB, 0}, // Slot 2, INTA
+ Package () {0x0005ffff, 1, \_SB_.LNKC, 0}, // Slot 2, INTB
+ Package () {0x0005ffff, 2, \_SB_.LNKD, 0}, // Slot 2, INTC
+ Package () {0x0006ffff, 3, \_SB_.LNKA, 0}, // Slot 2, INTD
+ Package () {0x0006ffff, 0, LNKC, 0}, // Slot 3, INTA
+ Package () {0x0006ffff, 1, LNKD, 0}, // Slot 3, INTB
+ Package () {0x0006ffff, 2, LNKA, 0}, // Slot 3, INTC
+ Package () {0x0006ffff, 3, LNKB, 0}, // Slot 3, INTD
+ })
+
+ Device (PX40)
+ { // Map f0 space, Start PX40
+ Name (_ADR,0x00070000) // Address+function.
+ }
+ } // PCI0: Root PCI Bus
+
+ Device (RETP)
+ {
+ Method (RPKG)
+ { // RPKG: Return Package from local variable
+
+ // store _PRT package into Local0
+ Store (\_SB_.PCI1._PRT, Local0)
+
+ // return Local0 Package
+ Return (Local0)
+ } // RPKG
+
+ Method (TEST)
+ {
+ Store ("++++++++ RetPkg Test", Debug)
+
+ // store RPKG package return value into Local0
+ Store (RPKG, Local0)
+
+ // save Local0 object type value into Local1
+ Store (ObjectType (Local0), Local1)
+
+ // validate Local0 is a Package
+ If (LNotEqual (Local1, 4)) // Package type is 4
+ { Return (1) } // failure
+ Else
+ { Return (0) } // success
+ } // TEST
+ } // RETP
+ } // _SB_
+
+//
+// test WhileRet.asl
+//
+// WhileRet.asl tests a ReturnOp nested in a IfOp nested in a WhileOp.
+//
+ Device (WHLR)
+ {
+ Name (LCNT, 0)
+ Method (WIR)
+ { // WIR: control method that returns inside of IfOp inside of WhileOp
+ While (LLess (LCNT, 4))
+ {
+ If (LEqual (LCNT, 2))
+ {
+ Return (0)
+ }
+
+ Increment (LCNT)
+ }
+
+ Return (LCNT)
+ } // WIR: control method that returns inside of IfOp inside of WhileOp
+
+ Method (TEST)
+ {
+ Store ("++++++++ WhileRet Test", Debug)
+
+ Store (WIR, Local0)
+
+ Return (Local0)
+ } // TEST
+ } // WHLR
+
+//
+// test AndOrOp.asl
+//
+//This code tests the bitwise AndOp and OrOp Operator terms
+//
+//Syntax of Andop term
+//And - Bitwise And
+//AndTerm := And(
+// Source1, //TermArg=>Integer
+// Source2, //TermArg=>Integer
+// Result //Nothing | SuperName
+//) => Integer
+//Source1 and Source2 are evaluated as integer data types,
+// a bit-wise AND is performed, and the result is optionally
+//stored into Result.
+//
+//
+//Syntax of OrOp
+//Or - Bit-wise Or
+//OrTerm := Or(
+// Source1, //TermArg=>Integer
+// Source2 //TermArg=>Integer
+// Result //Nothing | SuperName
+//) => Integer
+//Source1 and Source2 are evaluated as integer data types,
+// a bit-wide OR is performed, and the result is optionally
+//stored in Result
+//
+ Device (ANDO)
+ {
+ OperationRegion (TMEM, SystemMemory, 0xC4, 0x02)
+ Field (TMEM, ByteAcc, NoLock, Preserve)
+ {
+ , 3,
+ TOUD, 13
+ }
+
+ //Create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ }// Field(RAM)
+
+
+ //And with Byte Data
+ Name (BYT1, 0xff)
+ Name (BYT2, 0xff)
+ Name (BRSL, 0x00)
+
+ //And with Word Data
+ Name (WRD1, 0xffff)
+ Name (WRD2, 0xffff)
+ Name (WRSL, 0x0000)
+
+ //And with DWord Data
+ Name (DWD1, 0xffffffff)
+ Name (DWD2, 0xffffffff)
+ Name (DRSL, 0x00000000)
+
+ Method (ANDP)
+ {
+ //Check with 1 And 1 on byte data
+ And(BYT1, BYT2, BRSL)
+ if(LNotEqual(BRSL,0xff))
+ {Return(1)}
+
+ //Check with 1 And 1 on Word data
+ And(WRD1, WRD2, WRSL)
+ if(LNotEqual(WRSL,0xffff))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 1 And 1 Dword
+ And(DWD1, DWD2, DRSL)
+ if(LNotEqual(DRSL,0xffffffff))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 0 And 0 on byte data
+ Store(0x00,BYT1)
+ Store(0x00,BYT2)
+ Store(0x00,BRSL)
+ And(BYT1, BYT2, BRSL)
+ if(LNotEqual(BRSL,0x00))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 0 And 0 on Word data
+ Store (0x0000,WRD1)
+ Store (0x0000,WRD2)
+ Store (0x0000,WRSL)
+ And(WRD1, WRD2, WRSL)
+ if(LNotEqual(WRSL,0x0000))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 0 And 0 Dword
+ Store (0x00000000,DWD1)
+ Store (0x00000000,DWD2)
+ Store (0x00000000,DRSL)
+ And(DWD1, DWD2, DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {
+ Return (1) // failure
+ }
+
+
+ //Check with 1 And 0 on byte data
+ Store(0x55,BYT1)
+ Store(0xAA,BYT2)
+ Store(0x00,BRSL)
+ And(BYT1, BYT2, BRSL)
+ if(LNotEqual(BRSL,0x00))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 1 And 0 on Word data
+ Store (0x5555,WRD1)
+ Store (0xAAAA,WRD2)
+ Store (0x0000,WRSL)
+ And(WRD1, WRD2, WRSL)
+ if(LNotEqual(WRSL,0x0000))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 1 And 0 on Dword
+ Store (0x55555555,DWD1)
+ Store (0xAAAAAAAA,DWD2)
+ Store (0x00000000,DRSL)
+ And(DWD1, DWD2, DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {
+ Return (1) // failure
+ }
+
+ Store (0x1FFF, TOUD)
+ Store (TOUD, Local0)
+ if(LNotEqual(Local0,0x1FFF))
+ {
+ Return (1) // failure
+ }
+
+ //TBD- Do We need to check for system memory data also for each test case ??
+
+ Return(0)
+
+ }//ANDP
+
+ Method (OROP)
+ {
+
+ //Check with 1 Ored with 1 on byte data
+ Store(0xff,BYT1)
+ Store(0xff,BYT2)
+ Store(0x00,BRSL)
+ Or(BYT1, BYT2, BRSL)
+ if(LNotEqual(BRSL,0xff))
+ {
+ Return (1) // failure
+ }
+
+
+ //Check with 1 Ored with 1 on Word data
+ Store(0xffff,WRD1)
+ Store(0xffff,WRD2)
+ Store(0x0000,WRSL)
+ Or(WRD1, WRD2, WRSL)
+ if(LNotEqual(WRSL,0xffff))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 1 Ored with 1 on Dword data
+ Store(0xffffffff,DWD1)
+ Store(0xffffffff,DWD2)
+ Store(0x00000000,DRSL)
+ Or(DWD1, DWD2, DRSL)
+ if(LNotEqual(DRSL,0xffffffff))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 0 Ored with 0 on byte data
+ Store(0x00,BYT1)
+ Store(0x00,BYT2)
+ Store(0x00,BRSL)
+ Or(BYT1, BYT2, BRSL)
+ if(LNotEqual(BRSL,0x00))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 0 Ored with 0 on Word data
+ Store (0x0000,WRD1)
+ Store (0x0000,WRD2)
+ Store (0x0000,WRSL)
+ Or(WRD1, WRD2, WRSL)
+ if(LNotEqual(WRSL,0x0000))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 0 Ored with 0 Dword data
+ Store (0x00000000,DWD1)
+ Store (0x00000000,DWD2)
+ Store (0x00000000,DRSL)
+ Or(DWD1, DWD2, DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {
+ Return (1) // failure
+ }
+
+
+ //Check with 1 Ored with 0 on byte data
+ Store(0x55,BYT1)
+ Store(0xAA,BYT2)
+ Store(0x00,BRSL)
+ Or(BYT1, BYT2, BRSL)
+ if(LNotEqual(BRSL,0xff))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 1 Ored with 0 on Word data
+ Store (0x5555,WRD1)
+ Store (0xAAAA,WRD2)
+ Store (0x0000,WRSL)
+ Or(WRD1, WRD2, WRSL)
+ if(LNotEqual(WRSL,0xffff))
+ {
+ Return (1) // failure
+ }
+
+ //Check with 1 Ored with 0 on Dword data
+ Store (0x55555555,DWD1)
+ Store (0xAAAAAAAA,DWD2)
+ Store (0x00000000,DRSL)
+ Or(DWD1, DWD2, DRSL)
+ if(LNotEqual(DRSL,0xffffffff))
+ {
+ Return (1) // failure
+ }
+
+ //TBD - Do We need to check for system memory data also for each test case ??
+
+ Return(0)
+
+ }//OROP
+
+ Method(TEST)
+ {
+ Store ("++++++++ AndOrOp Test", Debug)
+
+ Name(RSLT,1)
+ //Call Andop method
+ Store(ANDP,RSLT)
+ if(LEqual(RSLT,1))
+ {
+ Return (RSLT)
+ }
+
+ //Call OrOp Method
+ Store(OROP,RSLT)
+ if(LEqual(RSLT,1))
+ {
+ Return(RSLT)
+ }
+
+ //
+ // Return original conditions to allow iterative execution
+ //
+ Store(0xff,BYT1)
+ Store(0xff,BYT2)
+ Store(0x00,BRSL)
+ Store (0xffff,WRD1)
+ Store (0xffff,WRD2)
+ Store (0x0000,WRSL)
+ Store (0xffffffff,DWD1)
+ Store (0xffffffff,DWD2)
+ Store (0x00000000,DRSL)
+
+ Return(0)
+ } //TEST
+ } //ANDO
+
+//
+// test BreakPnt.asl
+//
+// This code tests the BreakPoint opcode term. The syntax of BreakPoint Term is
+// BreakPointTerm := BreakPoint
+// Used for debugging, the Breakpoint opcode stops the execution and enters the AML debugger.
+// In the non-debug version of the interpreter, BreakPoint is equivalent to Noop.
+//
+ Device (BRKP)
+ {
+ Name(CNT0,0)
+
+ Method (BK1)
+ {
+ BreakPoint
+ Return(0)
+ }
+
+ Method (TEST)
+ {
+ Store ("++++++++ BreakPnt Test", Debug)
+
+ Store(0,CNT0)
+
+ //Check BreakPoint statement
+ While(LLess(CNT0,10))
+ {
+ Increment(CNT0)
+ }
+
+ //Check the BreakPoint statement
+ If(LEqual(CNT0,10))
+ {
+ // BreakPoint
+ Return(0)
+ }
+
+ //failed
+ Return(1)
+ }
+ }
+
+//
+// test AddSubOp.asl
+//
+ Device (ADSU)
+ {
+ // create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ } // Field(RAM)
+
+ Method (TEST)
+ {
+ Store ("++++++++ AddSubOp Test", Debug)
+
+ Name (DWRD, 0x12345678)
+ Name (WRD, 0x1234)
+ Name (BYT, 0x12)
+
+ // Test AddOp with DWORD data
+ Store (0x12345678, DWRD)
+ Add (DWRD, 7, DWRD)
+ If (LNotEqual (DWRD, 0x1234567F))
+ { Return (DWRD) }
+
+ // Test AddOp with WORD data
+ Add (WRD, 5, WRD)
+ If (LNotEqual (WRD, 0x1239))
+ { Return (WRD) }
+
+ // Test AddOp with BYTE data
+ Add (BYT, 3, BYT)
+ If (LNotEqual (BYT, 0x15))
+ { Return (BYT) }
+
+ // Test SubtractOp with DWORD data
+ Subtract (DWRD, 7, DWRD)
+ If (LNotEqual (DWRD, 0x12345678))
+ { Return (DWRD) }
+
+ // Test SubtractOp with WORD data
+ Subtract (WRD, 3, WRD)
+ If (LNotEqual (WRD, 0x1236))
+ { Return (WRD) }
+
+ // Test SubtractOp with BYTE data
+ Subtract (BYT, 3, BYT)
+ If (LNotEqual (BYT, 0x12))
+ { Return (BYT) }
+
+
+ // test AddOp with DWORD SystemMemory OpRegion
+ Store (0x01234567, SMDW)
+ Add (SMDW, 8, SMDW)
+ If (LNotEqual (SMDW, 0x0123456F))
+ { Return (SMDW) }
+
+ // test SubtractOp with DWORD SystemMemory OpRegion
+ Subtract (SMDW, 7, SMDW)
+ If (LNotEqual (SMDW, 0x01234568))
+ { Return (SMDW) }
+
+
+ // test AddOp with WORD SystemMemory OpRegion
+ Store (0x0123, SMWD)
+ Add (SMWD, 6, SMWD)
+ If (LNotEqual (SMWD, 0x0129))
+ { Return (SMWD) }
+
+ // test SubtractOp with WORD SystemMemory OpRegion
+ Subtract (SMWD, 5, SMWD)
+ If (LNotEqual (SMWD, 0x0124))
+ { Return (SMWD) }
+
+
+ // test AddOp with BYTE SystemMemory OpRegion
+ Store (0x01, SMBY)
+ Add (SMBY, 4, SMBY)
+ If (LNotEqual (SMBY, 0x05))
+ { Return (SMBY) }
+
+ // test SubtractOp with BYTE SystemMemory OpRegion
+ Subtract (SMBY, 3, SMBY)
+ If (LNotEqual (SMBY, 0x02))
+ { Return (SMBY) }
+
+ Return (0)
+ } // TEST
+ } // ADSU
+
+//
+// test IncDecOp.asl
+//
+ Device (INDC)
+ {
+ // create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ } // Field(RAM)
+
+ Method (TEST)
+ {
+ Store ("++++++++ IncDecOp Test", Debug)
+
+ Name (DWRD, 0x12345678)
+ Name (WRD, 0x1234)
+ Name (BYT, 0x12)
+
+ // Test IncrementOp with DWORD data
+ Store (0x12345678, DWRD)
+ Increment (DWRD)
+ If (LNotEqual (DWRD, 0x12345679))
+ { Return (DWRD) }
+
+ // Test IncrementOp with WORD data
+ Increment (WRD)
+ If (LNotEqual (WRD, 0x1235))
+ { Return (WRD) }
+
+ // Test IncrementOp with BYTE data
+ Increment (BYT)
+ If (LNotEqual (BYT, 0x13))
+ { Return (BYT) }
+
+ // Test DecrementOp with DWORD data
+ Decrement (DWRD)
+ If (LNotEqual (DWRD, 0x12345678))
+ { Return (DWRD) }
+
+ // Test DecrementOp with WORD data
+ Decrement (WRD)
+ If (LNotEqual (WRD, 0x1234))
+ { Return (WRD) }
+
+ // Test DecrementOp with BYTE data
+ Decrement (BYT)
+ If (LNotEqual (BYT, 0x12))
+ { Return (BYT) }
+
+
+ // test IncrementOp with DWORD SystemMemory OpRegion
+ Store (0x01234567, SMDW)
+ Increment (SMDW)
+ If (LNotEqual (SMDW, 0x01234568))
+ { Return (SMDW) }
+
+ // test DecrementOp with DWORD SystemMemory OpRegion
+ Decrement (SMDW)
+ If (LNotEqual (SMDW, 0x01234567))
+ { Return (SMDW) }
+
+
+ // test IncrementOp with WORD SystemMemory OpRegion
+ Store (0x0123, SMWD)
+ Increment (SMWD)
+ If (LNotEqual (SMWD, 0x0124))
+ { Return (SMWD) }
+
+ // test DecrementOp with WORD SystemMemory OpRegion
+ Decrement (SMWD)
+ If (LNotEqual (SMWD, 0x0123))
+ { Return (SMWD) }
+
+
+ // test IncrementOp with BYTE SystemMemory OpRegion
+ Store (0x01, SMBY)
+ Increment (SMBY)
+ If (LNotEqual (SMBY, 0x02))
+ { Return (SMBY) }
+
+ // test DecrementOp with BYTE SystemMemory OpRegion
+ Decrement (SMBY)
+ If (LNotEqual (SMBY, 0x01))
+ { Return (SMBY) }
+
+ Return (0)
+ } // TEST
+ } // INDC
+
+//
+// test LOps.asl
+//
+//This source tests all the logical operators. Logical operators in ASL are as follows.
+//LAnd, LEqual, LGreater, LLess, LNot, LNotEqual, LOr.
+// Success will return 0 and failure will return a non zero number. Check the source code for
+// non zero number to find where the test failed
+
+ Device (LOPS)
+ {
+ //Create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ }// Field(RAM)
+
+ //And with Byte Data
+ Name (BYT1, 0xff)
+ Name (BYT2, 0xff)
+ Name (BRSL, 0x00)
+
+ //And with Word Data
+ Name (WRD1, 0xffff)
+ Name (WRD2, 0xffff)
+ Name (WRSL, 0x0000)
+
+ //And with DWord Data
+ Name (DWD1, 0xffffffff)
+ Name (DWD2, 0xffffffff)
+ Name (DRSL, 0x00000000)
+
+ Name(RSLT,1)
+
+ Method (ANDL,2) // Test Logical And
+ {
+ //test with the arguments passed
+ if(LEqual(Arg0,Arg1))
+ { Store(LAnd(Arg0,Arg1),RSLT)
+ if(LNotEqual(Ones,RSLT))
+ {Return(11)}
+ }
+
+ //test with he locals
+ Store(Arg0,Local0)
+ Store(Arg1,Local1)
+
+ if(LEqual(Local0,Local1))
+ {
+ Store(LAnd(Local0,Local1),RSLT)
+ if(LNotEqual(Ones,RSLT))
+ {Return(12)}
+ }
+
+ //test with BYTE data
+ if(LEqual(BYT1,BYT2))
+ { Store(LAnd(BYT1,BYT2),BRSL)
+ if(LNotEqual(Ones,BRSL))
+ {Return(13)}
+ }
+
+ //test with WORD data
+ if(LEqual(WRD1,WRD2))
+ { Store(LAnd(WRD1,WRD2),WRSL)
+ if(LNotEqual(Ones,WRSL))
+ {Return(14)}
+ }
+
+ //test with DWORD data
+ if(LEqual(DWD1,DWD2))
+ { Store(LAnd(DWD1,DWD2),DRSL)
+ if(LNotEqual(Ones,DRSL))
+ {Return(15)}
+ }
+
+ //Test for system memory data for each test case.
+
+ Store(0xff,BYT1)
+ Store(0xff,SMBY)
+ Store(0x00,BRSL)
+
+ //test with BYTE system memory data
+ if(LEqual(BYT1,SMBY))
+ { Store(LAnd(BYT1,SMBY),BRSL)
+ if(LNotEqual(Ones,BRSL))
+ {Return(16)}
+ }
+
+ Store (0xffff,WRD1)
+ Store(0xffff,SMWD)
+ Store(0x0000,WRSL)
+ //test with WORD system memory data
+ if(LEqual(WRD1,SMWD))
+ { Store(LAnd(WRD1,SMWD),WRSL)
+ if(LNotEqual(Ones,WRSL))
+ {Return(17)}
+ }
+
+ Store(0x000000,DRSL)
+ Store (0xffffff,DWD1)
+ Store(0xffffff,SMDW)
+
+ //test with DWORD system memory data
+ if(LEqual(DWD1,SMDW))
+ { Store(LAnd(DWD1,SMDW),DRSL)
+ if(LNotEqual(Ones,DRSL))
+ {Return(18)}
+ }
+
+ Return(0)
+
+ }//ANDL
+
+ //Test the LOr Operator
+
+ Method (ORL_,2)
+ {//ORL_
+
+ //test with the arguments passed
+ if(LEqual(Arg0,Arg1))
+ {
+ Store(LOr(Arg0,Arg1),RSLT)
+ if(LNotEqual(Ones,RSLT))
+ {
+ Return(21)
+ }
+ }
+
+ //test with he locals
+ Store(Arg0,Local0)
+ Store(Arg1,Local1)
+
+ if(LEqual(Local0,Local1))
+ {
+ Store(LOr(Local0,Local1),RSLT)
+ if(LNotEqual(Ones,RSLT))
+ {Return(22)}
+ }
+
+ //Check with 1 LOred with 0 on byte data
+ Store(0xff,BYT1)
+ Store(0x00,BYT2)
+ Store(0x00,BRSL)
+
+ if(LNotEqual(BYT1, BYT2))
+ {
+ Store(LOr(BYT1, BYT2), BRSL)
+ if(LNotEqual(Ones,BRSL))
+ {Return(23)}
+ }
+
+ //Check with 1 LOred with 0 on WORD data
+ Store(0xffff,WRD1)
+ Store(0x0000,WRD2)
+ Store(0x0000,WRSL)
+
+ if(LNotEqual(WRD1, WRD2))
+ {
+ Store(LOr(WRD1, WRD2), WRSL)
+ if(LNotEqual(Ones,WRSL))
+ {Return(24)}
+ }
+
+ //Check with 1 LOred with 0 on DWORD data
+ Store(0xffffffff,DWD1)
+ Store(0x00000000,DWD2)
+ Store(0x00000000,DRSL)
+
+ if(LNotEqual(DWD1, DWD2))
+ {
+ Store(LOr(DWD1, DWD2), DRSL)
+ if(LNotEqual(Ones,DRSL))
+ {Return(25)}
+ }
+
+ Store(0x00,BYT1)
+ Store(0xff,SMBY)
+ Store(0x00,BRSL)
+
+ //test with BYTE system memory data
+ if(LEqual(BYT1,SMBY))
+ { Store(LOr(BYT1,SMBY),BRSL)
+ if(LNotEqual(Ones,BRSL))
+ {Return(26)}
+ }
+
+ Store (0x0000,WRD1)
+ Store(0xffff,SMWD)
+ Store(0x0000,WRSL)
+
+ //test with WORD system memory data
+ if(LEqual(WRD1,SMWD))
+ { Store(LOr(WRD1,SMWD),WRSL)
+ if(LNotEqual(Ones,WRSL))
+ {Return(27)}
+ }
+
+
+ Store(0x00000000,DWD1)
+ Store(0xffffffff,SMDW)
+ Store(0x00000000,DRSL)
+
+ //test with DWORD system memory data
+ if(LEqual(DWD1,SMDW))
+ { Store(LAnd(DWD1,SMDW),DRSL)
+ if(LNotEqual(Ones,DRSL))
+ {Return(28)}
+ }
+ Return(0)
+
+ }//ORL_
+
+ //This method tests LGreater and LNot operator
+ Method(LSGR,2)
+ {//LSGR
+
+ //Test on arguements passed
+
+ //in test data, Arg1 > Arg0
+ if(LEqual(Ones,LNot(LGreater(Arg1,Arg0))))
+ {Return(31)}
+
+ //test LLessEqual
+ if(LEqual(Ones,LNot(LGreaterEqual(Arg1,Arg0))))
+ {Return(32)}
+
+ if(LEqual(Ones,LLess(Arg1,Arg0)))
+ {Return(33)}
+
+ //test LLessEqual
+ if(LEqual(Ones,LLessEqual(Arg1,Arg0)))
+ {Return(34)}
+
+ Store(Arg0,Local0)
+ Store(Arg1,Local1)
+
+ //test with the locals
+ if(LNot(LGreater(Local1,Local0)))
+ {Return(35)}
+
+ //test on Byte data
+ Store(0x12,BYT1)
+ Store(0x21,BYT2)
+
+ if(LNot(LGreater(BYT2,BYT1)))
+ {Return(36)}
+
+ if(LNot(LLess(BYT1,BYT2)))
+ {Return(37)}
+
+ //test LGreaterEqual with byte data
+ if(LNot(LGreaterEqual(BYT2,BYT1)))
+ {Return(38)}
+
+ //test LLessEqual byte data
+ if(LNot(LLessEqual(BYT1,BYT2)))
+ {Return(39)}
+
+
+ //test on Word data
+ Store(0x1212,WRD1)
+ Store(0x2121,WRD2)
+
+ if(LNot(LGreater(WRD2,WRD1)))
+ {Return(310)}
+
+ if(LNot(LLess(WRD1,WRD2)))
+ {Return(311)}
+
+ //Test LGreaterEqual with Word Data
+ if(LNot(LGreaterEqual(WRD2,WRD1)))
+ {Return(312)}
+
+
+ //Test LLessEqual with Word Data
+ if(LNot(LLessEqual(WRD1,WRD2)))
+ {Return(313)}
+
+ //test on DWord data
+ Store(0x12121212,DWD1)
+ Store(0x21212121,DWD2)
+
+ if(LNot(LGreater(DWD2,DWD1)))
+ {Return(314)}
+
+ if(LNot(LLess(DWD1,DWD2)))
+ {Return(315)}
+
+
+ //Test LGreaterEqual with Dword
+ if(LNot(LGreaterEqual(DWD2,DWD1)))
+ {Return(316)}
+
+ //Test LLessEqual DWord
+ if(LNot(LLessEqual(DWD1,DWD2)))
+ {Return(317)}
+
+ Return(0)
+ }//LSGR
+
+ //The test method
+ Method(TEST)
+ {
+ Store ("++++++++ LOps Test", Debug)
+
+ Store(0,RSLT)
+ //Call LAndOp method
+ Store(ANDL(2,2),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+
+ //Call LOrOp Method
+ Store(ORL_(5,5),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+
+ //Call LSGR Method
+ Store(LSGR(5,7),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+
+ Return(0)
+ }//TEST
+ }//LOPS
+
+//
+// test FdSetOps.asl
+//
+// FindSetLeftBit - Find Set Left Bit
+// FindSetLeftBitTerm := FindSetLeftBit
+// ( Source, //TermArg=>Integer
+// Result //Nothing | SuperName
+// ) => Integer
+// Source is evaluated as integer data type, and the one-based bit location of
+// the first MSb (most significant set bit) is optionally stored into Result.
+// The result of 0 means no bit was set, 1 means the left-most bit set is the
+// first bit, 2 means the left-most bit set is the second bit, and so on.
+// FindSetRightBit - Find Set Right Bit
+
+// FindSetRightBitTerm := FindSetRightBit
+// ( Source, //TermArg=>Integer
+// Result //Nothing | SuperName
+// ) => Integer
+// Source is evaluated as integer data type, and the one-based bit location of
+// the most LSb (least significant set bit) is optionally stored in Result.
+// The result of 0 means no bit was set, 32 means the first bit set is the
+// 32nd bit, 31 means the first bit set is the 31st bit, and so on.
+
+// If the Control method is success Zero is returned. Otherwise a non-zero
+// number is returned.
+//
+ Device (FDSO)
+ { // FDSO
+
+ // Create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ } // Field(RAM)
+
+ // Byte Data
+ Name (BYT1, 1)
+ Name (BRSL, 0x00)
+
+ // Word Data
+ Name (WRD1, 0x100)
+ Name (WRSL, 0x0000)
+
+ // DWord Data
+ Name (DWD1, 0x10000)
+ Name (DRSL, 0x00000000)
+ Name (RSLT, 1)
+ Name (CNTR, 1)
+
+ Method (SHFT,2)
+ // Arg0 is the actual data and Arg1 is the bit position
+ { // SHFT
+ Store (Arg0, Local0)
+ Store (Arg1, Local1)
+
+ FindSetLeftBit (Arg0, BRSL)
+ If (LNotEqual (BRSL, Arg1))
+ { Return (0x11) }
+ If (LNotEqual (Arg0, Local0))
+ { Return (0x12) }
+
+ FindSetLeftBit (Local0, BRSL)
+ If (LNotEqual (BRSL, Local1))
+ { Return (0x13) }
+ If (LNotEqual (Arg0, Local0))
+ { Return (0x14) }
+
+ // test the byte value for SetLeftBit
+ Store (7, BYT1)
+ FindSetLeftBit (BYT1, BRSL)
+ If (LNotEqual (BRSL, 3))
+ { Return (0x15) }
+ If (LNotEqual (BYT1, 7))
+ { Return (0x16) }
+
+ Store (1, BYT1)
+ Store (1, CNTR)
+ While (LLessEqual (CNTR, 8))
+ { // FindSetLeftBit check loop for byte data
+ FindSetLeftBit (BYT1, BRSL)
+ If (LNotEqual (BRSL, CNTR))
+ { Return (0x17) }
+
+ // Shift the bits to check the same
+ ShiftLeft (BYT1, 1, BYT1)
+ Increment (CNTR)
+ } // FindSetLeftBit check loop for byte data
+
+
+ // Check BYTE value for SetRightBit
+ Store (7, BYT1)
+ FindSetRightBit (BYT1, BRSL)
+ If (LNotEqual (BRSL, 1))
+ { Return (0x21) }
+ If (LNotEqual (BYT1, 7))
+ { Return (0x22) }
+
+ Store (1, CNTR)
+ Store (0xFF, BYT1)
+ While (LLessEqual (CNTR, 8))
+ { // FindSetRightBit check loop for byte data
+ FindSetRightBit (BYT1, BRSL)
+ If (LNotEqual (BRSL, CNTR))
+ { Return (0x23) }
+
+ ShiftLeft (BYT1, 1, BYT1)
+ Increment (CNTR)
+ } // FindSetRightBit check loop for byte data
+
+
+ // Test Word value for SetLeftBit
+ Store (9, CNTR)
+ Store (0x100, WRD1)
+ While (LLessEqual (CNTR, 16))
+ {
+ // FindSetLeftBit check loop for Word data
+ FindSetLeftBit (WRD1, WRSL)
+ If (LNotEqual (WRSL, CNTR))
+ { Return (0x31) }
+
+ // Shift the bits to check the same
+ ShiftLeft (WRD1, 1, WRD1)
+ Increment (CNTR)
+ } // FindSetLeftBit check loop for Word data
+
+ // Check Word value for SetRightBit
+ Store (9, CNTR)
+ Store (0xFF00, WRD1)
+ While (LLessEqual (CNTR, 16))
+ {
+ // FindSetRightBit check loop for Word data
+ FindSetRightBit (WRD1, WRSL)
+ If (LNotEqual (WRSL, CNTR))
+ { Return (0x32) }
+
+ ShiftLeft (WRD1, 1, WRD1)
+ Increment (CNTR)
+ } // FindSetRightBit check loop for Word data
+
+ // Test the DWord value for SetLeftBit
+ Store (17, CNTR)
+ Store (0x10000, DWD1)
+ While (LLessEqual (CNTR, 32))
+ {
+ // FindSetLeftBit check loop for Dword
+ FindSetLeftBit (DWD1, DRSL)
+ If (LNotEqual (DRSL, CNTR))
+ { Return (0x41) }
+
+ // Shift the bits to check the same
+ ShiftLeft (DWD1, 1, DWD1)
+ Increment (CNTR)
+ } // FindSetLeftBit check loop for Dword
+
+ // Check DWord value for SetRightBit
+ Store (17, CNTR)
+ Store (0xFFFF0000, DWD1)
+ While (LLessEqual (CNTR, 32))
+ { // FindSetRightBit Check loop for DWORD
+ FindSetRightBit (DWD1, DRSL)
+ If (LNotEqual (DRSL, CNTR))
+ { Return (0x42) }
+
+ ShiftLeft (DWD1, 1, DWD1)
+ Increment (CNTR)
+ } // FindSetRightBit Check loop for DWORD
+
+ Return (0)
+ } // SHFT
+
+ // Test method called from amlexec
+ Method (TEST)
+ { // TEST
+
+ Store ("++++++++ FdSetOps Test", Debug)
+
+ Store (SHFT (0x80, 8), RSLT)
+ If (LNotEqual (RSLT, 0))
+ { Return (RSLT) }
+
+ Return (0) // pass
+ } // TEST
+ } // Device FDSO
+
+//
+// test MulDivOp.asl
+//
+ Device (MLDV)
+ {
+ // create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ } // Field(RAM)
+
+ Method (TEST)
+ {
+ Store ("++++++++ MulDivOp Test", Debug)
+
+ Name (RMDR, 0)
+ Name (DWRD, 0x12345678)
+ Name (WRD, 0x1234)
+ Name (BYT, 0x12)
+
+ // Test MultiplyOp with DWORD data
+ Store (0x12345678, DWRD)
+ Multiply (DWRD, 3, DWRD)
+ If (LNotEqual (DWRD, 0x369D0368))
+ { Return (DWRD) }
+
+ // Test MultiplyOp with WORD data
+ Multiply (WRD, 4, WRD)
+ If (LNotEqual (WRD, 0x48D0))
+ { Return (WRD) }
+
+ // Test MultiplyOp with BYTE data
+ Multiply (BYT, 5, BYT)
+ If (LNotEqual (BYT, 0x5A))
+ { Return (BYT) }
+
+ // Test DivideOp with DWORD data
+ Divide (DWRD, 3, DWRD, RMDR)
+ If (LNotEqual (DWRD, 0x12345678))
+ { Return (DWRD) }
+ If (LNotEqual (RMDR, 0))
+ { Return (RMDR) }
+
+ // Test DivideOp with WORD data
+ Divide (WRD, 4, WRD, RMDR)
+ If (LNotEqual (WRD, 0x1234))
+ { Return (WRD) }
+ If (LNotEqual (RMDR, 0))
+ { Return (RMDR) }
+
+ // Test DivideOp with BYTE data
+ Divide (BYT, 5, BYT, RMDR)
+ If (LNotEqual (BYT, 0x12))
+ { Return (BYT) }
+ If (LNotEqual (RMDR, 0))
+ { Return (RMDR) }
+
+
+ // test MultiplyOp with DWORD SystemMemory OpRegion
+ Store (0x01234567, SMDW)
+ Multiply (SMDW, 2, SMDW)
+ If (LNotEqual (SMDW, 0x02468ACE))
+ { Return (SMDW) }
+
+ // test DivideOp with DWORD SystemMemory OpRegion
+ Divide (SMDW, 3, SMDW, RMDR)
+ If (LNotEqual (SMDW, 0x00C22E44))
+ { Return (SMDW) }
+ If (LNotEqual (RMDR, 2))
+ { Return (RMDR) }
+
+
+ // test MultiplyOp with WORD SystemMemory OpRegion
+ Store (0x0123, SMWD)
+ Multiply (SMWD, 3, SMWD)
+ If (LNotEqual (SMWD, 0x369))
+ { Return (SMWD) }
+
+ // test DivideOp with WORD SystemMemory OpRegion
+ Divide (SMWD, 2, SMWD, RMDR)
+ If (LNotEqual (SMWD, 0x01B4))
+ { Return (SMWD) }
+ If (LNotEqual (RMDR, 1))
+ { Return (RMDR) }
+
+
+ // test MultiplyOp with BYTE SystemMemory OpRegion
+ Store (0x01, SMBY)
+ Multiply (SMBY, 7, SMBY)
+ If (LNotEqual (SMBY, 0x07))
+ { Return (SMBY) }
+
+ // test DivideOp with BYTE SystemMemory OpRegion
+ Divide (SMBY, 4, SMBY, RMDR)
+ If (LNotEqual (SMBY, 0x01))
+ { Return (SMBY) }
+ If (LNotEqual (RMDR, 3))
+ { Return (RMDR) }
+
+ Return (0)
+ } // TEST
+ } // MLDV
+
+//
+// test NBitOps.asl
+//
+//NAnd - Bit-wise NAnd
+//NAndTerm := NAnd(
+// Source1, //TermArg=>Integer
+// Source2 //TermArg=>Integer
+// Result //Nothing | SuperName
+//) => Integer
+//Source1 and Source2 are evaluated as integer data types, a bit-wise NAND is performed, and the result is optionally
+//stored in Result.
+
+//NOr - Bitwise NOr
+//NOrTerm := NOr(
+// Source1, //TermArg=>Integer
+// Source2 //TermArg=>Integer
+// Result //Nothing | SuperName
+//) => Integer
+//Source1 and Source2 are evaluated as integer data types, a bit-wise NOR is performed, and the result is optionally
+//stored in Result.
+// Not - Not
+//NotTerm := Not(
+// Source, //TermArg=>Integer
+// Result //Nothing | SuperName
+//) => Integer
+//Source1 is evaluated as an integer data type, a bit-wise NOT is performed, and the result is optionally stored in
+//Result.
+
+//If the Control method is success Zero is returned else a non-zero number is returned
+
+ Device (NBIT)
+ {//NBIT
+
+ //Create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ }// Field(RAM)
+
+
+ //And with Byte Data
+ Name (BYT1, 0xff)
+ Name (BYT2, 0xff)
+ Name (BRSL, 0x00)
+
+ //And with Word Data
+ Name (WRD1, 0xffff)
+ Name (WRD2, 0xffff)
+ Name (WRSL, 0x0000)
+
+ //And with DWord Data
+ Name (DWD1, 0xffffffff)
+ Name (DWD2, 0xffffffff)
+ Name (DRSL, 0x00000000)
+ Name(RSLT,1)
+
+
+ Name(ARSL,0x00)
+ Name(LRSL,0x00)
+
+ Method(NNDB,2)
+ {//NNDB
+
+ Store(0xffffffff,SMDW)
+ Store(0xffff,SMWD)
+ Store(0xff,SMBY)
+
+
+ NAnd(Arg0,Arg1,ARSL)
+ if(LNotEqual(ARSL,0xfffffffd))
+ {Return(11)}
+
+ Store(Arg0,local0)
+ Store(Arg1,Local1)
+
+ NAnd(Local0,Local1,LRSL)
+ if(LNotEqual(LRSL,0xfffffffd))
+ {Return(12)}
+
+
+ //Byte data
+ NAnd(BYT1,BYT2,BRSL)
+ if(LNotEqual(BRSL,0xffffff00))
+ {Return(13)}
+
+ //Word Data
+ NAnd(WRD1,WRD2,WRSL)
+ if(LNotEqual(WRSL,0xffff0000))
+ {Return(14)}
+
+ //DWord Data
+ NAnd(DWD1,DWD2,DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {Return(15)}
+
+ //Byte data
+ NAnd(SMBY,0xff,BRSL)
+ if(LNotEqual(BRSL,0xffffff00))
+ {Return(16)}
+
+ //Word Data
+ NAnd(SMWD,0xffff,WRSL)
+ if(LNotEqual(WRSL,0xffff0000))
+ {Return(17)}
+
+ //DWord Data
+ NAnd(SMDW,0xffffffff,DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {Return(18)}
+
+ Return(0)
+
+ }//NNDB
+
+ Method(NNOR,2)
+ {//NNOR
+
+ NOr(Arg0,Arg1,ARSL)
+ if(LNotEqual(ARSL,0xfffffffd))
+ {Return(21)}
+
+ Store(Arg0,local0)
+ Store(Arg1,Local1)
+
+ NOr(Local0,Local1,LRSL)
+ if(LNotEqual(LRSL,0xfffffffd))
+ {Return(22)}
+
+
+ //Byte data
+ NOr(BYT1,BYT2,BRSL)
+ if(LNotEqual(BRSL,0xffffff00))
+ {Return(23)}
+
+ //Word Data
+ NOr(WRD1,WRD2,WRSL)
+ if(LNotEqual(WRSL,0xffff0000))
+ {Return(24)}
+
+ //DWord Data
+ NOr(DWD1,DWD2,DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {Return(25)}
+
+ //System Memory Byte data
+ NOr(SMBY,0xff,BRSL)
+ if(LNotEqual(BRSL,0xffffff00))
+ {Return(26)}
+
+ //System Memory Word Data
+ NOr(SMWD,0xffff,WRSL)
+ if(LNotEqual(WRSL,0xffff0000))
+ {Return(27)}
+
+ //System Memory DWord Data
+ NOr(SMDW,0xffffffff,DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {Return(28)}
+
+ Return(0)
+
+ }//NNOR
+
+ Method(NNOT,2)
+ {//NNOT
+
+ Or(Arg0,Arg1,ARSL)
+ Not(ARSL,ARSL)
+ if(LNotEqual(ARSL,0xfffffffd))
+ {Return(31)}
+
+ Store(Arg0,local0)
+ Store(Arg1,Local1)
+
+ Or(Local0,Local1,LRSL)
+ Not(LRSL,LRSL)
+ if(LNotEqual(LRSL,0xfffffffd))
+ {Return(32)}
+
+
+ //Byte data
+ Or(BYT1,BYT2,BRSL)
+ Not(BRSL,BRSL)
+ if(LNotEqual(BRSL,0xffffff00))
+ {Return(33)}
+
+ //Word Data
+ Or(WRD1,WRD2,WRSL)
+ Not(WRSL,WRSL)
+ if(LNotEqual(WRSL,0xffff0000))
+ {Return(34)}
+
+ //DWord Data
+ Or(DWD1,DWD2,DRSL)
+ Not(DRSL,DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {Return(35)}
+
+ //System Memory Byte data
+ Or(SMBY,0xff,BRSL)
+ Not(BRSL,BRSL)
+ if(LNotEqual(BRSL,0xffffff00))
+ {Return(36)}
+
+ //System Memory Word Data
+ Or(SMWD,0xffff,WRSL)
+ Not(WRSL,WRSL)
+ if(LNotEqual(WRSL,0xffff0000))
+ {Return(37)}
+
+ //System Memory DWord Data
+ Or(SMDW,0xffffffff,DRSL)
+ Not(DRSL,DRSL)
+ if(LNotEqual(DRSL,0x00000000))
+ {Return(38)}
+
+ Return(0)
+ }//NNOT
+
+
+ Method(TEST)
+ {
+
+ Store ("++++++++ NBitOps Test", Debug)
+
+ Store(NNDB(2,2),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+
+ Store(NNOR(2,2),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+
+ Store(NNOT(2,2),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+
+
+ Return(0)
+ }
+
+ }//Device NBIT
+
+//
+// test ShftOp.asl
+//
+//ShiftRightTerm := ShiftRight(
+// Source, //TermArg=>Integer
+// ShiftCount //TermArg=>Integer
+// Result //Nothing | SuperName
+//) => Integer
+//Source and ShiftCount are evaluated as integer data types. Source is shifted right with the most significant bit
+//zeroed ShiftCount times. The result is optionally stored into Result.
+
+//ShiftLeft(
+// Source, //TermArg=>Integer
+// ShiftCount //TermArg=>Integer
+// Result //Nothing | SuperName
+//) => Integer
+//Source and ShiftCount are evaluated as integer data types. Source is shifted left with the least significant
+//bit zeroed ShiftCount times. The result is optionally stored into Result.
+
+//If the Control method is success Zero is returned else a non-zero number is returned
+ Device (SHFT)
+ {//SHFT
+
+ //Create System Memory Operation Region and field overlays
+ OperationRegion (RAM, SystemMemory, 0x400000, 0x100)
+ Field (RAM, AnyAcc, NoLock, Preserve)
+ {
+ SMDW, 32, // 32-bit DWORD
+ SMWD, 16, // 16-bit WORD
+ SMBY, 8, // 8-bit BYTE
+ }// Field(RAM)
+
+
+ Name(SHFC,0x00)
+
+ //And with Byte Data
+ Name (BYT1, 0xff)
+ Name (BRSL, 0x00)
+
+ //And with Word Data
+ Name (WRD1, 0xffff)
+ Name (WRSL, 0x0000)
+
+ //And with DWord Data
+ Name (DWD1, 0xffffffff)
+ Name (DRSL, 0x00000000)
+
+ Name(RSLT,1)
+
+ Name(ARSL,0x00)
+ Name(LRSL,0x00)
+
+ Method(SLFT,2)
+ {//SLFT
+
+ Store(0xffffffff,SMDW)
+ Store(0xffff,SMWD)
+ Store(0xff,SMBY)
+
+
+ //Arg0-> 2 & Arg1->2
+ ShiftLeft(Arg0,Arg1,ARSL)
+ if(LNotEqual(ARSL,8))
+ {Return(11)}
+
+ Store(Arg0,local0)
+ Store(Arg1,Local1)
+
+ //Local0->8 and Local1->2
+ ShiftLeft(Local0,Local1,LRSL)
+ if(LNotEqual(LRSL,8))
+ {Return(12)}
+
+ Store(2,SHFC)
+ //Byte data
+ ShiftLeft(BYT1,SHFC,BRSL)
+ if(LNotEqual(BRSL,0x3FC))
+ {Return(13)}
+
+ Store(4,SHFC)
+ //Word Data
+ ShiftLeft(WRD1,SHFC,WRSL)
+ if(LNotEqual(WRSL,0xFFFF0))
+ {Return(14)}
+
+ Store(8,SHFC)
+ //DWord Data
+ ShiftLeft(DWD1,SHFC,DRSL)
+ if(LNotEqual(DRSL,0xFFFFFF00))
+ {Return(15)}
+
+
+ //System Memory Byte data
+ Store(4,SHFC)
+ ShiftLeft(SMBY,SHFC,BRSL)
+ if(LNotEqual(BRSL,0xFF0))
+ {Return(16)}
+
+ //Word Data
+ Store(4,SHFC)
+ ShiftLeft(SMWD,SHFC,WRSL)
+ if(LNotEqual(WRSL,0xffff0))
+ {Return(17)}
+
+ //DWord Data
+ Store(8,SHFC)
+ ShiftLeft(SMDW,SHFC,DRSL)
+ if(LNotEqual(DRSL,0xFFFFFF00))
+ {Return(18)}
+
+ Return(0)
+
+ }//SLFT
+
+ Method(SRGT,2)
+ {//SRGT
+ //And with Byte Data
+ Store (0xff,BYT1)
+ Store (0x00,BRSL)
+
+ //And with Word Data
+ Store (0xffff,WRD1)
+ Store (0x0000,WRSL)
+
+ //And with DWord Data
+ Store(0xffffffff,DWD1)
+ Store (0x00000000,DRSL)
+
+ //Reinitialize the result objects
+ Store(0x00,ARSL)
+ Store(0x00,LRSL)
+
+ Store(0xffffffff,SMDW)
+ Store(0xffff,SMWD)
+ Store(0xff,SMBY)
+
+ //Arg0-> 2 & Arg1->2
+ ShiftRight(Arg0,Arg1,ARSL)
+ if(LNotEqual(ARSL,0))
+ {Return(21)}
+
+ Store(Arg0,local0)
+ Store(Arg1,Local1)
+
+ //Local0->8 and Local1->2
+ ShiftRight(Local0,Local1,LRSL)
+ if(LNotEqual(LRSL,0))
+ {Return(22)}
+
+ Store(2,SHFC)
+ //Byte data
+ ShiftRight(BYT1,SHFC,BRSL)
+ if(LNotEqual(BRSL,0x3F))
+ {Return(23)}
+
+ Store(4,SHFC)
+ //Word Data
+ ShiftRight(WRD1,SHFC,WRSL)
+ if(LNotEqual(WRSL,0xFFF))
+ {Return(24)}
+
+ Store(8,SHFC)
+ //DWord Data
+ ShiftRight(DWD1,SHFC,DRSL)
+ if(LNotEqual(DRSL,0xFFFFFF))
+ {Return(25)}
+
+ //System Memory Byte data
+ Store(4,SHFC)
+ ShiftRight(SMBY,SHFC,BRSL)
+ if(LNotEqual(BRSL,0xF))
+ {Return(26)}
+
+ //Word Data
+ Store(4,SHFC)
+ ShiftRight(SMWD,SHFC,WRSL)
+ if(LNotEqual(WRSL,0xFFF))
+ {Return(27)}
+
+ //DWord Data
+ Store(8,SHFC)
+ ShiftRight(SMDW,SHFC,DRSL)
+ if(LNotEqual(DRSL,0xFFFFFF))
+ {Return(28)}
+
+ Return(0)
+ }//SRGT
+
+ //Test method called from amlexec
+ Method(TEST)
+ {
+ Store ("++++++++ ShftOp Test", Debug)
+
+ Store(SLFT(2,2),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+ Store(SRGT(2,2),RSLT)
+ if(LNotEqual(RSLT,0))
+ {Return(RSLT)}
+ Return(0)
+ }
+
+ }//Device SHFT
+
+//
+// test Xor.asl and slightly modified
+//
+//This code tests the XOR opcode term
+//Syntax of XOR term
+// XOr(
+// Source1 //TermArg=>BufferTerm
+// Source2 //TermArg=>Integer
+// Result //NameString
+// )
+//"Source1" and "Source2" are evaluated as integers, a bit-wise XOR is performed, and the result is optionally stored in
+// Result
+ Device (XORD)
+ {
+ //This Method tests XOr operator for all the data types i.e. BYTE, WORD and DWORD
+ Method (TEST)
+ {
+ Store ("++++++++ Xor Test", Debug)
+
+ //Overlay in system memory
+ OperationRegion (RAM, SystemMemory, 0x800000, 256)
+ Field (RAM, ByteAcc, NoLock, Preserve)
+ {
+ RES1, 1, //Offset
+ BYT1, 8, //First BYTE
+ BYT2, 8, //Second BYTE
+ RBYT, 8, //Result Byte
+ RES2, 1, //Offset
+ WRD1, 16, //First WORD field
+ WRD2, 16, //Second WORD field
+ RWRD, 16, //RSLT WORD field
+ RES3, 1, //Offset
+ DWD1, 32, //First Dword
+ DWD2, 32, //Second Dword
+ RDWD, 32, //Result Dword
+ RES4, 1, //Offset
+ }
+
+ // Store bits in the single bit fields for checking
+ // at the end
+ Store(1, RES1)
+ Store(1, RES2)
+ Store(1, RES3)
+ Store(1, RES4)
+
+ // Check the stored single bits
+ if(LNotEqual(RES1, 1))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES2, 1))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES3, 1))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES4, 1))
+ {
+ Return(1)
+ }
+
+ //************************************************
+ // (BYT1) Bit1 ->0 and (BYT2)Bit2 -> 0 condition
+ Store(0x00,BYT1)
+ Store(0x00,BYT2)
+ XOr(BYT1,BYT2,Local0)
+ Store (Local0, RBYT)
+ if(LNotEqual(RBYT,0))
+ { Return(1)}
+
+ // (BYT1) Bit1 ->1 and (BYT2)Bit2 -> 1 condition
+ Store(0xff,BYT1)
+ Store(0xff,BYT2)
+ XOr(BYT1,BYT2,Local0)
+ Store (Local0, RBYT)
+ if(LNotEqual(RBYT,0))
+ { Return(1)}
+
+ // (BYT1) Bit1 ->1 and (BYT)Bit2 -> 0 condition
+ Store(0x55,BYT1)
+ Store(0xAA,BYT2)
+ XOr(BYT1,BYT2,Local0)
+ Store (Local0, RBYT)
+ if(LNotEqual(RBYT,0xFF))
+ { Return(1)}
+
+ //(BYT1) Bit1 ->0 and (BYT2)Bit2 -> 1 condition
+ Store(0xAA,BYT1)
+ Store(0x55,BYT2)
+ XOr(BYT1,BYT2,Local0)
+ Store (Local0, RBYT)
+ if(LNotEqual(RBYT,0xFF))
+ { Return(1)}
+
+ Store(0x12,BYT1)
+ Store(0xED,BYT2)
+
+ XOr(BYT1,BYT2,Local0)
+ Store (Local0, RBYT)
+ if(LNotEqual(RBYT,0xFF))
+ {
+ Return(1)
+ }
+
+ // Store known values for checking later
+ Store(0x12, BYT1)
+ if(LNotEqual(BYT1, 0x12))
+ {
+ Return(1)
+ }
+
+ Store(0xFE, BYT2)
+ if(LNotEqual(BYT2, 0xFE))
+ {
+ Return(1)
+ }
+
+ Store(0xAB, RBYT)
+ if(LNotEqual(RBYT, 0xAB))
+ {
+ Return(1)
+ }
+
+ //***********************************************
+ // (WRD1) Bit1 ->0 and (WRD2)Bit2 -> 0 condition
+ Store(0x0000,WRD1)
+ Store(0x0000,WRD2)
+ XOr(WRD1,WRD2,RWRD)
+ if(LNotEqual(RWRD,0))
+ { Return(1)}
+
+ // (WRD1) Bit1 ->1 and (WRD2)Bit2 -> 1 condition
+ Store(0xffff,WRD1)
+ Store(0xffff,WRD2)
+ XOr(WRD1,WRD2,RWRD)
+ if(LNotEqual(RWRD,0))
+ { Return(1)}
+
+ // (WRD1) Bit1 ->1 and (WRD2)Bit2 -> 0 condition
+ Store(0x5555,WRD1)
+ Store(0xAAAA,WRD2)
+ XOr(WRD1,WRD2,RWRD)
+ if(LNotEqual(RWRD,0xFFFF))
+ { Return(1)}
+
+ //(WRD1) Bit1 ->0 and (WRD2)Bit2 -> 1 condition
+ Store(0xAAAA,WRD1)
+ Store(0x5555,WRD2)
+ XOr(WRD1,WRD2,RWRD)
+ if(LNotEqual(RWRD,0xFFFF))
+ { Return(1)}
+
+ Store(0x1234,WRD1)
+ Store(0xEDCB,WRD2)
+ XOr(WRD1,WRD2,RWRD)
+ if(LNotEqual(RWRD,0xFFFF))
+ { Return(1)}
+
+ // Store known values for checking later
+ Store(0x1234, WRD1)
+ if(LNotEqual(WRD1, 0x1234))
+ {
+ Return(1)
+ }
+
+ Store(0xFEDC, WRD2)
+ if(LNotEqual(WRD2, 0xFEDC))
+ {
+ Return(1)
+ }
+
+ Store(0x87AB, RWRD)
+ if(LNotEqual(RWRD, 0x87AB))
+ {
+ Return(1)
+ }
+
+
+ //**************************************************
+ // (DWD1) Bit1 ->0 and (DWD2)Bit2 -> 0 condition
+ Store(0x00000000,DWD1)
+ Store(0x00000000,DWD2)
+ XOr(DWD1,DWD2,RDWD)
+ if(LNotEqual(RDWD,0))
+ { Return(1)}
+
+ // (DWD1) Bit1 ->1 and (DWD2)Bit2 -> 1 condition
+ Store(0xffffffff,DWD1)
+ Store(0xffffffff,DWD2)
+ XOr(DWD1,DWD2,RDWD)
+ if(LNotEqual(RDWD,0))
+ { Return(1)}
+
+ // (DWD1) Bit1 ->1 and (DWD2)Bit2 -> 0 condition
+ Store(0x55555555,DWD1)
+ Store(0xAAAAAAAA,DWD2)
+ XOr(DWD1,DWD2,RDWD)
+ if(LNotEqual(RDWD,0xFFFFFFFF))
+ { Return(1)}
+
+ //(DWD1) Bit1 ->0 and (DWD2)Bit2 -> 1 condition
+ Store(0xAAAAAAAA,DWD1)
+ Store(0x55555555,DWD2)
+ XOr(DWD1,DWD2,RDWD)
+ if(LNotEqual(RDWD,0xFFFFFFFF))
+ { Return(1)}
+
+ // (DWD1) Bit1 ->1 and (DWD2)Bit2 -> 0 condition
+ Store(0x12345678,DWD1)
+ Store(0xEDCBA987,DWD2)
+ XOr(DWD1,DWD2,RDWD)
+ if(LNotEqual(RDWD,0xFFFFFFFF))
+ { Return(1)}
+
+ Store(0x12345678,DWD1)
+ if(LNotEqual(DWD1,0x12345678))
+ {
+ Return(1)
+ }
+
+ Store(0xFEDCBA98,DWD2)
+ if(LNotEqual(DWD2,0xFEDCBA98))
+ {
+ Return(1)
+ }
+
+ Store(0x91827364,RDWD)
+ if(LNotEqual(RDWD,0x91827364))
+ {
+ Return(1)
+ }
+
+ //****************************************************
+ // Check the stored single bits
+ if(LNotEqual(RES1, 1))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES2, 1))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES3, 1))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES4, 1))
+ {
+ Return(1)
+ }
+
+ // Change all of the single bit fields to zero
+ Store(0, RES1)
+ Store(0, RES2)
+ Store(0, RES3)
+ Store(0, RES4)
+
+ // Now, check all of the fields
+
+ // Byte
+ if(LNotEqual(BYT1, 0x12))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(BYT2, 0xFE))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RBYT, 0xAB))
+ {
+ Return(1)
+ }
+
+ // Word
+ if(LNotEqual(WRD1, 0x1234))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(WRD2, 0xFEDC))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RWRD, 0x87AB))
+ {
+ Return(1)
+ }
+
+ // Dword
+ if(LNotEqual(DWD1, 0x12345678))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(DWD2, 0xFEDCBA98))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RDWD, 0x91827364))
+ {
+ Return(1)
+ }
+
+ // Bits
+ if(LNotEqual(RES1, 0))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES2, 0))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES3, 0))
+ {
+ Return(1)
+ }
+
+ if(LNotEqual(RES4, 0))
+ {
+ Return(1)
+ }
+
+
+ Return(0)
+ } // TEST
+ } // XORD
+
+//
+// test CrBytFld.asl
+//
+// CrBytFld test
+// Test for CreateByteField.
+// Tests creating byte field overlay of buffer stored in Local0.
+// Tests need to be added for Arg0 and Name buffers.
+//
+ Device (CRBF)
+ { // Test device name
+ Method (TEST)
+ {
+ Store ("++++++++ CrBytFld Test", Debug)
+
+ // Local0 is unitialized buffer with 4 elements
+ Store (Buffer (4) {}, Local0)
+
+ // create Byte Field named BF0 based on Local0 element 0
+ CreateByteField (Local0, 0, BF0)
+
+ // validate CreateByteField did not alter Local0
+ Store (ObjectType (Local0), Local1) // Local1 = Local0 object type
+ If (LNotEqual (Local1, 3)) // Buffer object type value is 3
+ { Return (2) }
+
+ // store something into BF0
+ Store (1, BF0)
+
+ // validate Store did not alter Local0 object type
+ Store (ObjectType (Local0), Local1) // Local1 = Local0 object type
+ If (LNotEqual (Local1, 3)) // Buffer object type value is 3
+ { Return (3) }
+
+ // verify that the Store into BF0 was successful
+ If (LNotEqual (BF0, 1))
+ { Return (4) }
+
+
+ // create Byte Field named BF1 based on Local0 element 1
+ CreateByteField (Local0, 1, BF1)
+
+ // validate CreateByteField did not alter Local0
+ Store (ObjectType (Local0), Local1) // Local1 = Local0 object type
+ If (LNotEqual (Local1, 3)) // Buffer object type value is 3
+ { Return (10) }
+
+ // store something into BF1
+ Store (5, BF1)
+
+ // validate Store did not alter Local0 object type
+ Store (ObjectType (Local0), Local1) // Local1 = Local0 object type
+ If (LNotEqual (Local1, 3)) // Buffer object type value is 3
+ { Return (11) }
+
+ // verify that the Store into BF1 was successful
+ If (LNotEqual (BF1, 5))
+ { Return (12) }
+
+ // verify that the Store into BF1 did not alter BF0
+ If (LNotEqual (BF0, 1))
+ { Return (13) }
+
+
+ // store something into BF0
+ Store (0xFFFF, BF0)
+
+ // verify that the Store into BF0 was successful
+ If (LNotEqual (BF0, 0xFF))
+ { Return (20) }
+
+ // verify that the Store into BF0 did not alter BF1
+ If (LNotEqual (BF1, 5))
+ { Return (21) }
+
+
+ Return (0)
+ } // TEST
+ } // CRBF
+
+//
+// test IndexOp4.asl
+//
+// IndexOp4 test
+// This is just a subset of the many RegionOp/Index Field test cases.
+// Tests access of index fields smaller than 8 bits.
+//
+ Device (IDX4)
+ { // Test device name
+
+ // MADM: Misaligned Dynamic RAM SystemMemory OperationRegion
+ // Tests OperationRegion memory access using misaligned BYTE,
+ // WORD, and DWORD field element accesses. Validation is performed
+ // using both misaligned field entries and aligned field entries.
+ //
+ // MADM returns 0 if all test cases pass or non-zero identifying
+ // the failing test case for debug purposes. This non-zero numbers
+ // are not guaranteed to be in perfect sequence (i.e., test case
+ // index), but are guaranteed to be unique so the failing test
+ // case can be uniquely identified.
+ //
+ Method (MADM, 1) // Misaligned Dynamic RAM SystemMemory OperationRegion
+ // Arg0 -- SystemMemory OperationRegion base address
+ { // MADM: Misaligned Dynamic RAM SystemMemory OperationRegion
+ OperationRegion (RAM, SystemMemory, Arg0, 0x100)
+ Field (RAM, DwordAcc, NoLock, Preserve)
+ { // aligned field definition (for verification)
+ DWD0, 32, // aligned DWORD field
+ DWD1, 32 // aligned DWORD field
+ }
+ Field (RAM, ByteAcc, NoLock, Preserve)
+ { // bit access field definition
+ BIT0, 1, // single bit field entry
+ BIT1, 1, // single bit field entry
+ BIT2, 1, // single bit field entry
+ BIT3, 1, // single bit field entry
+ BIT4, 1, // single bit field entry
+ BIT5, 1, // single bit field entry
+ BIT6, 1, // single bit field entry
+ BIT7, 1, // single bit field entry
+ BIT8, 1, // single bit field entry
+ BIT9, 1, // single bit field entry
+ BITA, 1, // single bit field entry
+ BITB, 1, // single bit field entry
+ BITC, 1, // single bit field entry
+ BITD, 1, // single bit field entry
+ BITE, 1, // single bit field entry
+ BITF, 1, // single bit field entry
+ BI10, 1, // single bit field entry
+ BI11, 1, // single bit field entry
+ BI12, 1, // single bit field entry
+ BI13, 1, // single bit field entry
+ BI14, 1, // single bit field entry
+ BI15, 1, // single bit field entry
+ BI16, 1, // single bit field entry
+ BI17, 1, // single bit field entry
+ BI18, 1, // single bit field entry
+ BI19, 1, // single bit field entry
+ BI1A, 1, // single bit field entry
+ BI1B, 1, // single bit field entry
+ BI1C, 1, // single bit field entry
+ BI1D, 1, // single bit field entry
+ BI1E, 1, // single bit field entry
+ BI1F, 1 // single bit field entry
+ } // bit access field definition
+
+ Field (RAM, ByteAcc, NoLock, Preserve)
+ { // two-bit access field definition
+ B2_0, 2, // single bit field entry
+ B2_1, 2, // single bit field entry
+ B2_2, 2, // single bit field entry
+ B2_3, 2, // single bit field entry
+ B2_4, 2, // single bit field entry
+ B2_5, 2, // single bit field entry
+ B2_6, 2, // single bit field entry
+ B2_7, 2, // single bit field entry
+ B2_8, 2, // single bit field entry
+ B2_9, 2, // single bit field entry
+ B2_A, 2, // single bit field entry
+ B2_B, 2, // single bit field entry
+ B2_C, 2, // single bit field entry
+ B2_D, 2, // single bit field entry
+ B2_E, 2, // single bit field entry
+ B2_F, 2 // single bit field entry
+ } // bit access field definition
+
+ // initialize memory contents using aligned field entries
+ Store (0x5AA55AA5, DWD0)
+ Store (0x5AA55AA5, DWD1)
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BIT0)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT0, 0))
+ { Return (1) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55AA4))
+ { Return (2) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BIT1)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT1, 1))
+ { Return (3) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55AA6))
+ { Return (4) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BIT2)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT2, 0))
+ { Return (5) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55AA2))
+ { Return (6) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BIT3)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT3, 1))
+ { Return (7) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55AAA))
+ { Return (8) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BIT4)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT4, 1))
+ { Return (9) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55ABA))
+ { Return (10) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BIT5)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT5, 0))
+ { Return (11) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55A9A))
+ { Return (12) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BIT6)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT6, 1))
+ { Return (13) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55ADA))
+ { Return (14) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BIT7)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT7, 0))
+ { Return (15) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55A5A))
+ { Return (16) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BIT8)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT8, 1))
+ { Return (17) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55B5A))
+ { Return (18) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BIT9)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BIT9, 0))
+ { Return (19) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA5595A))
+ { Return (20) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BITA)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BITA, 1))
+ { Return (21) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA55D5A))
+ { Return (22) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BITB)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BITB, 0))
+ { Return (23) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA5555A))
+ { Return (24) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BITC)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BITC, 0))
+ { Return (25) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA5455A))
+ { Return (26) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BITD)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BITD, 1))
+ { Return (27) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA5655A))
+ { Return (28) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BITE)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BITE, 0))
+ { Return (29) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA5255A))
+ { Return (30) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BITF)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BITF, 1))
+ { Return (31) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA5A55A))
+ { Return (32) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI10)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI10, 0))
+ { Return (33) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA4A55A))
+ { Return (34) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI11)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI11, 1))
+ { Return (35) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA6A55A))
+ { Return (36) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI12)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI12, 0))
+ { Return (37) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AA2A55A))
+ { Return (38) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI13)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI13, 1))
+ { Return (39) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5AAAA55A))
+ { Return (40) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI14)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI14, 1))
+ { Return (41) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5ABAA55A))
+ { Return (42) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI15)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI15, 0))
+ { Return (43) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5A9AA55A))
+ { Return (44) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI16)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI16, 1))
+ { Return (45) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5ADAA55A))
+ { Return (46) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI17)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI17, 0))
+ { Return (47) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5A5AA55A))
+ { Return (48) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI18)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI18, 1))
+ { Return (49) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5B5AA55A))
+ { Return (50) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI19)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI19, 0))
+ { Return (51) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x595AA55A))
+ { Return (52) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI1A)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI1A, 1))
+ { Return (53) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x5D5AA55A))
+ { Return (54) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI1B)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI1B, 0))
+ { Return (55) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x555AA55A))
+ { Return (56) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI1C)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI1C, 0))
+ { Return (57) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x455AA55A))
+ { Return (58) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI1D)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI1D, 1))
+ { Return (59) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x655AA55A))
+ { Return (60) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, BI1E)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI1E, 0))
+ { Return (61) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x255AA55A))
+ { Return (62) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, BI1F)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (BI1F, 1))
+ { Return (63) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55AA55A))
+ { Return (64) }
+
+
+ // set memory contents to known values using misaligned field entries
+ Store (3, B2_0)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_0, 3))
+ { Return (65) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55AA55B))
+ { Return (66) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, B2_1)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_1, 1))
+ { Return (67) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55AA557))
+ { Return (68) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, B2_2)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_2, 0))
+ { Return (69) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55AA547))
+ { Return (70) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (3, B2_3)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_3, 3))
+ { Return (71) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55AA5C7))
+ { Return (72) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (3, B2_4)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_4, 3))
+ { Return (73) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55AA7C7))
+ { Return (74) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, B2_5)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_5, 0))
+ { Return (75) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55AA3C7))
+ { Return (76) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, B2_6)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_6, 1))
+ { Return (77) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55A93C7))
+ { Return (78) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, B2_7)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_7, 1))
+ { Return (79) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55A53C7))
+ { Return (80) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, B2_8)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_8, 0))
+ { Return (81) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55853C7))
+ { Return (82) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, B2_9)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_9, 1))
+ { Return (83) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA55453C7))
+ { Return (84) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (2, B2_A)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_A, 2))
+ { Return (85) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA56453C7))
+ { Return (86) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (2, B2_B)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_B, 2))
+ { Return (87) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA5A453C7))
+ { Return (88) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (3, B2_C)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_C, 3))
+ { Return (89) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xA7A453C7))
+ { Return (90) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (3, B2_D)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_D, 3))
+ { Return (91) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0xAFA453C7))
+ { Return (92) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (1, B2_E)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_E, 1))
+ { Return (93) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x9FA453C7))
+ { Return (94) }
+
+ // set memory contents to known values using misaligned field entries
+ Store (0, B2_F)
+ // verify memory contents using misaligned field entries
+ If (LNotEqual (B2_F, 0))
+ { Return (95) }
+ // verify memory contents using aligned field entries
+ If (LNotEqual (DWD0, 0x1FA453C7))
+ { Return (96) }
+
+
+ Return (0) // pass
+ } // MADM: Misaligned Dynamic RAM SystemMemory OperationRegion
+
+ Method (TEST)
+ {
+ Store ("++++++++ IndexOp4 Test", Debug)
+
+ // MADM (Misaligned Dynamic RAM SystemMemory OperationRegion) arguments:
+ // Arg0 -- SystemMemory OperationRegion base address
+ Store (MADM (0x800000), Local0)
+ If (LNotEqual (Local0, 0)) // MADM returns zero if successful
+ { Return (Local0) } // failure: return MADM error code
+
+ Return (Local0)
+ } // TEST
+ } // IDX4
+
+//
+// test Event.asl
+//
+// EventOp, ResetOp, SignalOp, and WaitOp test cases.
+//
+ Device (EVNT)
+ {
+ Event (EVNT) // event synchronization object
+
+ Method (TEVN, 1)
+ // Arg0: time to Wait for event in milliseconds
+ { // TEVN control method to test ResetOp, SignalOp, and WaitOp
+ // reset EVNT to initialization (zero) state
+ Reset (EVNT)
+
+ // prime EVNT with two outstanding signals
+ Signal (EVNT)
+ Signal (EVNT)
+
+
+ // acquire existing signal
+ Store (Wait (EVNT, Arg0), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x21) } // Local1 indicates Local0 is not a Number
+
+ If (LNotEqual (Local0, 0)) // Number is type 1
+ { Return (0x22) } // timeout occurred without acquiring signal
+
+ Store ("Acquire 1st existing signal PASS", Debug)
+
+
+ // acquire existing signal
+ Store (Wait (EVNT, Arg0), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x31) } // Local1 indicates Local0 is not a Number
+
+ If (LNotEqual (Local0, 0)) // Number is type 1
+ { Return (0x32) } // timeout occurred without acquiring signal
+
+ Store ("Acquire 2nd existing signal PASS", Debug)
+
+
+ // ensure WaitOp timeout test cases do not hang
+ if (LEqual (Arg0, 0xFFFF))
+ { Store (0xFFFE, Arg0) }
+
+ // acquire non-existing signal
+ Store (Wait (EVNT, Arg0), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x41) } // Local1 indicates Local0 is not a Number
+
+ If (LEqual (Local0, 0)) // Number is type 1
+ { Return (0x42) } // non-existant signal was acquired
+
+ Store ("Acquire signal timeout PASS", Debug)
+
+
+ // prime EVNT with two outstanding signals
+ Signal (EVNT)
+ Signal (EVNT)
+
+ // reset EVNT to initialization (zero) state
+ Reset (EVNT)
+
+ // acquire non-existing signal
+ Store (Wait (EVNT, Arg0), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x51) } // Local1 indicates Local0 is not a Number
+
+ If (LEqual (Local0, 0)) // Number is type 1
+ { Return (0x52) } // non-existant signal was acquired
+
+ Store ("Reset signal PASS", Debug)
+
+
+ // acquire non-existing signal using Lvalue timeout
+ Store (Wait (EVNT, Zero), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x61) } // Local1 indicates Local0 is not a Number
+
+ If (LEqual (Local0, 0)) // Number is type 1
+ { Return (0x62) } // non-existant signal was acquired
+
+ Store ("Zero Lvalue PASS", Debug)
+
+
+ // acquire non-existing signal using Lvalue timeout
+ Store (Wait (EVNT, One), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x71) } // Local1 indicates Local0 is not a Number
+
+ If (LEqual (Local0, 0)) // Number is type 1
+ { Return (0x72) } // non-existant signal was acquired
+
+ Store ("One Lvalue PASS", Debug)
+
+ // Lvalue Event test cases
+ // ILLEGAL SOURCE OPERAND Store (EVNT, Local2)
+
+ // validate Local2 is an Event
+ Store (ObjectType (EVNT), Local1)
+ If (LNotEqual (Local1, 7)) // Event is type 7
+ { Return (0x81) } // Local1 indicates Local0 is not a Number
+
+ // reset EVNT to initialization (zero) state
+ Reset (EVNT)
+
+ // prime EVNT with two outstanding signals
+ Signal (EVNT)
+
+ // acquire existing signal
+ Store (Wait (EVNT, Arg0), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x82) } // Local1 indicates Local0 is not a Number
+
+ If (LNotEqual (Local0, 0)) // Number is type 1
+ { Return (0x83) } // timeout occurred without acquiring signal
+
+ Store ("Acquire Lvalue existing signal PASS", Debug)
+
+
+ // acquire non-existing signal
+ Store (Wait (EVNT, Arg0), Local0)
+
+ // validate Local0 is a Number
+ Store (ObjectType (Local0), Local1)
+ If (LNotEqual (Local1, 1)) // Number is type 1
+ { Return (0x84) } // Local1 indicates Local0 is not a Number
+
+ If (LEqual (Local0, 0)) // Number is type 1
+ { Return (0x85) } // non-existant signal was acquired
+
+ Store ("Acquire Lvalue signal timeout PASS", Debug)
+
+
+ Return (0) // success
+ } // TEVN control method to test ResetOp, SignalOp, and WaitOp
+
+ Method (TEST)
+ {
+ Store ("++++++++ Event Test", Debug)
+
+ Store (TEVN (100), Local0)
+
+ Return (Local0)
+ } // TEST
+ } // EVNT
+
+//
+// test SizeOfLv.asl
+//
+// Test for SizeOf (Lvalue)
+//
+// This next section will contain the packages that the SizeOfOp will be
+// exercised on. The first one, PKG0, is a regular package of 3 elements.
+// The 2nd one, PKG1, is a nested package with 3 packages inside it, each
+// with 3 elements. It is expected that SizeOf operator will return the
+// same value for these two packages since they both have 3 elements. The
+// final package, PKG2, has 4 elements and the SizeOf operator is expected
+// to return different results for this package.
+
+ Name (PKG0,
+ Package (3)
+ {0x0123, 0x4567, 0x89AB}
+ ) // PKG0
+
+ Name (PKG1,
+ Package (3)
+ {
+ Package (3) {0x0123, 0x4567, 0x89AB},
+ Package (3) {0xCDEF, 0xFEDC, 0xBA98},
+ Package (3) {0x7654, 0x3210, 0x1234}
+ }
+ ) // PKG1
+
+ Name (PKG2,
+ Package (4)
+ {0x0123, 0x4567, 0x89AB, 0x8888}
+ ) // PKG2
+
+ Name (PKG3,
+ Package (5)
+ {0x0123, 0x4567, 0x89AB, 0x8888, 0x7777}
+ ) // PKG3
+
+// End Packages **********************************************************
+
+// The following section will declare the data strings that will be used to
+// exercise the SizeOf operator. STR0 and STR1 are expected to be equal,
+// STR2 is expected to have a different SizeOf value than STR0 and STR1.
+
+ Name (STR0, "ACPI permits very flexible methods of expressing a system")
+
+ Name (STR1, "MIKE permits very flexible methods of expressing a system")
+
+ Name (STR2, "Needless to say, Mike and ACPI are frequently at odds")
+
+// This string is being made in case we want to do a SizeOf comparison
+// between strings and packages or buffers
+ Name (STR3, "12345")
+
+// End Strings **********************************************************
+
+// The following section will declare the buffers that will be used to exercise
+// the SizeOf operator.
+
+ Name (BUF0, Buffer (10) {})
+ Name (BUF1, Buffer (10) {})
+ Name (BUF2, Buffer (8) {})
+ Name (BUF3, Buffer (5) {})
+
+// End Buffers **********************************************************
+ Device (SZLV)
+ {
+
+ Method (CMPR, 2)
+ {
+ // CMPR is passed two arguments. If unequal, return 1 to indicate
+ // that, otherwise return 0 to indicate SizeOf each is equal.
+
+ Store (0x01, Local0)
+
+ if (LEqual (SizeOf(Arg0), SizeOf(Arg1)))
+ {
+ Store (0x00, Local0)
+ }
+
+ return (Local0)
+ } // CMPR
+
+
+ Method (TEST)
+ {
+
+ Store ("++++++++ SizeOfLv Test", Debug)
+
+ // TBD: SizeOf ("string")
+ // SizeOf (Buffer)
+ // SizeOf (Package)
+ // SizeOf (String)
+ // SizeOf (STR0) -- where Name (STR0,...) -- lot's of cases
+ // buffer, string, package,
+ // SizeOf (METH) -- where METH control method returns
+ // buffer, string, package,
+
+ // TBD: SLOC [SizeOf (Local0)] -- dup SARG
+
+ // Compare the elements that we expect to be the same. Exit out with an error
+ // code on the first failure.
+ if (LNotEqual (0x00, CMPR (STR0, STR1)))
+ {
+ Return (0x01)
+ }
+
+ if (LNotEqual (0x00, CMPR (STR3, BUF3)))
+ {
+ Return (0x02)
+ }
+
+ if (LNotEqual (0x00, CMPR (STR3, PKG3)))
+ {
+ Return (0x03)
+ }
+
+ // In the following section, this test will cover the SizeOf
+ // operator for Local values.
+ // In this case, both Local0 and Local1 should have the same Size
+ Store (STR0, Local0)
+ Store (STR1, Local1)
+
+ if (LNotEqual (SizeOf (Local0), SizeOf (Local1)))
+ {
+ Return (0x04)
+ }
+
+ // Now create a case where Local0 and Local1 are different
+ Store (STR2, Local1)
+
+ if (LEqual (SizeOf (Local0), SizeOf (Local1)))
+ {
+ Return (0x05)
+ }
+
+ // Finally, check for the return of SizeOf for a known Buffer. Just
+ // in case we magically pass above cases due to all Buffers being Zero
+ // bytes in size, or Infinity, etc.
+ if (LNotEqual (0x05, SizeOf (BUF3)))
+ {
+ Return (0x06)
+ }
+
+ Return (0)
+ } // TEST
+ } // SZLV
+
+
+//
+// test BytField.asl
+//
+// BytField test
+// This is just a subset of the many RegionOp/Index Field test cases.
+// Tests access of TBD.
+//
+ Scope (\_SB) // System Bus
+ { // _SB system bus
+ Device (BYTF)
+ { // Test device name
+ Method (TEST)
+ {
+ Store ("++++++++ BytField Test", Debug)
+
+ Return (\_TZ.C19B.RSLT)
+ } // TEST
+ } // BYTF
+
+ Device (C005)
+ { // Device C005
+ Device (C013)
+ { // Device C013
+ } // Device C013
+ } // Device C005
+
+ Method (C115)
+ { // C115 control method
+ Acquire (\_GL, 0xFFFF)
+ Store (\_SB.C005.C013.C058.C07E, Local0)
+ Release (\_GL)
+ And (Local0, 16, Local0)
+ Store (ShiftRight (Local0, 4, ), Local1)
+ If (LEqual (Local1, 0))
+ { Return (1) }
+ Else
+ { Return (0) }
+ } // C115 control method
+ } // _SB system bus
+
+ OperationRegion (C018, SystemIO, 0x5028, 4)
+ Field (C018, AnyAcc, NoLock, Preserve)
+ { // Field overlaying C018
+ C019, 32
+ } // Field overlaying C018
+
+ OperationRegion (C01A, SystemIO, 0x5030, 4)
+ Field (C01A, ByteAcc, NoLock, Preserve)
+ { // Field overlaying C01A
+ C01B, 8,
+ C01C, 8,
+ C01D, 8,
+ C01E, 8
+ } // Field overlaying C01A
+
+ Mutex (\C01F, 0)
+ Name (\C020, 0)
+ Name (\C021, 0)
+
+ Method (\C022, 0)
+ { // \C022 control method
+ Acquire (\C01F, 0xFFFF)
+ If (LEqual (\C021, 0))
+ {
+ Store (C019, Local0)
+ And (Local0, 0xFFFEFFFE, Local0)
+ Store (Local0, C019)
+ Increment (\C021)
+ }
+ Release (\C01F)
+ } // \C022 control method
+
+ Scope (\_SB.C005.C013)
+ { // Scope \_SB.C005.C013
+ Device (C058)
+ { // Device C058
+ Name (_HID, "*PNP0A06")
+
+ OperationRegion (C059, SystemIO, 0xE0, 2)
+ Field (C059, ByteAcc, NoLock, Preserve)
+ { // Field overlaying C059
+ C05A, 8,
+ C05B, 8
+ } // Field overlaying C059
+
+ OperationRegion (C05C, SystemIO, 0xE2, 2)
+ Field (C05C, ByteAcc, NoLock, Preserve)
+ { // Field overlaying C05C
+ C05D, 8,
+ C05E, 8
+ } // Field overlaying C05C
+ IndexField (C05D, C05E, ByteAcc, NoLock, Preserve)
+ { // IndexField overlaying C05D/C05E
+ , 0x410, // skip
+ C05F, 8,
+ C060, 8,
+ C061, 8,
+ C062, 8,
+ C063, 8,
+ C064, 8,
+ C065, 8,
+ C066, 8,
+ C067, 8,
+ C068, 8,
+ C069, 8,
+ C06A, 8,
+ C06B, 8,
+ C06C, 8,
+ C06D, 8,
+ C06E, 8,
+ , 0x70, // skip
+ C06F, 8,
+ C070, 8,
+ C071, 8,
+ C072, 8,
+ C073, 8,
+ C074, 8,
+ C075, 8,
+ C076, 8,
+ C077, 8,
+ C078, 8,
+ C079, 8,
+ C07A, 8,
+ C07B, 8,
+ C07C, 8,
+ C07D, 8,
+ C07E, 8
+ } // IndexField overlaying C05D/C05E
+
+ OperationRegion (C07F, SystemIO, 0xE4, 2)
+ Field (C07F, ByteAcc, NoLock, Preserve)
+ { // Field overlaying C07F
+ C080, 8,
+ C081, 8
+ } // Field overlaying C07F
+
+ OperationRegion (C082, SystemIO, 0xE0, 1)
+ Field (C082, ByteAcc, NoLock, Preserve)
+ { // Field overlaying C082
+ C083, 8
+ } // Field overlaying C082
+
+ OperationRegion (C084, SystemIO, 0xFF, 1)
+ Field (C084, ByteAcc, NoLock, Preserve)
+ { // Field overlaying C084
+ C085, 8
+ } // Field overlaying C084
+
+ OperationRegion (C086, SystemIO, 0xFD, 1)
+ Field (C086, ByteAcc, NoLock, Preserve)
+ { // Field overlaying C086
+ C087, 8
+ } // Field overlaying C086
+
+ Mutex (C088, 0)
+ Mutex (C089, 0)
+ Mutex (C08A, 0)
+ Mutex (C08B, 0)
+ Mutex (C08C, 0)
+ Mutex (C08D, 0)
+
+ Name (C08E, 0xFFFFFFFD)
+ Name (C08F, 0)
+
+ Method (C0AA, 4)
+ { // C0AA control method
+ Store (Buffer (4) {}, Local7)
+ CreateByteField (Local7, 0, C0AB)
+ CreateByteField (Local7, 1, C0AC)
+ CreateByteField (Local7, 2, C0AD)
+ CreateByteField (Local7, 3, C0AE)
+ Acquire (^C08B, 0xFFFF)
+ Acquire (\_GL, 0xFFFF)
+ \C022 ()
+ Store (1, \_SB.C005.C013.C058.C06B)
+ While (LNot (LEqual (0, \_SB.C005.C013.C058.C06B)))
+ { Stall (100) }
+ Store (Arg3, \_SB.C005.C013.C058.C06E)
+ Store (Arg2, \_SB.C005.C013.C058.C06D)
+ Store (Arg1, \_SB.C005.C013.C058.C06C)
+ Store (Arg0, \_SB.C005.C013.C058.C06B)
+ While (LNot (LEqual (0, \_SB.C005.C013.C058.C06B)))
+ { Stall (100) }
+ Store (\_SB.C005.C013.C058.C06E, C0AB)
+ Store (\_SB.C005.C013.C058.C06D, C0AC)
+ Store (\_SB.C005.C013.C058.C06C, C0AD)
+ Store (\_SB.C005.C013.C058.C06B, C0AE)
+ If (LNot (LEqual (Arg0, 23)))
+ {
+ Store (2, \_SB.C005.C013.C058.C06B)
+ Stall (100)
+ }
+ Release (\_GL)
+ Release (^C08B)
+ Return (Local7)
+ } // C0AA control method
+ } // Device C058
+ } // Scope \_SB.C005.C013
+
+ Scope (\_TZ)
+ { // \_TZ thermal zone scope
+ Name (C18B, Package (2)
+ {
+ Package (2)
+ {
+ Package (5) {0x05AC, 0x0CD2, 0x0D68, 0x0DE0, 0x0E4E},
+ Package (5) {0x0D04, 0x0D9A, 0x0DFE, 0x0E80, 0x0FA2}
+ },
+ Package (2)
+ {
+ Package (5) {0x05AC, 0x0CD2, 0x0D68, 0x0DE0, 0x0E4E},
+ Package (5) {0x0D04, 0x0D9A, 0x0DFE, 0x0E80, 0x0FA2}
+ }
+ }) // C18B
+
+ Name (C18C, Package (2)
+ {
+ Package (2)
+ {
+ Package (3) {0x64, 0x4B, 0x32},
+ Package (3) {0x64, 0x4B, 0x32}
+ }
+ }) // C81C
+
+ Name (C18D, 0)
+ Name (C18E, 0)
+ Name (C18F, 0)
+ Name (C190, 0)
+ Name (C191, 3)
+ Name (C192, 0)
+ Name (C193, 1)
+ Name (C194, 2)
+ Mutex (C195, 0)
+ Name (C196, 1)
+ Name (C197, 0x0B9C)
+ Name (C198, 0x0B9C)
+ Name (C199, 0xFFFFFFFD)
+ Name (C19A, 0)
+
+ Device (C19B)
+ { // Device C19B
+ Name (RSLT, 0) // default to zero
+
+ Method (XINI)
+ { // _INI control method (Uses Global Lock -- can't run under AcpiExec)
+ Store (\_SB.C115, C19A)
+ \_TZ.C19C._SCP (0)
+ Subtract (0x0EB2, 0x0AAC, Local1) // Local1 = AACh - EB2h
+ Divide (Local1, 10, Local0, Local2) // Local0 = Local1 / 10
+ // Local2 = Local1 % 10
+ \_SB.C005.C013.C058.C0AA (14, Local2, 0, 0)
+ Store
+ (DerefOf (Index (DerefOf (Index (\_TZ.C18C, C19A, )), 0, )), C18D)
+ Store
+ (DerefOf (Index (DerefOf (Index (\_TZ.C18C, C19A, )), 1, )), C18E)
+ Store
+ (DerefOf (Index (DerefOf (Index (\_TZ.C18C, C19A, )), 2, )), C18F)
+
+ Store (1, RSLT) // set RSLT to 1 if _INI control method completes
+ } // _INI control method
+
+ // PowerResource (C19D) {...}
+ } // Device C19B
+
+ ThermalZone (C19C)
+ {
+ Method (_SCP, 1)
+ { // _SCP control method
+ Store (Arg0, Local0)
+ If (LEqual (Local0, 0))
+ {
+ Store (0, \_TZ.C192)
+ Store (1, \_TZ.C193)
+ Store (2, \_TZ.C194)
+ Store (3, \_TZ.C191)
+ }
+ Else
+ {
+ Store (0, \_TZ.C191)
+ Store (1, \_TZ.C192)
+ Store (2, \_TZ.C193)
+ Store (3, \_TZ.C194)
+ }
+ } // _SCP control method
+ } // ThermalZone C19C
+ } // \_TZ thermal zone scope
+
+
+//
+// test DwrdFld.asl
+//
+ Name (BUFR, buffer(10) {0,0,0,0,0,0,0,0,0,0} )
+
+ Device (DWDF)
+ {
+ Method (TEST)
+ {
+ Store ("++++++++ DwrdFld Test", Debug)
+
+ CreateByteField (BUFR, 0, BYTE)
+ Store (0xAA, BYTE)
+
+ CreateWordField (BUFR, 1, WORD)
+ Store (0xBBCC, WORD)
+
+ CreateDWordField (BUFR, 3, DWRD)
+ Store (0xDDEEFF00, DWRD)
+
+ CreateByteField (BUFR, 7, BYT2)
+ Store (0x11, BYT2)
+
+ CreateWordField (BUFR, 8, WRD2)
+ Store (0x2233, WRD2)
+
+ Return (0)
+
+ } // End Method TEST
+ } // Device DWDF
+
+ //
+ // test DivAddx.asl
+ //
+ Name (B1LO, 0xAA)
+ Name (B1HI, 0xBB)
+
+ Method (MKW_, 2)
+ { // This control method will take two bytes and make them into a WORD
+
+ Multiply (B1HI, 256, Local0) // Make high byte.....high
+ Or (Local0, B1LO, Local0) // OR in the low byte
+ Return (Local0) // Return the WORD
+
+ } // MKW_
+
+ Device (DVAX)
+ {
+ Method (TEST)
+ {
+
+ Store ("++++++++ DivAddx Test", Debug)
+
+ Store (25, B1LO)
+ Store (0, B1HI)
+
+ // We'll multiply 25 * 3 to get 75, add 99 to it then divide
+ // by 100. We expect to get 74 for the remainder and 1 for
+ // the quotient.
+ Divide(
+ Add (Multiply (3, MKW_ (B1LO, B1HI)), 0x63),
+ // Dividend,
+ 100, // Divisor
+ Local4, // Remainder
+ Local2) // Quotient
+
+ If (LAnd (LEqual (74, Local4), LEqual (1, Local2)))
+ { // Indicate Pass
+ Store (0x00, Local0)
+ }
+
+ Else
+ { // Indicate Fail
+ Store (0x01, Local0)
+ }
+
+ Return (Local0)
+ } // End Method TEST
+ } // Device DVAX
+
+//
+// test IndexFld.asl (IndexOp6.asl)
+//
+// IndexFld test
+// This is just a subset of the many RegionOp/Index Field test cases.
+// Tests index field element AccessAs macro.
+// Also tests name resolution of index field elements with same names
+// but different namespace scopes.
+//
+ Device (IDX6)
+ { // Test device name
+
+ OperationRegion (SIO, SystemIO, 0x100, 2)
+ Field (SIO, ByteAcc, NoLock, Preserve)
+ {
+ INDX, 8,
+ DATA, 8
+ }
+ IndexField (INDX, DATA, AnyAcc, NoLock, WriteAsOnes)
+ {
+ AccessAs (ByteAcc, 0),
+ IFE0, 8,
+ IFE1, 8,
+ IFE2, 8,
+ IFE3, 8,
+ IFE4, 8,
+ IFE5, 8,
+ IFE6, 8,
+ IFE7, 8,
+ IFE8, 8,
+ IFE9, 8,
+ }
+
+ Device (TST_)
+ { // TST_: provides a different namespace scope for IFE0 and IFE1
+ OperationRegion (SIO2, SystemIO, 0x100, 2)
+ Field (SIO2, ByteAcc, NoLock, Preserve)
+ {
+ IND2, 8,
+ DAT2, 8
+ }
+ IndexField (IND2, DAT2, AnyAcc, NoLock, WriteAsOnes)
+ {
+ IFE0, 8, // duplicate IndexField name with different scope
+ IFE1, 8
+ }
+ } // TST_: provides a different namespace scope for IFE0 and IFE1
+
+ Method (TEST)
+ {
+ Store ("++++++++ IndexOp6 Test", Debug)
+
+ Store (IFE0, Local0)
+ Store (IFE1, Local1)
+ Store (IFE2, Local2)
+
+ // validate name resolution of IndexFields with different scopes
+ Store (\IDX6.IFE0, Local3)
+ Store (\IDX6.IFE1, Local4)
+ // verioading of namespace can resolve following names
+ Store (\IDX6.TST_.IFE0, Local5)
+ Store (\IDX6.TST_.IFE1, Local6)
+
+ Return (0)
+ } // TEST
+ } // IDX6
+
+//
+// test IndexOp5.asl
+//
+// IndexOp5 test
+// This is just a subset of the many RegionOp/Index Field test cases.
+// Tests copying string into buffer then performing IndexOp on result.
+//
+ Device (IDX5)
+ { // Test device name
+
+ Name (OSFL, 0) // 0 == Windows 98, 1 == Windows NT
+
+ // MCTH is a control method to compare two strings. It returns
+ // zero if the strings mismatch, or 1 if the strings match.
+ // This exercises the test case of copying a string into a buffer
+ // and performing an IndexOp on the resulting buffer.
+ Method (MCTH, 2) // Control Method to compare two strings
+ { // MCTH: Control Method to compare two strings
+ // Arg0: first string to compare
+ // Arg1: second string to compare
+ // Return: zero if strings mismatch, 1 if strings match
+
+ // check if first string's length is less than second string's length
+ If (LLess (SizeOf (Arg0), SizeOf (Arg1)))
+ { Return (0) }
+
+ // increment length to include NULL termination character
+ Add (SizeOf (Arg0), 1, Local0) // Local0 = strlen(Arg0) + 1
+
+ // create two buffers of size Local0 [strlen(Arg0)+1]
+ Name (BUF0, Buffer (Local0) {})
+ Name (BUF1, Buffer (Local0) {})
+
+ // copy strings into buffers
+ Store (Arg0, BUF0)
+ Store (Arg1, BUF1)
+
+ // validate BUF0 and BUF1 are still buffers
+ Store (ObjectType (BUF0), Local1)
+ If (LNotEqual (Local1, 3)) // Buffer is type 3
+ { Return (20) }
+ Store (ObjectType (BUF1), Local1)
+ If (LNotEqual (Local1, 3)) // Buffer is type 3
+ { Return (21) }
+
+ // Decrement because the Index base below is zero based
+ // while Local0 length is one based.
+ Decrement (Local0)
+
+ While (Local0)
+ { // loop through all BUF0 buffer elements
+ Decrement (Local0)
+
+ // check if BUF0[n] == BUF1[n]
+ If (LEqual (DerefOf (Index (BUF0, Local0, )),
+ DerefOf (Index (BUF1, Local0, ))))
+ { } // this is how the code was really implemented
+ Else
+ { Return (Zero) }
+ } // loop through all BUF0 buffer elements
+
+ Return (One) // strings / buffers match
+ } // MCTH: Control Method to compare two strings
+
+
+ Method (TEST)
+ {
+ Store ("++++++++ IndexOp5 Test", Debug)
+
+ If (MCTH (\_OS, "Microsoft Windows NT"))
+ { Store (1, OSFL) }
+
+ If (LNotEqual (OSFL, 1))
+ { Return (11) }
+
+ Return (0)
+ } // TEST
+ } // IDX5
+
+//
+// test IndexOp.asl
+//
+ Scope (\_SB) // System Bus
+ { // _SB system bus
+
+ Method (C097)
+ { Return (1) }
+
+ Device (PCI2)
+ { // Root PCI Bus
+ Name (_HID, EISAID("PNP0A03"))
+ Name (_ADR, 0x00000000)
+ Name (_CRS, Buffer(26) {"\_SB_.PCI2._CRS..........."})
+ Method (_STA) {Return (0x0F)}
+
+ Device (ISA)
+ { // ISA bridge
+ Name (_ADR, 0x00030000) // ISA bus ID
+
+ Device (EC0)
+ { // Embedded Controller
+ Name