Import ACPICA 20171110.

This commit is contained in:
Jung-uk Kim 2017-11-10 17:54:38 +00:00
parent 2c673001fb
commit e692a0ddd0
46 changed files with 1990 additions and 993 deletions

View File

@ -1,3 +1,56 @@
----------------------------------------
10 November 2017. Summary of changes for version 20171110:
1) ACPICA kernel-resident subsystem:
This release implements full support for ACPI 6.2A:
NFIT - Added a new subtable, "Platform Capabilities Structure"
No other changes to ACPICA were required, since ACPI 6.2A is primarily an
errata release of the specification.
Other ACPI table changes:
IORT: Added the SMMUv3 Device ID mapping index. Hanjun Guo
PPTT: Added cache attribute flag definitions to actbl1.h. Jeremy
Linton
Utilities: Modified the string/integer conversion functions to use
internal 64-bit divide support instead of a native divide. On 32-bit
platforms, a 64-bit divide typically requires a library function which
may not be present in the build (kernel or otherwise).
Implemented a targeted error message for timeouts returned from the
Embedded Controller device driver. This is seen frequently enough to
special-case an AE_TIME returned from an EC operation region access:
"Timeout from EC hardware or EC device driver"
Changed the "ACPI Exception" message prefix to "ACPI Error" so that all
runtime error messages have the identical prefix.
2) iASL Compiler/Disassembler and Tools:
AcpiXtract: Fixed a problem with table header detection within the
acpidump file. Processing a table could be ended early if a 0x40 (@)
appears in the original binary table, resulting in the @ symbol appearing
in the decoded ASCII field at the end of the acpidump text line. The
symbol caused acpixtract to incorrectly think it had reached the end of
the current table and the beginning of a new table.
AcpiXtract: Added an option (-f) to ignore some errors during table
extraction. This initial implementation ignores non-ASCII and non-
printable characters found in the acpidump text file.
TestSuite(ASLTS)/AcpiExec: Fixed and restored the memory usage statistics
for ASLTS. This feature is used to track memory allocations from
different memory caches within the ACPICA code. At the end of an ASLTS
run, these memory statistics are recorded and stored in a log file.
Debugger (user-space version): Implemented a simple "Background" command.
Creates a new thread to execute a control method in the background, while
control returns to the debugger prompt to allow additional commands.
Syntax: Background <Namepath> [Arguments]
----------------------------------------
29 September 2017. Summary of changes for version 20170929:

View File

@ -35,7 +35,7 @@
.SUFFIXES :
PROGS = acpibin acpidump acpiexamples acpiexec acpihelp acpinames acpisrc acpixtract iasl
HOST ?= _CYGWIN
CC = gcc
CC ?= gcc
#
# Common defines

View File

@ -45,9 +45,11 @@ OBJECTS = \
$(OBJDIR)/aeexception.o\
$(OBJDIR)/aehandlers.o\
$(OBJDIR)/aeinitfile.o\
$(OBJDIR)/aeinstall.o\
$(OBJDIR)/aemain.o\
$(OBJDIR)/aeregion.o\
$(OBJDIR)/aetables.o\
$(OBJDIR)/aetests.o\
$(OBJDIR)/ahids.o\
$(OBJDIR)/ahuuids.o\
$(OBJDIR)/cmfsize.o\

View File

@ -356,6 +356,7 @@ static const char *AcpiDmNfitSubnames[] =
"NVDIMM Control Region", /* ACPI_NFIT_TYPE_CONTROL_REGION */
"NVDIMM Block Data Window Region", /* ACPI_NFIT_TYPE_DATA_REGION */
"Flush Hint Address", /* ACPI_NFIT_TYPE_FLUSH_ADDRESS */
"Platform Capabilities", /* ACPI_NFIT_TYPE_CAPABILITIES */
"Unknown Subtable Type" /* Reserved */
};

View File

@ -3061,6 +3061,11 @@ AcpiDmDumpNfit (
FieldOffset = sizeof (ACPI_NFIT_FLUSH_ADDRESS) - sizeof (UINT64);
break;
case ACPI_NFIT_TYPE_CAPABILITIES: /* ACPI 6.0A */
InfoTable = AcpiDmTableInfoNfit7;
break;
default:
AcpiOsPrintf ("\n**** Unknown NFIT subtable type 0x%X\n",
Subtable->Type);

View File

@ -336,6 +336,7 @@
#define ACPI_NFIT4_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CONTROL_REGION,f)
#define ACPI_NFIT5_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_DATA_REGION,f)
#define ACPI_NFIT6_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_FLUSH_ADDRESS,f)
#define ACPI_NFIT7_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_NFIT_CAPABILITIES,f)
#define ACPI_PCCT0_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_SUBSPACE,f)
#define ACPI_PCCT1_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED,f)
#define ACPI_PCCT2_OFFSET(f) (UINT16) ACPI_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f)
@ -419,6 +420,7 @@
#define ACPI_NFIT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_SYSTEM_ADDRESS,f,o)
#define ACPI_NFIT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_MEMORY_MAP,f,o)
#define ACPI_NFIT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CONTROL_REGION,f,o)
#define ACPI_NFIT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_NFIT_CAPABILITIES,f,o)
#define ACPI_PCCT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_PCCT,f,o)
#define ACPI_PCCT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED,f,o)
#define ACPI_PCCT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_PCCT_HW_REDUCED_TYPE2,f,o)
@ -1861,6 +1863,7 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoIort4[] =
{ACPI_DMT_UINT8, ACPI_IORT4_OFFSET (Pxm), "Proximity Domain", 0},
{ACPI_DMT_UINT8, ACPI_IORT4_OFFSET (Reserved1), "Reserved", 0},
{ACPI_DMT_UINT16, ACPI_IORT4_OFFSET (Reserved2), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_IORT4_OFFSET (IdMappingIndex), "Device ID Mapping Index", 0},
ACPI_DMT_TERMINATOR
};
@ -2564,6 +2567,18 @@ ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[] =
ACPI_DMT_TERMINATOR
};
ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[] =
{
{ACPI_DMT_UINT8, ACPI_NFIT7_OFFSET (HighestCapability), "Highest Capability", 0},
{ACPI_DMT_UINT24, ACPI_NFIT7_OFFSET (Reserved[0]), "Reserved", 0},
{ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Capabilities), "Capabilities (decoded below)", DT_FLAG},
{ACPI_DMT_FLAG0, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Cache Flush to NVDIMM", 0},
{ACPI_DMT_FLAG1, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Flush to MVDIMM", 0},
{ACPI_DMT_FLAG2, ACPI_NFIT7_FLAG_OFFSET (Capabilities,0), "Memory Mirroring", 0},
{ACPI_DMT_UINT32, ACPI_NFIT7_OFFSET (Reserved2), "Reserved", 0},
ACPI_DMT_TERMINATOR
};
/*******************************************************************************
*

View File

@ -162,7 +162,7 @@
#define ASL_CREATOR_ID "INTL"
#define ASL_DEFINE "__IASL__"
#define ASL_PREFIX "iASL: "
#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.2"
#define ASL_COMPLIANCE "Supports ACPI Specification Revision 6.2A"
/* Configuration constants */

View File

@ -697,6 +697,11 @@ DtCompileNfit (
InfoTable = AcpiDmTableInfoNfit6;
break;
case ACPI_NFIT_TYPE_CAPABILITIES:
InfoTable = AcpiDmTableInfoNfit7;
break;
default:
DtFatal (ASL_MSG_UNKNOWN_SUBTABLE, SubtableStart, "NFIT");
@ -740,7 +745,6 @@ DtCompileNfit (
}
Interleave->LineCount = Count;
DtPopSubtable ();
break;
case ACPI_NFIT_TYPE_SMBIOS:
@ -786,7 +790,6 @@ DtCompileNfit (
}
Hint->HintCount = (UINT16) Count;
DtPopSubtable ();
break;
default:

View File

@ -696,53 +696,56 @@ const unsigned char TemplateHpet[] =
const unsigned char TemplateIort[] =
{
0x49,0x4F,0x52,0x54,0x74,0x01,0x00,0x00, /* 00000000 "IORTt..." */
0x00,0xD2,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x45,0x4D,0x50,0x4C,0x41,0x54,0x45, /* 00000010 "TEMPLATE" */
0x49,0x4F,0x52,0x54,0x90,0x01,0x00,0x00, /* 00000000 "IORT...." */
0x00,0x5F,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "._INTEL " */
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
0x00,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x19,0x01,0x17,0x20,0x05,0x00,0x00,0x00, /* 00000020 "... ...." */
0x31,0x08,0x17,0x20,0x05,0x00,0x00,0x00, /* 00000020 "1.. ...." */
0x34,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000028 "4......." */
0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00, /* 00000030 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000038 "........" */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000040 "........" */
0x00,0x00,0x00,0x00,0x01,0x44,0x00,0x00, /* 00000048 ".....D.." */
0x00,0x00,0x00,0x00,0x01,0x58,0x00,0x00, /* 00000048 ".....X.." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000050 "........" */
0x30,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "0......." */
0x44,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000058 "D......." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000060 "........" */
0x00,0x5C,0x5F,0x53,0x42,0x2E,0x50,0x43, /* 00000068 ".\_SB.PC" */
0x49,0x30,0x2E,0x44,0x45,0x56,0x30,0x00, /* 00000070 "I0.DEV0." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000078 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000080 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000088 "........" */
0x02,0x34,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 ".4......" */
0x01,0x00,0x00,0x00,0x20,0x00,0x00,0x00, /* 00000098 ".... ..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000A8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000090 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000098 "........" */
0x00,0x00,0x00,0x00,0x02,0x34,0x00,0x00, /* 000000A0 ".....4.." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000A8 "........" */
0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B0 " ......." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000B8 "........" */
0x00,0x00,0x00,0x00,0x03,0x60,0x00,0x00, /* 000000C0 ".....`.." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 000000C8 "........" */
0x4C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "L......." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E0 "........" */
0x00,0x00,0x00,0x00,0x3C,0x00,0x00,0x00, /* 000000E8 "....<..." */
0x00,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000F0 "....L..." */
0x00,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000F8 "....L..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000C8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000D0 "........" */
0x03,0x60,0x00,0x01,0x00,0x00,0x00,0x00, /* 000000D8 ".`......" */
0x01,0x00,0x00,0x00,0x4C,0x00,0x00,0x00, /* 000000E0 "....L..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000E8 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F0 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 000000F8 "........" */
0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000100 "<......." */
0x4C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000108 "L......." */
0x4C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000110 "L......." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000118 "........" */
0x00,0x00,0x00,0x00,0x04,0x50,0x00,0x00, /* 00000120 ".....P.." */
0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00, /* 00000128 "........" */
0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "<......." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000138 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000140 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000120 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000128 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000130 "........" */
0x04,0x58,0x00,0x01,0x00,0x00,0x00,0x00, /* 00000138 ".X......" */
0x01,0x00,0x00,0x00,0x44,0x00,0x00,0x00, /* 00000140 "....D..." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000148 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000150 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000160 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000168 "........" */
0x00,0x00,0x00,0x00 /* 00000170 "...." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000170 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000178 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000180 "........" */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000188 "........" */
};
const unsigned char TemplateIvrs[] =
@ -939,11 +942,11 @@ const unsigned char TemplateMsct[] =
const unsigned char TemplateNfit[] =
{
0x4E,0x46,0x49,0x54,0x70,0x01,0x00,0x00, /* 00000000 "NFITp..." */
0x01,0x53,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 ".SINTEL " */
0x4E,0x46,0x49,0x54,0x80,0x01,0x00,0x00, /* 00000000 "NFIT...." */
0x01,0x07,0x49,0x4E,0x54,0x45,0x4C,0x20, /* 00000008 "..INTEL " */
0x54,0x65,0x6D,0x70,0x6C,0x61,0x74,0x65, /* 00000010 "Template" */
0x01,0x00,0x00,0x00,0x49,0x4E,0x54,0x4C, /* 00000018 "....INTL" */
0x10,0x04,0x15,0x20,0x00,0x00,0x00,0x00, /* 00000020 "... ...." */
0x29,0x09,0x17,0x20,0x00,0x00,0x00,0x00, /* 00000020 ").. ...." */
0x00,0x00,0x38,0x00,0x01,0x00,0x00,0x00, /* 00000028 "..8....." */
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000030 "........" */
0x30,0x05,0xAF,0x91,0x86,0x5D,0x0E,0x47, /* 00000038 "0....].G" */
@ -984,7 +987,9 @@ const unsigned char TemplateNfit[] =
0x06,0x00,0x20,0x00,0x01,0x00,0x00,0x00, /* 00000150 ".. ....." */
0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00, /* 00000158 "........" */
0x00,0x00,0x00,0x18,0x04,0x00,0x00,0x00, /* 00000160 "........" */
0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00 /* 00000168 "........" */
0x00,0x00,0x00,0x18,0x06,0x00,0x00,0x00, /* 00000168 "........" */
0x07,0x00,0x10,0x00,0x00,0x00,0x00,0x00, /* 00000170 "........" */
0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00 /* 00000178 "........" */
};
const unsigned char TemplateMtmr[] =

View File

@ -187,6 +187,10 @@ AcpiDbExecutionWalk (
void *Context,
void **ReturnValue);
static void ACPI_SYSTEM_XFACE
AcpiDbSingleExecutionThread (
void *Context);
/*******************************************************************************
*
@ -366,7 +370,7 @@ AcpiDbExecuteSetup (
ACPI_FUNCTION_NAME (DbExecuteSetup);
/* Catenate the current scope to the supplied name */
/* Concatenate the current scope to the supplied name */
Info->Pathname[0] = 0;
if ((Info->Name[0] != '\\') &&
@ -789,6 +793,124 @@ AcpiDbMethodThread (
}
/*******************************************************************************
*
* FUNCTION: AcpiDbSingleExecutionThread
*
* PARAMETERS: Context - Method info struct
*
* RETURN: None
*
* DESCRIPTION: Create one thread and execute a method
*
******************************************************************************/
static void ACPI_SYSTEM_XFACE
AcpiDbSingleExecutionThread (
void *Context)
{
ACPI_DB_METHOD_INFO *Info = Context;
ACPI_STATUS Status;
ACPI_BUFFER ReturnObj;
AcpiOsPrintf ("\n");
Status = AcpiDbExecuteMethod (Info, &ReturnObj);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s During evaluation of %s\n",
AcpiFormatException (Status), Info->Pathname);
return;
}
/* Display a return object, if any */
if (ReturnObj.Length)
{
AcpiOsPrintf ("Evaluation of %s returned object %p, "
"external buffer length %X\n",
AcpiGbl_DbMethodInfo.Pathname, ReturnObj.Pointer,
(UINT32) ReturnObj.Length);
AcpiDbDumpExternalObject (ReturnObj.Pointer, 1);
}
AcpiOsPrintf ("\nBackground thread completed\n%c ",
ACPI_DEBUGGER_COMMAND_PROMPT);
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCreateExecutionThread
*
* PARAMETERS: MethodNameArg - Control method to execute
* Arguments - Array of arguments to the method
* Types - Corresponding array of object types
*
* RETURN: None
*
* DESCRIPTION: Create a single thread to evaluate a namespace object. Handles
* arguments passed on command line for control methods.
*
******************************************************************************/
void
AcpiDbCreateExecutionThread (
char *MethodNameArg,
char **Arguments,
ACPI_OBJECT_TYPE *Types)
{
ACPI_STATUS Status;
UINT32 i;
memset (&AcpiGbl_DbMethodInfo, 0, sizeof (ACPI_DB_METHOD_INFO));
AcpiGbl_DbMethodInfo.Name = MethodNameArg;
AcpiGbl_DbMethodInfo.InitArgs = 1;
AcpiGbl_DbMethodInfo.Args = AcpiGbl_DbMethodInfo.Arguments;
AcpiGbl_DbMethodInfo.Types = AcpiGbl_DbMethodInfo.ArgTypes;
/* Setup method arguments, up to 7 (0-6) */
for (i = 0; (i < ACPI_METHOD_NUM_ARGS) && *Arguments; i++)
{
AcpiGbl_DbMethodInfo.Arguments[i] = *Arguments;
Arguments++;
AcpiGbl_DbMethodInfo.ArgTypes[i] = *Types;
Types++;
}
Status = AcpiDbExecuteSetup (&AcpiGbl_DbMethodInfo);
if (ACPI_FAILURE (Status))
{
return;
}
/* Get the NS node, determines existence also */
Status = AcpiGetHandle (NULL, AcpiGbl_DbMethodInfo.Pathname,
&AcpiGbl_DbMethodInfo.Method);
if (ACPI_FAILURE (Status))
{
AcpiOsPrintf ("%s Could not get handle for %s\n",
AcpiFormatException (Status), AcpiGbl_DbMethodInfo.Pathname);
return;
}
Status = AcpiOsExecute (OSL_DEBUGGER_EXEC_THREAD,
AcpiDbSingleExecutionThread, &AcpiGbl_DbMethodInfo);
if (ACPI_FAILURE (Status))
{
return;
}
AcpiOsPrintf ("\nBackground thread started\n");
}
/*******************************************************************************
*
* FUNCTION: AcpiDbCreateExecutionThreads

View File

@ -258,6 +258,7 @@ enum AcpiExDebuggerCommands
CMD_UNLOAD,
CMD_TERMINATE,
CMD_BACKGROUND,
CMD_THREADS,
CMD_TEST,
@ -336,6 +337,7 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
{"UNLOAD", 1},
{"TERMINATE", 0},
{"BACKGROUND", 1},
{"THREADS", 3},
{"TEST", 1},
@ -346,102 +348,113 @@ static const ACPI_DB_COMMAND_INFO AcpiGbl_DbCommands[] =
/*
* Help for all debugger commands. First argument is the number of lines
* of help to output for the command.
*
* Note: Some commands are not supported by the kernel-level version of
* the debugger.
*/
static const ACPI_DB_COMMAND_HELP AcpiGbl_DbCommandHelp[] =
{
{0, "\nGeneral-Purpose Commands:", "\n"},
{1, " Allocations", "Display list of current memory allocations\n"},
{2, " Dump <Address>|<Namepath>", "\n"},
{0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
{1, " Handlers", "Info about global handlers\n"},
{1, " Help [Command]", "This help screen or individual command\n"},
{1, " History", "Display command history buffer\n"},
{1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"},
{1, " Locks", "Current status of internal mutexes\n"},
{1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"},
{1, " Quit or Exit", "Exit this command\n"},
{8, " Stats <SubCommand>", "Display namespace and memory statistics\n"},
{1, " Allocations", "Display list of current memory allocations\n"},
{1, " Memory", "Dump internal memory lists\n"},
{1, " Misc", "Namespace search and mutex stats\n"},
{1, " Objects", "Summary of namespace objects\n"},
{1, " Sizes", "Sizes for each of the internal objects\n"},
{1, " Stack", "Display CPU stack usage\n"},
{1, " Tables", "Info about current ACPI table(s)\n"},
{1, " Tables", "Display info about loaded ACPI tables\n"},
{1, " ! <CommandNumber>", "Execute command from history buffer\n"},
{1, " !!", "Execute last command again\n"},
{0, "\nNamespace Access:", "\n"},
{1, " Businfo", "Display system bus info\n"},
{1, " Disassemble <Method>", "Disassemble a control method\n"},
{1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
{1, " Integrity", "Validate namespace integrity\n"},
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
{1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"},
{1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
{1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
{1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
{1, " References <Addr>", "Find all references to object at addr\n"},
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
{1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
{1, " Type <Object>", "Display object type\n"},
{0, "\nNamespace Access Commands:", "\n"},
{1, " Businfo", "Display system bus info\n"},
{1, " Disassemble <Method>", "Disassemble a control method\n"},
{1, " Find <AcpiName> (? is wildcard)", "Find ACPI name(s) with wildcards\n"},
{1, " Integrity", "Validate namespace integrity\n"},
{1, " Methods", "Display list of loaded control methods\n"},
{1, " Namespace [Object] [Depth]", "Display loaded namespace tree/subtree\n"},
{1, " Notify <Object> <Value>", "Send a notification on Object\n"},
{1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"},
{1, " Owner <OwnerId> [Depth]", "Display loaded namespace by object owner\n"},
{1, " Paths", "Display full pathnames of namespace objects\n"},
{1, " Predefined", "Check all predefined names\n"},
{1, " Prefix [<Namepath>]", "Set or Get current execution prefix\n"},
{1, " References <Addr>", "Find all references to object at addr\n"},
{1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"},
{1, " Set N <NamedObject> <Value>", "Set value for named integer\n"},
{1, " Template <Object>", "Format/dump a Buffer/ResourceTemplate\n"},
{1, " Type <Object>", "Display object type\n"},
{0, "\nControl Method Execution:", "\n"},
{1, " Evaluate <Namepath> [Arguments]", "Evaluate object or control method\n"},
{1, " Execute <Namepath> [Arguments]", "Synonym for Evaluate\n"},
#ifdef ACPI_APPLICATION
{1, " Background <Namepath> [Arguments]", "Evaluate object/method in a separate thread\n"},
{1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
#endif
{1, " Debug <Namepath> [Arguments]", "Single-Step a control method\n"},
{7, " [Arguments] formats:", "Control method argument formats\n"},
{1, " Hex Integer", "Integer\n"},
{1, " \"Ascii String\"", "String\n"},
{1, " (Hex Byte List)", "Buffer\n"},
{1, " (01 42 7A BF)", "Buffer example (4 bytes)\n"},
{1, " [Package Element List]", "Package\n"},
{1, " [0x01 0x1234 \"string\"]", "Package example (3 elements)\n"},
{0, "\nControl Method Execution Commands:","\n"},
{1, " Arguments (or Args)", "Display method arguments\n"},
{1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
{1, " Call", "Run to next control method invocation\n"},
{1, " Debug <Namepath> [Arguments]", "Single Step a control method\n"},
{6, " Evaluate", "Synonym for Execute\n"},
{5, " Execute <Namepath> [Arguments]", "Execute control method\n"},
{1, " Hex Integer", "Integer method argument\n"},
{1, " \"Ascii String\"", "String method argument\n"},
{1, " (Hex Byte List)", "Buffer method argument\n"},
{1, " [Package Element List]", "Package method argument\n"},
{5, " Execute predefined", "Execute all predefined (public) methods\n"},
{1, " Go", "Allow method to run to completion\n"},
{1, " Information", "Display info about the current method\n"},
{1, " Into", "Step into (not over) a method call\n"},
{1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
{1, " Locals", "Display method local variables\n"},
{1, " Results", "Display method result stack\n"},
{1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
{1, " Stop", "Terminate control method\n"},
{5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"},
{1, " Enable", "Enable all messages\n"},
{1, " Disable", "Disable tracing\n"},
{1, " Method", "Enable method execution messages\n"},
{1, " Opcode", "Enable opcode execution messages\n"},
{1, " Tree", "Display control method calling tree\n"},
{1, " <Enter>", "Single step next AML opcode (over calls)\n"},
{0, "\nMiscellaneous:", "\n"},
{1, " Allocations", "Display list of current memory allocations\n"},
{2, " Dump <Address>|<Namepath>", "\n"},
{0, " [Byte|Word|Dword|Qword]", "Display ACPI objects or memory\n"},
{1, " Handlers", "Info about global handlers\n"},
{1, " Help [Command]", "This help screen or individual command\n"},
{1, " History", "Display command history buffer\n"},
{1, " Level <DebugLevel>] [console]", "Get/Set debug level for file or console\n"},
{1, " Locks", "Current status of internal mutexes\n"},
{1, " Osi [Install|Remove <name>]", "Display or modify global _OSI list\n"},
{1, " Quit or Exit", "Exit this command\n"},
{8, " Stats <SubCommand>", "Display namespace and memory statistics\n"},
{1, " Allocations", "Display list of current memory allocations\n"},
{1, " Memory", "Dump internal memory lists\n"},
{1, " Misc", "Namespace search and mutex stats\n"},
{1, " Objects", "Summary of namespace objects\n"},
{1, " Sizes", "Sizes for each of the internal objects\n"},
{1, " Stack", "Display CPU stack usage\n"},
{1, " Tables", "Info about current ACPI table(s)\n"},
{1, " Tables", "Display info about loaded ACPI tables\n"},
#ifdef ACPI_APPLICATION
{1, " Terminate", "Delete namespace and all internal objects\n"},
#endif
{1, " ! <CommandNumber>", "Execute command from history buffer\n"},
{1, " !!", "Execute last command again\n"},
{0, "\nMethod and Namespace Debugging:", "\n"},
{5, " Trace <State> [<Namepath>] [Once]", "Trace control method execution\n"},
{1, " Enable", "Enable all messages\n"},
{1, " Disable", "Disable tracing\n"},
{1, " Method", "Enable method execution messages\n"},
{1, " Opcode", "Enable opcode execution messages\n"},
{3, " Test <TestName>", "Invoke a debug test\n"},
{1, " Objects", "Read/write/compare all namespace data objects\n"},
{1, " Predefined", "Validate all ACPI predefined names (_STA, etc.)\n"},
{1, " Execute predefined", "Execute all predefined (public) methods\n"},
{0, "\nControl Method Single-Step Execution:","\n"},
{1, " Arguments (or Args)", "Display method arguments\n"},
{1, " Breakpoint <AmlOffset>", "Set an AML execution breakpoint\n"},
{1, " Call", "Run to next control method invocation\n"},
{1, " Go", "Allow method to run to completion\n"},
{1, " Information", "Display info about the current method\n"},
{1, " Into", "Step into (not over) a method call\n"},
{1, " List [# of Aml Opcodes]", "Display method ASL statements\n"},
{1, " Locals", "Display method local variables\n"},
{1, " Results", "Display method result stack\n"},
{1, " Set <A|L> <#> <Value>", "Set method data (Arguments/Locals)\n"},
{1, " Stop", "Terminate control method\n"},
{1, " Tree", "Display control method calling tree\n"},
{1, " <Enter>", "Single step next AML opcode (over calls)\n"},
#ifdef ACPI_APPLICATION
{0, "\nHardware Simulation Commands:", "\n"},
{1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
{1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
{1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
{1, " Gpes", "Display info on all GPE devices\n"},
{1, " Sci", "Generate an SCI\n"},
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
{0, "\nFile Operations:", "\n"},
{1, " Close", "Close debug output file\n"},
{1, " Load <Input Filename>", "Load ACPI table from a file\n"},
{1, " Open <Output Filename>", "Open a file for debug output\n"},
{1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
{0, "\nFile I/O Commands:", "\n"},
{1, " Close", "Close debug output file\n"},
{1, " Load <Input Filename>", "Load ACPI table from a file\n"},
{1, " Open <Output Filename>", "Open a file for debug output\n"},
{1, " Unload <Namepath>", "Unload an ACPI table via namespace object\n"},
{0, "\nUser Space Commands:", "\n"},
{1, " Terminate", "Delete namespace and all internal objects\n"},
{1, " Thread <Threads><Loops><NamePath>", "Spawn threads to execute method(s)\n"},
{0, "\nDebug Test Commands:", "\n"},
{3, " Test <TestName>", "Invoke a debug test\n"},
{1, " Objects", "Read/write/compare all namespace data objects\n"},
{1, " Predefined", "Execute all ACPI predefined names (_STA, etc.)\n"},
{0, "\nHardware Simulation:", "\n"},
{1, " EnableAcpi", "Enable ACPI (hardware) mode\n"},
{1, " Event <F|G> <Value>", "Generate AcpiEvent (Fixed/GPE)\n"},
{1, " Gpe <GpeNum> [GpeBlockDevice]", "Simulate a GPE\n"},
{1, " Gpes", "Display info on all GPE devices\n"},
{1, " Sci", "Generate an SCI\n"},
{1, " Sleep [SleepState]", "Simulate sleep/wake sequence(s) (0-5)\n"},
#endif
{0, NULL, NULL}
};
@ -571,11 +584,15 @@ AcpiDbDisplayHelp (
{
/* No argument to help, display help for all commands */
AcpiOsPrintf ("\nSummary of AML Debugger Commands\n\n");
while (Next->Invocation)
{
AcpiOsPrintf ("%-38s%s", Next->Invocation, Next->Description);
Next++;
}
AcpiOsPrintf ("\n");
}
else
{
@ -1258,6 +1275,12 @@ AcpiDbCommandDispatch (
/* AcpiInitialize (NULL); */
break;
case CMD_BACKGROUND:
AcpiDbCreateExecutionThread (AcpiGbl_DbArgs[1], &AcpiGbl_DbArgs[2],
&AcpiGbl_DbArgTypes[2]);
break;
case CMD_THREADS:
AcpiDbCreateExecutionThreads (AcpiGbl_DbArgs[1], AcpiGbl_DbArgs[2],

View File

@ -340,7 +340,8 @@ AcpiDsCreateBufferField (
ACPI_IMODE_LOAD_PASS1, Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
}
@ -524,7 +525,8 @@ AcpiDsGetFieldNames (
WalkState, &Info->ConnectionNode);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Child->Common.Value.Name, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Child->Common.Value.Name, Status);
return_ACPI_STATUS (Status);
}
}
@ -540,7 +542,8 @@ AcpiDsGetFieldNames (
WalkState, &Info->FieldNode);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
(char *) &Arg->Named.Name, Status);
return_ACPI_STATUS (Status);
}
else
@ -639,7 +642,8 @@ AcpiDsCreateField (
#endif
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Arg->Common.Value.Name, Status);
return_ACPI_STATUS (Status);
}
}
@ -769,7 +773,8 @@ AcpiDsInitFieldObjects (
Flags, WalkState, &Node);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE ((char *) &Arg->Named.Name, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
(char *) &Arg->Named.Name, Status);
if (Status != AE_ALREADY_EXISTS)
{
return_ACPI_STATUS (Status);
@ -834,7 +839,8 @@ AcpiDsCreateBankField (
#endif
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.Name, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Arg->Common.Value.Name, Status);
return_ACPI_STATUS (Status);
}
}
@ -847,7 +853,8 @@ AcpiDsCreateBankField (
ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
@ -920,7 +927,8 @@ AcpiDsCreateIndexField (
ACPI_NS_SEARCH_PARENT, WalkState, &Info.RegisterNode);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
@ -932,7 +940,8 @@ AcpiDsCreateIndexField (
ACPI_NS_SEARCH_PARENT, WalkState, &Info.DataRegisterNode);
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Arg->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}

View File

@ -223,7 +223,8 @@ AcpiDsBuildInternalObject (
ACPI_NAMESPACE_NODE, &(Op->Common.Node)));
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Op->Common.Value.String, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Op->Common.Value.String, Status);
return_ACPI_STATUS (Status);
}
}

View File

@ -732,7 +732,8 @@ AcpiDsCreateOperand (
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (NameString, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
NameString, Status);
}
}

View File

@ -325,7 +325,7 @@ AcpiDsLoad1BeginOp (
#endif
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Path, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status);
return_ACPI_STATUS (Status);
}
@ -495,7 +495,7 @@ AcpiDsLoad1BeginOp (
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Path, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status);
return_ACPI_STATUS (Status);
}
}

View File

@ -304,10 +304,12 @@ AcpiDsLoad2BeginOp (
}
else
{
ACPI_ERROR_NAMESPACE (BufferPtr, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
BufferPtr, Status);
}
#else
ACPI_ERROR_NAMESPACE (BufferPtr, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
BufferPtr, Status);
#endif
return_ACPI_STATUS (Status);
}
@ -462,7 +464,8 @@ AcpiDsLoad2BeginOp (
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (BufferPtr, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
BufferPtr, Status);
return_ACPI_STATUS (Status);
}
@ -844,7 +847,8 @@ AcpiDsLoad2EndOp (
}
else
{
ACPI_ERROR_NAMESPACE (Arg->Common.Value.String, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo,
Arg->Common.Value.String, Status);
}
break;

View File

@ -423,6 +423,17 @@ AcpiEvAddressSpaceDispatch (
{
ACPI_EXCEPTION ((AE_INFO, Status, "Returned by Handler for [%s]",
AcpiUtGetRegionName (RegionObj->Region.SpaceId)));
/*
* Special case for an EC timeout. These are seen so frequently
* that an additional error message is helpful
*/
if ((RegionObj->Region.SpaceId == ACPI_ADR_SPACE_EC) &&
(Status == AE_TIME))
{
ACPI_ERROR ((AE_INFO,
"Timeout from EC hardware or EC device driver"));
}
}
if (!(HandlerDesc->AddressSpace.HandlerFlags &

View File

@ -644,7 +644,8 @@ AcpiNsConvertToReference (
{
/* Check if we are resolving a named reference within a package */
ACPI_ERROR_NAMESPACE (OriginalObject->String.Pointer, Status);
ACPI_ERROR_NAMESPACE (&ScopeInfo,
OriginalObject->String.Pointer, Status);
goto ErrorExit;
}

View File

@ -158,6 +158,12 @@
#define _COMPONENT ACPI_NAMESPACE
ACPI_MODULE_NAME ("nsnames")
/* Local Prototypes */
static void
AcpiNsNormalizePathname (
char *OriginalPath);
/*******************************************************************************
*
@ -507,3 +513,169 @@ AcpiNsGetNormalizedPathname (
return_PTR (NameBuffer);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsBuildPrefixedPathname
*
* PARAMETERS: PrefixScope - Scope/Path that prefixes the internal path
* InternalPath - Name or path of the namespace node
*
* RETURN: None
*
* DESCRIPTION: Construct a fully qualified pathname from a concatenation of:
* 1) Path associated with the PrefixScope namespace node
* 2) External path representation of the Internal path
*
******************************************************************************/
char *
AcpiNsBuildPrefixedPathname (
ACPI_GENERIC_STATE *PrefixScope,
const char *InternalPath)
{
ACPI_STATUS Status;
char *FullPath = NULL;
char *ExternalPath = NULL;
char *PrefixPath = NULL;
UINT32 PrefixPathLength = 0;
/* If there is a prefix, get the pathname to it */
if (PrefixScope && PrefixScope->Scope.Node)
{
PrefixPath = AcpiNsGetNormalizedPathname (PrefixScope->Scope.Node, TRUE);
if (PrefixPath)
{
PrefixPathLength = strlen (PrefixPath);
}
}
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, InternalPath,
NULL, &ExternalPath);
if (ACPI_FAILURE (Status))
{
goto Cleanup;
}
/* Merge the prefix path and the path. 2 is for one dot and trailing null */
FullPath = ACPI_ALLOCATE_ZEROED (
PrefixPathLength + strlen (ExternalPath) + 2);
if (!FullPath)
{
goto Cleanup;
}
/* Don't merge if the External path is already fully qualified */
if (PrefixPath &&
(*ExternalPath != '\\') &&
(*ExternalPath != '^'))
{
strcat (FullPath, PrefixPath);
if (PrefixPath[1])
{
strcat (FullPath, ".");
}
}
AcpiNsNormalizePathname (ExternalPath);
strcat (FullPath, ExternalPath);
Cleanup:
if (PrefixPath)
{
ACPI_FREE (PrefixPath);
}
if (ExternalPath)
{
ACPI_FREE (ExternalPath);
}
return (FullPath);
}
/*******************************************************************************
*
* FUNCTION: AcpiNsNormalizePathname
*
* PARAMETERS: OriginalPath - Path to be normalized, in External format
*
* RETURN: The original path is processed in-place
*
* DESCRIPTION: Remove trailing underscores from each element of a path.
*
* For example: \A___.B___.C___ becomes \A.B.C
*
******************************************************************************/
static void
AcpiNsNormalizePathname (
char *OriginalPath)
{
char *InputPath = OriginalPath;
char *NewPathBuffer;
char *NewPath;
UINT32 i;
/* Allocate a temp buffer in which to construct the new path */
NewPathBuffer = ACPI_ALLOCATE_ZEROED (strlen (InputPath) + 1);
NewPath = NewPathBuffer;
if (!NewPathBuffer)
{
return;
}
/* Special characters may appear at the beginning of the path */
if (*InputPath == '\\')
{
*NewPath = *InputPath;
NewPath++;
InputPath++;
}
while (*InputPath == '^')
{
*NewPath = *InputPath;
NewPath++;
InputPath++;
}
/* Remainder of the path */
while (*InputPath)
{
/* Do one nameseg at a time */
for (i = 0; (i < ACPI_NAME_SIZE) && *InputPath; i++)
{
if ((i == 0) || (*InputPath != '_')) /* First char is allowed to be underscore */
{
*NewPath = *InputPath;
NewPath++;
}
InputPath++;
}
/* Dot means that there are more namesegs to come */
if (*InputPath == '.')
{
*NewPath = *InputPath;
NewPath++;
InputPath++;
}
}
*NewPath = 0;
strcpy (OriginalPath, NewPathBuffer);
ACPI_FREE (NewPathBuffer);
}

View File

@ -500,7 +500,7 @@ AcpiPsGetNextNamepath (
if (ACPI_FAILURE (Status))
{
ACPI_ERROR_NAMESPACE (Path, Status);
ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, Path, Status);
if ((WalkState->ParseFlags & ACPI_PARSE_MODE_MASK) ==
ACPI_PARSE_EXECUTE)

View File

@ -558,11 +558,6 @@ AcpiUtGetReferenceName (
}
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*
* Strings and procedures used for debug only
*/
/*******************************************************************************
*
* FUNCTION: AcpiUtGetMutexName
@ -601,6 +596,12 @@ AcpiUtGetMutexName (
}
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
/*
* Strings and procedures used for debug only
*/
/*******************************************************************************
*
* FUNCTION: AcpiUtGetNotifyName

View File

@ -311,6 +311,82 @@ AcpiUtPredefinedBiosError (
}
/*******************************************************************************
*
* FUNCTION: AcpiUtPrefixedNamespaceError
*
* PARAMETERS: ModuleName - Caller's module name (for error output)
* LineNumber - Caller's line number (for error output)
* PrefixScope - Scope/Path that prefixes the internal path
* InternalPath - Name or path of the namespace node
* LookupStatus - Exception code from NS lookup
*
* RETURN: None
*
* DESCRIPTION: Print error message with the full pathname constructed this way:
*
* PrefixScopeNodeFullPath.ExternalizedInternalPath
*
* NOTE: 10/2017: Treat the major NsLookup errors as firmware errors
*
******************************************************************************/
void
AcpiUtPrefixedNamespaceError (
const char *ModuleName,
UINT32 LineNumber,
ACPI_GENERIC_STATE *PrefixScope,
const char *InternalPath,
ACPI_STATUS LookupStatus)
{
char *FullPath;
const char *Message;
/*
* Main cases:
* 1) Object creation, object must not already exist
* 2) Object lookup, object must exist
*/
switch (LookupStatus)
{
case AE_ALREADY_EXISTS:
AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
Message = "Failure creating";
break;
case AE_NOT_FOUND:
AcpiOsPrintf (ACPI_MSG_BIOS_ERROR);
Message = "Failure looking up";
break;
default:
AcpiOsPrintf (ACPI_MSG_ERROR);
Message = "Failure looking up";
break;
}
/* Concatenate the prefix path and the internal path */
FullPath = AcpiNsBuildPrefixedPathname (PrefixScope, InternalPath);
AcpiOsPrintf ("%s [%s], %s", Message,
FullPath ? FullPath : "Could not get pathname",
AcpiFormatException (LookupStatus));
if (FullPath)
{
ACPI_FREE (FullPath);
}
ACPI_MSG_SUFFIX;
}
#ifdef __OBSOLETE_FUNCTION
/*******************************************************************************
*
* FUNCTION: AcpiUtNamespaceError
@ -378,7 +454,7 @@ AcpiUtNamespaceError (
ACPI_MSG_SUFFIX;
ACPI_MSG_REDIRECT_END;
}
#endif
/*******************************************************************************
*

View File

@ -432,8 +432,8 @@ AcpiUtAcquireMutex (
else
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Thread %u could not acquire Mutex [0x%X]",
(UINT32) ThisThreadId, MutexId));
"Thread %u could not acquire Mutex [%s] (0x%X)",
(UINT32) ThisThreadId, AcpiUtGetMutexName (MutexId), MutexId));
}
return (Status);
@ -473,7 +473,8 @@ AcpiUtReleaseMutex (
if (AcpiGbl_MutexInfo[MutexId].ThreadId == ACPI_MUTEX_NOT_ACQUIRED)
{
ACPI_ERROR ((AE_INFO,
"Mutex [0x%X] is not acquired, cannot release", MutexId));
"Mutex [%s] (0x%X) is not acquired, cannot release",
AcpiUtGetMutexName (MutexId), MutexId));
return (AE_NOT_ACQUIRED);
}

View File

@ -167,13 +167,13 @@ AcpiUtInsertDigit (
static ACPI_STATUS
AcpiUtStrtoulMultiply64 (
UINT64 Multiplicand,
UINT64 Multiplier,
UINT32 Base,
UINT64 *OutProduct);
static ACPI_STATUS
AcpiUtStrtoulAdd64 (
UINT64 Addend1,
UINT64 Addend2,
UINT32 Digit,
UINT64 *OutSum);
@ -518,7 +518,7 @@ AcpiUtInsertDigit (
* FUNCTION: AcpiUtStrtoulMultiply64
*
* PARAMETERS: Multiplicand - Current accumulated converted integer
* Multiplier - Base/Radix
* Base - Base/Radix
* OutProduct - Where the product is returned
*
* RETURN: Status and 64-bit product
@ -532,28 +532,36 @@ AcpiUtInsertDigit (
static ACPI_STATUS
AcpiUtStrtoulMultiply64 (
UINT64 Multiplicand,
UINT64 Multiplier,
UINT32 Base,
UINT64 *OutProduct)
{
UINT64 Product;
UINT64 Quotient;
/* Exit if either operand is zero */
*OutProduct = 0;
if (!Multiplicand || !Multiplier)
if (!Multiplicand || !Base)
{
return (AE_OK);
}
/* Check for 64-bit overflow before the actual multiplication */
if (Multiplicand > (ACPI_UINT64_MAX / Multiplier))
/*
* Check for 64-bit overflow before the actual multiplication.
*
* Notes: 64-bit division is often not supported on 32-bit platforms
* (it requires a library function), Therefore ACPICA has a local
* 64-bit divide function. Also, Multiplier is currently only used
* as the radix (8/10/16), to the 64/32 divide will always work.
*/
AcpiUtShortDivide (ACPI_UINT64_MAX, Base, &Quotient, NULL);
if (Multiplicand > Quotient)
{
return (AE_NUMERIC_OVERFLOW);
}
Product = Multiplicand * Multiplier;
Product = Multiplicand * Base;
/* Check for 32-bit overflow if necessary */
@ -572,7 +580,7 @@ AcpiUtStrtoulMultiply64 (
* FUNCTION: AcpiUtStrtoulAdd64
*
* PARAMETERS: Addend1 - Current accumulated converted integer
* Addend2 - New hex value/char
* Digit - New hex value/char
* OutSum - Where sum is returned (Accumulator)
*
* RETURN: Status and 64-bit sum
@ -586,7 +594,7 @@ AcpiUtStrtoulMultiply64 (
static ACPI_STATUS
AcpiUtStrtoulAdd64 (
UINT64 Addend1,
UINT64 Addend2,
UINT32 Digit,
UINT64 *OutSum)
{
UINT64 Sum;
@ -594,12 +602,12 @@ AcpiUtStrtoulAdd64 (
/* Check for 64-bit overflow before the actual addition */
if ((Addend1 > 0) && (Addend2 > (ACPI_UINT64_MAX - Addend1)))
if ((Addend1 > 0) && (Digit > (ACPI_UINT64_MAX - Addend1)))
{
return (AE_NUMERIC_OVERFLOW);
}
Sum = Addend1 + Addend2;
Sum = Addend1 + Digit;
/* Check for 32-bit overflow if necessary */

View File

@ -891,7 +891,7 @@ Exit:
}
else
{
ACPI_ERROR ((AE_INFO, "%u(0x%X) Outstanding allocations",
ACPI_ERROR ((AE_INFO, "%u (0x%X) Outstanding cache allocations",
NumOutstanding, NumOutstanding));
}

View File

@ -214,8 +214,8 @@ ACPI_EXPORT_SYMBOL (AcpiError)
*
* RETURN: None
*
* DESCRIPTION: Print "ACPI Exception" message with module/line/version info
* and decoded ACPI_STATUS.
* DESCRIPTION: Print an "ACPI Error" message with module/line/version
* info as well as decoded ACPI_STATUS.
*
******************************************************************************/
@ -236,12 +236,12 @@ AcpiException (
if (ACPI_SUCCESS (Status))
{
AcpiOsPrintf (ACPI_MSG_EXCEPTION);
AcpiOsPrintf (ACPI_MSG_ERROR);
}
else
{
AcpiOsPrintf (ACPI_MSG_EXCEPTION "%s, ",
AcpiOsPrintf (ACPI_MSG_ERROR "%s, ",
AcpiFormatException (Status));
}

View File

@ -451,6 +451,12 @@ AcpiDbExecute (
ACPI_OBJECT_TYPE *Types,
UINT32 Flags);
void
AcpiDbCreateExecutionThread (
char *MethodNameArg,
char **Arguments,
ACPI_OBJECT_TYPE *Types);
void
AcpiDbCreateExecutionThreads (
char *NumThreadsArg,

View File

@ -504,6 +504,7 @@ extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit4[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit5[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit6a[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoNfit7[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPdtt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt[];
extern ACPI_DMTABLE_INFO AcpiDmTableInfoPmtt0[];

View File

@ -1532,16 +1532,17 @@ typedef struct acpi_db_method_info
ACPI_OBJECT_TYPE *Types;
/*
* Arguments to be passed to method for the command
* Threads -
* the Number of threads, ID of current thread and
* Index of current thread inside all them created.
* Arguments to be passed to method for the commands Threads and
* Background. Note, ACPI specifies a maximum of 7 arguments (0 - 6).
*
* For the Threads command, the Number of threads, ID of current
* thread and Index of current thread inside all them created.
*/
char InitArgs;
#ifdef ACPI_DEBUGGER
ACPI_OBJECT_TYPE ArgTypes[4];
ACPI_OBJECT_TYPE ArgTypes[ACPI_METHOD_NUM_ARGS];
#endif
char *Arguments[4];
char *Arguments[ACPI_METHOD_NUM_ARGS];
char NumThreadsStr[11];
char IdOfThreadStr[11];
char IndexOfThreadStr[11];

View File

@ -567,7 +567,7 @@
* the plist contains a set of parens to allow variable-length lists.
* These macros are used for both the debug and non-debug versions of the code.
*/
#define ACPI_ERROR_NAMESPACE(s, e) AcpiUtNamespaceError (AE_INFO, s, e);
#define ACPI_ERROR_NAMESPACE(s, p, e) AcpiUtPrefixedNamespaceError (AE_INFO, s, p, e);
#define ACPI_ERROR_METHOD(s, n, p, e) AcpiUtMethodError (AE_INFO, s, n, p, e);
#define ACPI_WARN_PREDEFINED(plist) AcpiUtPredefinedWarning plist
#define ACPI_INFO_PREDEFINED(plist) AcpiUtPredefinedInfo plist

View File

@ -488,6 +488,11 @@ AcpiNsGetNormalizedPathname (
ACPI_NAMESPACE_NODE *Node,
BOOLEAN NoTrailing);
char *
AcpiNsBuildPrefixedPathname (
ACPI_GENERIC_STATE *PrefixScope,
const char *InternalPath);
char *
AcpiNsNameOfCurrentScope (
ACPI_WALK_STATE *WalkState);

View File

@ -154,7 +154,7 @@
/* Current ACPICA subsystem version in YYYYMMDD format */
#define ACPI_CA_VERSION 0x20170929
#define ACPI_CA_VERSION 0x20171110
#include "acconfig.h"
#include "actypes.h"

View File

@ -1449,7 +1449,8 @@ enum AcpiNfitType
ACPI_NFIT_TYPE_CONTROL_REGION = 4,
ACPI_NFIT_TYPE_DATA_REGION = 5,
ACPI_NFIT_TYPE_FLUSH_ADDRESS = 6,
ACPI_NFIT_TYPE_RESERVED = 7 /* 7 and greater are reserved */
ACPI_NFIT_TYPE_CAPABILITIES = 7,
ACPI_NFIT_TYPE_RESERVED = 8 /* 8 and greater are reserved */
};
/*
@ -1463,7 +1464,7 @@ typedef struct acpi_nfit_system_address
ACPI_NFIT_HEADER Header;
UINT16 RangeIndex;
UINT16 Flags;
UINT32 Reserved; /* Reseved, must be zero */
UINT32 Reserved; /* Reserved, must be zero */
UINT32 ProximityDomain;
UINT8 RangeGuid[16];
UINT64 Address;
@ -1602,6 +1603,75 @@ typedef struct acpi_nfit_flush_address
} ACPI_NFIT_FLUSH_ADDRESS;
/* 7: Platform Capabilities Structure */
typedef struct acpi_nfit_capabilities
{
ACPI_NFIT_HEADER Header;
UINT8 HighestCapability;
UINT8 Reserved[3]; /* Reserved, must be zero */
UINT32 Capabilities;
UINT32 Reserved2;
} ACPI_NFIT_CAPABILITIES;
/* Capabilities Flags */
#define ACPI_NFIT_CAPABILITY_CACHE_FLUSH (1) /* 00: Cache Flush to NVDIMM capable */
#define ACPI_NFIT_CAPABILITY_MEM_FLUSH (1<<1) /* 01: Memory Flush to NVDIMM capable */
#define ACPI_NFIT_CAPABILITY_MEM_MIRRORING (1<<2) /* 02: Memory Mirroring capable */
/*
* NFIT/DVDIMM device handle support - used as the _ADR for each NVDIMM
*/
typedef struct nfit_device_handle
{
UINT32 Handle;
} NFIT_DEVICE_HANDLE;
/* Device handle construction and extraction macros */
#define ACPI_NFIT_DIMM_NUMBER_MASK 0x0000000F
#define ACPI_NFIT_CHANNEL_NUMBER_MASK 0x000000F0
#define ACPI_NFIT_MEMORY_ID_MASK 0x00000F00
#define ACPI_NFIT_SOCKET_ID_MASK 0x0000F000
#define ACPI_NFIT_NODE_ID_MASK 0x0FFF0000
#define ACPI_NFIT_DIMM_NUMBER_OFFSET 0
#define ACPI_NFIT_CHANNEL_NUMBER_OFFSET 4
#define ACPI_NFIT_MEMORY_ID_OFFSET 8
#define ACPI_NFIT_SOCKET_ID_OFFSET 12
#define ACPI_NFIT_NODE_ID_OFFSET 16
/* Macro to construct a NFIT/NVDIMM device handle */
#define ACPI_NFIT_BUILD_DEVICE_HANDLE(dimm, channel, memory, socket, node) \
((dimm) | \
((channel) << ACPI_NFIT_CHANNEL_NUMBER_OFFSET) | \
((memory) << ACPI_NFIT_MEMORY_ID_OFFSET) | \
((socket) << ACPI_NFIT_SOCKET_ID_OFFSET) | \
((node) << ACPI_NFIT_NODE_ID_OFFSET))
/* Macros to extract individual fields from a NFIT/NVDIMM device handle */
#define ACPI_NFIT_GET_DIMM_NUMBER(handle) \
((handle) & ACPI_NFIT_DIMM_NUMBER_MASK)
#define ACPI_NFIT_GET_CHANNEL_NUMBER(handle) \
(((handle) & ACPI_NFIT_CHANNEL_NUMBER_MASK) >> ACPI_NFIT_CHANNEL_NUMBER_OFFSET)
#define ACPI_NFIT_GET_MEMORY_ID(handle) \
(((handle) & ACPI_NFIT_MEMORY_ID_MASK) >> ACPI_NFIT_MEMORY_ID_OFFSET)
#define ACPI_NFIT_GET_SOCKET_ID(handle) \
(((handle) & ACPI_NFIT_SOCKET_ID_MASK) >> ACPI_NFIT_SOCKET_ID_OFFSET)
#define ACPI_NFIT_GET_NODE_ID(handle) \
(((handle) & ACPI_NFIT_NODE_ID_MASK) >> ACPI_NFIT_NODE_ID_OFFSET)
/*******************************************************************************
*
* PDTT - Platform Debug Trigger Table (ACPI 6.2)
@ -1634,7 +1704,7 @@ typedef struct acpi_pdtt_channel
/* Flags for above */
#define ACPI_PDTT_RUNTIME_TRIGGER (1)
#define ACPI_PPTT_WAIT_COMPLETION (1<<1)
#define ACPI_PDTT_WAIT_COMPLETION (1<<1)
/*******************************************************************************
@ -1712,6 +1782,19 @@ typedef struct acpi_pptt_cache
#define ACPI_PPTT_MASK_CACHE_TYPE (0x0C) /* Cache type */
#define ACPI_PPTT_MASK_WRITE_POLICY (0x10) /* Write policy */
/* Attributes describing cache */
#define ACPI_PPTT_CACHE_READ_ALLOCATE (0x0) /* Cache line is allocated on read */
#define ACPI_PPTT_CACHE_WRITE_ALLOCATE (0x01) /* Cache line is allocated on write */
#define ACPI_PPTT_CACHE_RW_ALLOCATE (0x02) /* Cache line is allocated on read and write */
#define ACPI_PPTT_CACHE_RW_ALLOCATE_ALT (0x03) /* Alternate representation of above */
#define ACPI_PPTT_CACHE_TYPE_DATA (0x0) /* Data cache */
#define ACPI_PPTT_CACHE_TYPE_INSTR (1<<2) /* Instruction cache */
#define ACPI_PPTT_CACHE_TYPE_UNIFIED (2<<2) /* Unified I & D cache */
#define ACPI_PPTT_CACHE_TYPE_UNIFIED_ALT (3<<2) /* Alternate representation of above */
#define ACPI_PPTT_CACHE_POLICY_WB (0x0) /* Cache is write back */
#define ACPI_PPTT_CACHE_POLICY_WT (1<<4) /* Cache is write through */
/* 2: ID Structure */

View File

@ -1048,6 +1048,7 @@ typedef struct acpi_iort_smmu_v3
UINT8 Pxm;
UINT8 Reserved1;
UINT16 Reserved2;
UINT32 IdMappingIndex;
} ACPI_IORT_SMMU_V3;

View File

@ -227,9 +227,6 @@ extern const char *AcpiGbl_PtypDecode[];
#ifndef ACPI_MSG_ERROR
#define ACPI_MSG_ERROR "ACPI Error: "
#endif
#ifndef ACPI_MSG_EXCEPTION
#define ACPI_MSG_EXCEPTION "ACPI Exception: "
#endif
#ifndef ACPI_MSG_WARNING
#define ACPI_MSG_WARNING "ACPI Warning: "
#endif
@ -238,10 +235,10 @@ extern const char *AcpiGbl_PtypDecode[];
#endif
#ifndef ACPI_MSG_BIOS_ERROR
#define ACPI_MSG_BIOS_ERROR "ACPI BIOS Error (bug): "
#define ACPI_MSG_BIOS_ERROR "Firmware Error (ACPI): "
#endif
#ifndef ACPI_MSG_BIOS_WARNING
#define ACPI_MSG_BIOS_WARNING "ACPI BIOS Warning (bug): "
#define ACPI_MSG_BIOS_WARNING "Firmware Warning (ACPI): "
#endif
/*
@ -394,12 +391,12 @@ ACPI_STATUS
AcpiUtInitGlobals (
void);
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
const char *
AcpiUtGetMutexName (
UINT32 MutexId);
#if defined(ACPI_DEBUG_OUTPUT) || defined(ACPI_DEBUGGER)
const char *
AcpiUtGetNotifyName (
UINT32 NotifyValue,
@ -1215,9 +1212,10 @@ AcpiUtPredefinedBiosError (
...);
void
AcpiUtNamespaceError (
AcpiUtPrefixedNamespaceError (
const char *ModuleName,
UINT32 LineNumber,
ACPI_GENERIC_STATE *PrefixScope,
const char *InternalName,
ACPI_STATUS LookupStatus);

View File

@ -199,6 +199,10 @@ extern BOOLEAN AcpiGbl_LoadTestTables;
extern FILE *AcpiGbl_NamespaceInitFile;
extern ACPI_CONNECTION_INFO AeMyContext;
extern UINT8 Ssdt2Code[];
extern UINT8 Ssdt3Code[];
extern UINT8 Ssdt4Code[];
#define TEST_OUTPUT_LEVEL(lvl) if ((lvl) & OutputLevel)
@ -264,18 +268,14 @@ ACPI_STATUS
AeDisplayAllMethods (
UINT32 DisplayCount);
ACPI_STATUS
AeInstallEarlyHandlers (
void);
ACPI_STATUS
AeInstallLateHandlers (
void);
/* aetests */
void
AeMiscellaneousTests (
void);
/* aeregion */
ACPI_STATUS
AeRegionHandler (
UINT32 Function,
@ -285,6 +285,30 @@ AeRegionHandler (
void *HandlerContext,
void *RegionContext);
/* aeinstall */
ACPI_STATUS
AeInstallDeviceHandlers (
void);
void
AeInstallRegionHandlers (
void);
void
AeOverrideRegionHandlers (
void);
/* aehandlers */
ACPI_STATUS
AeInstallEarlyHandlers (
void);
ACPI_STATUS
AeInstallLateHandlers (
void);
UINT32
AeGpeHandler (
ACPI_HANDLE GpeDevice,
@ -298,21 +322,6 @@ AeGlobalEventHandler (
UINT32 EventNumber,
void *Context);
/* aeregion */
ACPI_STATUS
AeInstallDeviceHandlers (
void);
void
AeInstallRegionHandlers (
void);
void
AeOverrideRegionHandlers (
void);
/* aeinitfile */
int
@ -323,4 +332,40 @@ void
AeDoObjectOverrides (
void);
ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr);
/* aeexec */
void
AeTestBufferArgument (
void);
void
AeTestPackageArgument (
void);
ACPI_STATUS
AeGetDevices (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT64 ExpectedResult);
void
AeGenericRegisters (
void);
#if (!ACPI_REDUCED_HARDWARE)
void
AfInstallGpeBlock (
void);
#endif /* !ACPI_REDUCED_HARDWARE */
#endif /* _AECOMMON */

View File

@ -1,6 +1,7 @@
/******************************************************************************
*
* Module Name: aeexec - Support routines for AcpiExec utility
* Module Name: aeexec - Argument testing for control method execution.
* Also some other miscellaneous tests.
*
*****************************************************************************/
@ -154,58 +155,6 @@
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("aeexec")
/* Local prototypes */
static ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr);
static void
AeTestBufferArgument (
void);
static void
AeTestPackageArgument (
void);
static ACPI_STATUS
AeGetDevices (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
void *Context,
void **ReturnValue);
static ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT64 ExpectedResult);
static void
AeMutexInterfaces (
void);
static void
AeHardwareInterfaces (
void);
static void
AeGenericRegisters (
void);
static void
AeTestSleepData (
void);
#if (!ACPI_REDUCED_HARDWARE)
static void
AfInstallGpeBlock (
void);
#endif /* !ACPI_REDUCED_HARDWARE */
extern unsigned char Ssdt2Code[];
extern unsigned char Ssdt3Code[];
extern unsigned char Ssdt4Code[];
/******************************************************************************
*
@ -220,7 +169,7 @@ extern unsigned char Ssdt4Code[];
*
*****************************************************************************/
static ACPI_STATUS
ACPI_STATUS
AeSetupConfiguration (
void *RegionAddr)
{
@ -256,7 +205,7 @@ AeSetupConfiguration (
*
*****************************************************************************/
static void
void
AfInstallGpeBlock (
void)
{
@ -337,9 +286,15 @@ AfInstallGpeBlock (
#endif /* !ACPI_REDUCED_HARDWARE */
/* Test using a Buffer object as a method argument */
/******************************************************************************
*
* FUNCTION: AeTestBufferArgument
*
* DESCRIPTION: Test using a Buffer object as a method argument
*
*****************************************************************************/
static void
void
AeTestBufferArgument (
void)
{
@ -369,11 +324,15 @@ static ACPI_OBJECT PkgElements[5];
static ACPI_OBJECT Pkg2Elements[5];
static ACPI_OBJECT_LIST Params;
/******************************************************************************
*
* FUNCTION: AeTestPackageArgument
*
* DESCRIPTION: Test using a Package object as a method argument
*
*****************************************************************************/
/*
* Test using a Package object as an method argument
*/
static void
void
AeTestPackageArgument (
void)
{
@ -419,7 +378,15 @@ AeTestPackageArgument (
}
static ACPI_STATUS
/******************************************************************************
*
* FUNCTION: AeGetDevices
*
* DESCRIPTION: Stubbed at this time.
*
*****************************************************************************/
ACPI_STATUS
AeGetDevices (
ACPI_HANDLE ObjHandle,
UINT32 NestingLevel,
@ -444,7 +411,7 @@ AeGetDevices (
*
*****************************************************************************/
static ACPI_STATUS
ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT64 ExpectedResult)
@ -531,7 +498,7 @@ ErrorExit:
static ACPI_GENERIC_ADDRESS GenericRegister;
static void
void
AeGenericRegisters (
void)
{
@ -560,431 +527,3 @@ AeGenericRegisters (
Status = AcpiWrite (Value, &GenericRegister);
ACPI_CHECK_OK (AcpiWrite, Status);
}
/******************************************************************************
*
* FUNCTION: AeMutexInterfaces
*
* DESCRIPTION: Exercise the AML mutex access interfaces
*
*****************************************************************************/
static void
AeMutexInterfaces (
void)
{
ACPI_STATUS Status;
ACPI_HANDLE MutexHandle;
/* Get a handle to an AML mutex */
Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
if (Status == AE_NOT_FOUND)
{
return;
}
ACPI_CHECK_OK (AcpiGetHandle, Status);
if (ACPI_FAILURE (Status))
{
return;
}
/* Acquire the mutex */
Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
ACPI_CHECK_OK (AcpiAcquireMutex, Status);
if (ACPI_FAILURE (Status))
{
return;
}
/* Release mutex with different parameters */
Status = AcpiReleaseMutex (MutexHandle, NULL);
ACPI_CHECK_OK (AcpiReleaseMutex, Status);
}
/******************************************************************************
*
* FUNCTION: AeHardwareInterfaces
*
* DESCRIPTION: Call various hardware support interfaces
*
*****************************************************************************/
static void
AeHardwareInterfaces (
void)
{
#if (!ACPI_REDUCED_HARDWARE)
ACPI_STATUS Status;
UINT32 Value;
/* If Hardware Reduced flag is set, we are all done */
if (AcpiGbl_ReducedHardware)
{
return;
}
Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
#endif /* !ACPI_REDUCED_HARDWARE */
}
/******************************************************************************
*
* FUNCTION: AeTestSleepData
*
* DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
*
*****************************************************************************/
static void
AeTestSleepData (
void)
{
int State;
UINT8 TypeA;
UINT8 TypeB;
ACPI_STATUS Status;
/* Attempt to get sleep data for all known sleep states */
for (State = ACPI_STATE_S0; State <= ACPI_S_STATES_MAX; State++)
{
Status = AcpiGetSleepTypeData ((UINT8) State, &TypeA, &TypeB);
/* All sleep methods are optional */
if (Status != AE_NOT_FOUND)
{
ACPI_CHECK_OK (AcpiGetSleepTypeData, Status);
}
}
}
/******************************************************************************
*
* FUNCTION: AeMiscellaneousTests
*
* DESCRIPTION: Various ACPICA validation tests.
*
*****************************************************************************/
void
AeMiscellaneousTests (
void)
{
ACPI_BUFFER ReturnBuf;
char Buffer[32];
ACPI_STATUS Status;
ACPI_STATISTICS Stats;
ACPI_HANDLE Handle;
#if (!ACPI_REDUCED_HARDWARE)
UINT32 Temp;
UINT32 LockHandle1;
UINT32 LockHandle2;
ACPI_VENDOR_UUID Uuid =
{0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
#endif /* !ACPI_REDUCED_HARDWARE */
Status = AcpiGetHandle (NULL, "\\", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
if (AcpiGbl_DoInterfaceTests)
{
/*
* Tests for AcpiLoadTable and AcpiUnloadParentTable
*/
/* Attempt unload of DSDT, should fail */
Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiUnloadParentTable (Handle);
ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
/* Load and unload SSDT4 */
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiUnloadParentTable (Handle);
ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
/* Re-load SSDT4 */
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
/* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiUnloadParentTable (Handle);
ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
/* Load OEM9 table (causes table override) */
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
}
AeHardwareInterfaces ();
AeGenericRegisters ();
AeSetupConfiguration (Ssdt3Code);
AeTestBufferArgument();
AeTestPackageArgument ();
AeMutexInterfaces ();
AeTestSleepData ();
/* Test _OSI install/remove */
Status = AcpiInstallInterface ("");
ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
Status = AcpiInstallInterface ("TestString");
ACPI_CHECK_OK (AcpiInstallInterface, Status);
Status = AcpiInstallInterface ("TestString");
ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
Status = AcpiRemoveInterface ("Windows 2006");
ACPI_CHECK_OK (AcpiRemoveInterface, Status);
Status = AcpiRemoveInterface ("TestString");
ACPI_CHECK_OK (AcpiRemoveInterface, Status);
Status = AcpiRemoveInterface ("XXXXXX");
ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
Status = AcpiInstallInterface ("AnotherTestString");
ACPI_CHECK_OK (AcpiInstallInterface, Status);
/* Test _OSI execution */
Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX);
ACPI_CHECK_OK (ExecuteOSI, Status);
Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX);
ACPI_CHECK_OK (ExecuteOSI, Status);
Status = ExecuteOSI ("MichiganTerminalSystem", 0);
ACPI_CHECK_OK (ExecuteOSI, Status);
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;
Status = AcpiGetName (ACPI_ROOT_OBJECT,
ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf);
ACPI_CHECK_OK (AcpiGetName, Status);
/* Get Devices */
Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
ACPI_CHECK_OK (AcpiGetDevices, Status);
Status = AcpiGetStatistics (&Stats);
ACPI_CHECK_OK (AcpiGetStatistics, Status);
#if (!ACPI_REDUCED_HARDWARE)
Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
/* If Hardware Reduced flag is set, we are all done */
if (AcpiGbl_ReducedHardware)
{
return;
}
Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
ACPI_CHECK_OK (AcpiEnableEvent, Status);
/*
* GPEs: Handlers, enable/disable, etc.
*/
Status = AcpiInstallGpeHandler (NULL, 0,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 0,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
ACPI_CHECK_OK (AcpiSetGpe, Status);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
ACPI_CHECK_OK (AcpiSetGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 1,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 1);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 2,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 2);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 3,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 4,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 5,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 5);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 6);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 9);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiInstallGpeHandler (NULL, 0x19,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0x19);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
/* GPE block 1 */
Status = AcpiInstallGpeHandler (NULL, 101,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 101);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiDisableGpe (NULL, 101);
ACPI_CHECK_OK (AcpiDisableGpe, Status);
AfInstallGpeBlock ();
/* Here is where the GPEs are actually "enabled" */
Status = AcpiUpdateAllGpes ();
ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
Status = AcpiGetHandle (NULL, "RSRC", &Handle);
if (ACPI_SUCCESS (Status))
{
ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
if (ACPI_SUCCESS (Status))
{
AcpiOsFree (ReturnBuf.Pointer);
}
}
/* Test global lock */
Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle1);
ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle2);
ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
/* Test timer interfaces */
Status = AcpiGetTimerResolution (&Temp);
ACPI_CHECK_OK (AcpiGetTimerResolution, Status);
Status = AcpiGetTimer (&Temp);
ACPI_CHECK_OK (AcpiGetTimer, Status);
Status = AcpiGetTimerDuration (0x1000, 0x2000, &Temp);
ACPI_CHECK_OK (AcpiGetTimerDuration, Status);
#endif /* !ACPI_REDUCED_HARDWARE */
}

View File

@ -0,0 +1,457 @@
/******************************************************************************
*
* Module Name: aeinstall - Installation of operation region handlers
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2017, 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.
*
*****************************************************************************
*
* Alternatively, you may choose to be licensed under the terms of the
* following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any 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.
*
* Alternatively, you may choose to be licensed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
*****************************************************************************/
#include "aecommon.h"
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("aeinstall")
static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
void *HandlerContext,
void **RegionContext);
static ACPI_STATUS
AeInstallEcHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AeInstallPciHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
BOOLEAN AcpiGbl_DisplayRegionAccess = FALSE;
ACPI_CONNECTION_INFO AeMyContext;
/*
* We will override some of the default region handlers, especially
* the SystemMemory handler, which must be implemented locally.
* These handlers are installed "early" - before any _REG methods
* are executed - since they are special in the sense that the ACPI spec
* declares that they must "always be available". Cannot override the
* DataTable region handler either -- needed for test execution.
*
* NOTE: The local region handler will simulate access to these address
* spaces by creating a memory buffer behind each operation region.
*/
static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_EC
};
/*
* We will install handlers for some of the various address space IDs.
* Test one user-defined address space (used by aslts).
*/
#define ACPI_ADR_SPACE_USER_DEFINED1 0x80
#define ACPI_ADR_SPACE_USER_DEFINED2 0xE4
static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
{
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_GPIO,
ACPI_ADR_SPACE_GSBUS,
ACPI_ADR_SPACE_FIXED_HARDWARE,
ACPI_ADR_SPACE_USER_DEFINED1,
ACPI_ADR_SPACE_USER_DEFINED2
};
/******************************************************************************
*
* FUNCTION: AeRegionInit
*
* PARAMETERS: Region init handler
*
* RETURN: Status
*
* DESCRIPTION: Opregion init function.
*
*****************************************************************************/
static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
void *HandlerContext,
void **RegionContext)
{
if (Function == ACPI_REGION_DEACTIVATE)
{
*RegionContext = NULL;
}
else
{
*RegionContext = RegionHandle;
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AeOverrideRegionHandlers
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Override the default region handlers for memory, i/o, and
* pci_config. Also install a handler for EC. This is part of
* the "install early handlers" functionality.
*
*****************************************************************************/
void
AeOverrideRegionHandlers (
void)
{
UINT32 i;
ACPI_STATUS Status;
/*
* Install handlers that will override the default handlers for some of
* the space IDs.
*/
for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++)
{
/* Install handler at the root object */
Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT,
DefaultSpaceIdList[i], AeRegionHandler, AeRegionInit,
&AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]),
DefaultSpaceIdList[i]));
}
}
}
/******************************************************************************
*
* FUNCTION: AeInstallRegionHandlers
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Install handlers for the address spaces other than
* SystemMemory, SystemIO, and PCI_CONFIG.
*
*****************************************************************************/
void
AeInstallRegionHandlers (
void)
{
UINT32 i;
ACPI_STATUS Status;
/*
* Install handlers for some of the "device driver" address spaces
* such as SMBus, etc.
*/
for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
{
/* Install handler at the root object */
Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT,
SpaceIdList[i], AeRegionHandler, AeRegionInit,
&AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
return;
}
}
}
/*******************************************************************************
*
* FUNCTION: AeInstallDeviceHandlers
*
* PARAMETERS: None
*
* RETURN: Status
*
* DESCRIPTION: Install handlers for all EC and PCI devices in the namespace
*
******************************************************************************/
ACPI_STATUS
AeInstallDeviceHandlers (
void)
{
/* Find all Embedded Controller devices */
AcpiGetDevices ("PNP0C09", AeInstallEcHandler, NULL, NULL);
/* Install a PCI handler */
AcpiGetDevices ("PNP0A08", AeInstallPciHandler, NULL, NULL);
return (AE_OK);
}
/*******************************************************************************
*
* FUNCTION: AeInstallEcHandler
*
* PARAMETERS: ACPI_WALK_NAMESPACE callback
*
* RETURN: Status
*
* DESCRIPTION: Walk entire namespace, install a handler for every EC
* device found.
*
******************************************************************************/
static ACPI_STATUS
AeInstallEcHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_STATUS Status;
/* Install the handler for this EC device */
Status = AcpiInstallAddressSpaceHandler (ObjHandle,
ACPI_ADR_SPACE_EC, AeRegionHandler, AeRegionInit, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for EC device (%p)",
ObjHandle));
}
return (Status);
}
/*******************************************************************************
*
* FUNCTION: AeInstallPciHandler
*
* PARAMETERS: ACPI_WALK_NAMESPACE callback
*
* RETURN: Status
*
* DESCRIPTION: Walk entire namespace, install a handler for every PCI
* device found.
*
******************************************************************************/
static ACPI_STATUS
AeInstallPciHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_STATUS Status;
/* Install memory and I/O handlers for the PCI device */
Status = AcpiInstallAddressSpaceHandler (ObjHandle,
ACPI_ADR_SPACE_SYSTEM_IO, AeRegionHandler, AeRegionInit,
&AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for PCI device (%p)",
ObjHandle));
}
Status = AcpiInstallAddressSpaceHandler (ObjHandle,
ACPI_ADR_SPACE_SYSTEM_MEMORY, AeRegionHandler, AeRegionInit,
&AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for PCI device (%p)",
ObjHandle));
}
return (AE_CTRL_TERMINATE);
}

View File

@ -810,11 +810,15 @@ EnterDebugger:
AcpiTerminateDebugger ();
/* re-enable debug output for AcpiTerminate output */
AcpiGbl_DbOutputFlags = ACPI_DB_CONSOLE_OUTPUT;
NormalExit:
ExitCode = 0;
ErrorExit:
(void) AcpiOsTerminate ();
(void) AcpiTerminate ();
AcDeleteTableList (ListHead);
return (ExitCode);
}

View File

@ -1,6 +1,6 @@
/******************************************************************************
*
* Module Name: aeregion - Operation region support for acpiexec
* Module Name: aeregion - Handler for operation regions
*
*****************************************************************************/
@ -155,283 +155,7 @@
ACPI_MODULE_NAME ("aeregion")
/* Local prototypes */
static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
void *HandlerContext,
void **RegionContext);
static ACPI_STATUS
AeInstallEcHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
static ACPI_STATUS
AeInstallPciHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue);
static AE_DEBUG_REGIONS AeRegions;
BOOLEAN AcpiGbl_DisplayRegionAccess = FALSE;
ACPI_CONNECTION_INFO AeMyContext;
/*
* We will override some of the default region handlers, especially
* the SystemMemory handler, which must be implemented locally.
* These handlers are installed "early" - before any _REG methods
* are executed - since they are special in the sense that the ACPI spec
* declares that they must "always be available". Cannot override the
* DataTable region handler either -- needed for test execution.
*
* NOTE: The local region handler will simulate access to these address
* spaces by creating a memory buffer behind each operation region.
*/
static ACPI_ADR_SPACE_TYPE DefaultSpaceIdList[] =
{
ACPI_ADR_SPACE_SYSTEM_MEMORY,
ACPI_ADR_SPACE_SYSTEM_IO,
ACPI_ADR_SPACE_PCI_CONFIG,
ACPI_ADR_SPACE_EC
};
/*
* We will install handlers for some of the various address space IDs.
* Test one user-defined address space (used by aslts).
*/
#define ACPI_ADR_SPACE_USER_DEFINED1 0x80
#define ACPI_ADR_SPACE_USER_DEFINED2 0xE4
static ACPI_ADR_SPACE_TYPE SpaceIdList[] =
{
ACPI_ADR_SPACE_SMBUS,
ACPI_ADR_SPACE_CMOS,
ACPI_ADR_SPACE_PCI_BAR_TARGET,
ACPI_ADR_SPACE_IPMI,
ACPI_ADR_SPACE_GPIO,
ACPI_ADR_SPACE_GSBUS,
ACPI_ADR_SPACE_FIXED_HARDWARE,
ACPI_ADR_SPACE_USER_DEFINED1,
ACPI_ADR_SPACE_USER_DEFINED2
};
/******************************************************************************
*
* FUNCTION: AeRegionInit
*
* PARAMETERS: Region init handler
*
* RETURN: Status
*
* DESCRIPTION: Opregion init function.
*
*****************************************************************************/
static ACPI_STATUS
AeRegionInit (
ACPI_HANDLE RegionHandle,
UINT32 Function,
void *HandlerContext,
void **RegionContext)
{
if (Function == ACPI_REGION_DEACTIVATE)
{
*RegionContext = NULL;
}
else
{
*RegionContext = RegionHandle;
}
return (AE_OK);
}
/******************************************************************************
*
* FUNCTION: AeOverrideRegionHandlers
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Override the default region handlers for memory, i/o, and
* pci_config. Also install a handler for EC. This is part of
* the "install early handlers" functionality.
*
*****************************************************************************/
void
AeOverrideRegionHandlers (
void)
{
UINT32 i;
ACPI_STATUS Status;
/*
* Install handlers that will override the default handlers for some of
* the space IDs.
*/
for (i = 0; i < ACPI_ARRAY_LENGTH (DefaultSpaceIdList); i++)
{
/* Install handler at the root object */
Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT,
DefaultSpaceIdList[i], AeRegionHandler,
AeRegionInit, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName ((UINT8) DefaultSpaceIdList[i]),
DefaultSpaceIdList[i]));
}
}
}
/******************************************************************************
*
* FUNCTION: AeInstallRegionHandlers
*
* PARAMETERS: None
*
* RETURN: None
*
* DESCRIPTION: Install handlers for the address spaces other than memory,
* i/o, and pci_config.
*
*****************************************************************************/
void
AeInstallRegionHandlers (
void)
{
UINT32 i;
ACPI_STATUS Status;
/*
* Install handlers for some of the "device driver" address spaces
* such as SMBus, etc.
*/
for (i = 0; i < ACPI_ARRAY_LENGTH (SpaceIdList); i++)
{
/* Install handler at the root object */
Status = AcpiInstallAddressSpaceHandler (ACPI_ROOT_OBJECT,
SpaceIdList[i], AeRegionHandler,
AeRegionInit, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for %s space(%u)",
AcpiUtGetRegionName((UINT8) SpaceIdList[i]), SpaceIdList[i]));
return;
}
}
}
/*******************************************************************************
*
* FUNCTION: AeInstallDeviceHandlers,
* AeInstallEcHandler,
* AeInstallPciHandler
*
* PARAMETERS: ACPI_WALK_NAMESPACE callback
*
* RETURN: Status
*
* DESCRIPTION: Walk entire namespace, install a handler for every EC
* and PCI device found.
*
******************************************************************************/
static ACPI_STATUS
AeInstallEcHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_STATUS Status;
/* Install the handler for this EC device */
Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_EC,
AeRegionHandler, AeRegionInit, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for EC device (%p)",
ObjHandle));
}
return (Status);
}
static ACPI_STATUS
AeInstallPciHandler (
ACPI_HANDLE ObjHandle,
UINT32 Level,
void *Context,
void **ReturnValue)
{
ACPI_STATUS Status;
/* Install memory and I/O handlers for the PCI device */
Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_IO,
AeRegionHandler, AeRegionInit, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for PCI device (%p)",
ObjHandle));
}
Status = AcpiInstallAddressSpaceHandler (ObjHandle, ACPI_ADR_SPACE_SYSTEM_MEMORY,
AeRegionHandler, AeRegionInit, &AeMyContext);
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status,
"Could not install an OpRegion handler for PCI device (%p)",
ObjHandle));
}
return (AE_CTRL_TERMINATE);
}
ACPI_STATUS
AeInstallDeviceHandlers (
void)
{
/* Find all Embedded Controller devices */
AcpiGetDevices ("PNP0C09", AeInstallEcHandler, NULL, NULL);
/* Install a PCI handler */
AcpiGetDevices ("PNP0A08", AeInstallPciHandler, NULL, NULL);
return (AE_OK);
}
/******************************************************************************

View File

@ -0,0 +1,596 @@
/******************************************************************************
*
* Module Name: aetests - Miscellaneous tests for ACPICA public interfaces
*
*****************************************************************************/
/******************************************************************************
*
* 1. Copyright Notice
*
* Some or all of this work - Copyright (c) 1999 - 2017, 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.
*
*****************************************************************************
*
* Alternatively, you may choose to be licensed under the terms of the
* following license:
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions, and the following disclaimer,
* without modification.
* 2. Redistributions in binary form must reproduce at minimum a disclaimer
* substantially similar to the "NO WARRANTY" disclaimer below
* ("Disclaimer") and any redistribution must be conditioned upon
* including a substantially similar Disclaimer requirement for further
* binary redistribution.
* 3. Neither the names of the above-listed copyright holders nor the names
* of any 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.
*
* Alternatively, you may choose to be licensed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*
*****************************************************************************/
#include "aecommon.h"
#define _COMPONENT ACPI_TOOLS
ACPI_MODULE_NAME ("aetests")
/* Local prototypes */
static void
AeMutexInterfaces (
void);
static void
AeHardwareInterfaces (
void);
static void
AeTestSleepData (
void);
/******************************************************************************
*
* FUNCTION: AeMiscellaneousTests
*
* DESCRIPTION: Various ACPICA validation tests.
*
*****************************************************************************/
void
AeMiscellaneousTests (
void)
{
ACPI_BUFFER ReturnBuf;
char Buffer[32];
ACPI_STATUS Status;
ACPI_STATISTICS Stats;
ACPI_HANDLE Handle;
#if (!ACPI_REDUCED_HARDWARE)
UINT32 Temp;
UINT32 LockHandle1;
UINT32 LockHandle2;
ACPI_VENDOR_UUID Uuid = {0, {ACPI_INIT_UUID (0,0,0,0,0,0,0,0,0,0,0)}};
#endif /* !ACPI_REDUCED_HARDWARE */
Status = AcpiGetHandle (NULL, "\\", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
if (AcpiGbl_DoInterfaceTests)
{
/*
* Tests for AcpiLoadTable and AcpiUnloadParentTable
*/
/* Attempt unload of DSDT, should fail */
Status = AcpiGetHandle (NULL, "\\_SB_", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiUnloadParentTable (Handle);
ACPI_CHECK_STATUS (AcpiUnloadParentTable, Status, AE_TYPE);
/* Load and unload SSDT4 */
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
Status = AcpiGetHandle (NULL, "\\_T96", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiUnloadParentTable (Handle);
ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
/* Re-load SSDT4 */
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt4Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
/* Unload and re-load SSDT2 (SSDT2 is in the XSDT) */
Status = AcpiGetHandle (NULL, "\\_T99", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiUnloadParentTable (Handle);
ACPI_CHECK_OK (AcpiUnloadParentTable, Status);
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt2Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
/* Load OEM9 table (causes table override) */
Status = AcpiLoadTable ((ACPI_TABLE_HEADER *) Ssdt3Code);
ACPI_CHECK_OK (AcpiLoadTable, Status);
}
AeHardwareInterfaces ();
AeGenericRegisters ();
AeSetupConfiguration (Ssdt3Code);
AeTestBufferArgument();
AeTestPackageArgument ();
AeMutexInterfaces ();
AeTestSleepData ();
/* Test _OSI install/remove */
Status = AcpiInstallInterface ("");
ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_BAD_PARAMETER);
Status = AcpiInstallInterface ("TestString");
ACPI_CHECK_OK (AcpiInstallInterface, Status);
Status = AcpiInstallInterface ("TestString");
ACPI_CHECK_STATUS (AcpiInstallInterface, Status, AE_ALREADY_EXISTS);
Status = AcpiRemoveInterface ("Windows 2006");
ACPI_CHECK_OK (AcpiRemoveInterface, Status);
Status = AcpiRemoveInterface ("TestString");
ACPI_CHECK_OK (AcpiRemoveInterface, Status);
Status = AcpiRemoveInterface ("XXXXXX");
ACPI_CHECK_STATUS (AcpiRemoveInterface, Status, AE_NOT_EXIST);
Status = AcpiInstallInterface ("AnotherTestString");
ACPI_CHECK_OK (AcpiInstallInterface, Status);
/* Test _OSI execution */
Status = ExecuteOSI ("Extended Address Space Descriptor", ACPI_UINT64_MAX);
ACPI_CHECK_OK (ExecuteOSI, Status);
Status = ExecuteOSI ("Windows 2001", ACPI_UINT64_MAX);
ACPI_CHECK_OK (ExecuteOSI, Status);
Status = ExecuteOSI ("MichiganTerminalSystem", 0);
ACPI_CHECK_OK (ExecuteOSI, Status);
ReturnBuf.Length = 32;
ReturnBuf.Pointer = Buffer;
Status = AcpiGetName (ACPI_ROOT_OBJECT,
ACPI_FULL_PATHNAME_NO_TRAILING, &ReturnBuf);
ACPI_CHECK_OK (AcpiGetName, Status);
/* Get Devices */
Status = AcpiGetDevices (NULL, AeGetDevices, NULL, NULL);
ACPI_CHECK_OK (AcpiGetDevices, Status);
Status = AcpiGetStatistics (&Stats);
ACPI_CHECK_OK (AcpiGetStatistics, Status);
#if (!ACPI_REDUCED_HARDWARE)
Status = AcpiInstallGlobalEventHandler (AeGlobalEventHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGlobalEventHandler, Status);
/* If Hardware Reduced flag is set, we are all done */
if (AcpiGbl_ReducedHardware)
{
return;
}
Status = AcpiEnableEvent (ACPI_EVENT_GLOBAL, 0);
ACPI_CHECK_OK (AcpiEnableEvent, Status);
/*
* GPEs: Handlers, enable/disable, etc.
*/
Status = AcpiInstallGpeHandler (NULL, 0,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiRemoveGpeHandler (NULL, 0, AeGpeHandler);
ACPI_CHECK_OK (AcpiRemoveGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 0,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_DISABLE);
ACPI_CHECK_OK (AcpiSetGpe, Status);
Status = AcpiSetGpe (NULL, 0, ACPI_GPE_ENABLE);
ACPI_CHECK_OK (AcpiSetGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 1,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 1);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 2,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 2);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiInstallGpeHandler (NULL, 3,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 4,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiInstallGpeHandler (NULL, 5,
ACPI_GPE_EDGE_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiGetHandle (NULL, "\\_SB", &Handle);
ACPI_CHECK_OK (AcpiGetHandle, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 5);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetGpeWakeMask (NULL, 5, ACPI_GPE_ENABLE);
ACPI_CHECK_OK (AcpiSetGpeWakeMask, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 6);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetupGpeForWake (ACPI_ROOT_OBJECT, NULL, 6);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiSetupGpeForWake (Handle, NULL, 9);
ACPI_CHECK_OK (AcpiSetupGpeForWake, Status);
Status = AcpiInstallGpeHandler (NULL, 0x19,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 0x19);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
/* GPE block 1 */
Status = AcpiInstallGpeHandler (NULL, 101,
ACPI_GPE_LEVEL_TRIGGERED, AeGpeHandler, NULL);
ACPI_CHECK_OK (AcpiInstallGpeHandler, Status);
Status = AcpiEnableGpe (NULL, 101);
ACPI_CHECK_OK (AcpiEnableGpe, Status);
Status = AcpiDisableGpe (NULL, 101);
ACPI_CHECK_OK (AcpiDisableGpe, Status);
AfInstallGpeBlock ();
/* Here is where the GPEs are actually "enabled" */
Status = AcpiUpdateAllGpes ();
ACPI_CHECK_OK (AcpiUpdateAllGpes, Status);
Status = AcpiGetHandle (NULL, "RSRC", &Handle);
if (ACPI_SUCCESS (Status))
{
ReturnBuf.Length = ACPI_ALLOCATE_BUFFER;
Status = AcpiGetVendorResource (Handle, "_CRS", &Uuid, &ReturnBuf);
if (ACPI_SUCCESS (Status))
{
AcpiOsFree (ReturnBuf.Pointer);
}
}
/* Test global lock */
Status = AcpiAcquireGlobalLock (0xFFFF, &LockHandle1);
ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiAcquireGlobalLock (0x5, &LockHandle2);
ACPI_CHECK_OK (AcpiAcquireGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle1);
ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
Status = AcpiReleaseGlobalLock (LockHandle2);
ACPI_CHECK_OK (AcpiReleaseGlobalLock, Status);
/* Test timer interfaces */
Status = AcpiGetTimerResolution (&Temp);
ACPI_CHECK_OK (AcpiGetTimerResolution, Status);
Status = AcpiGetTimer (&Temp);
ACPI_CHECK_OK (AcpiGetTimer, Status);
Status = AcpiGetTimerDuration (0x1000, 0x2000, &Temp);
ACPI_CHECK_OK (AcpiGetTimerDuration, Status);
#endif /* !ACPI_REDUCED_HARDWARE */
}
/******************************************************************************
*
* FUNCTION: AeMutexInterfaces
*
* DESCRIPTION: Exercise the AML mutex access interfaces
*
*****************************************************************************/
static void
AeMutexInterfaces (
void)
{
ACPI_STATUS Status;
ACPI_HANDLE MutexHandle;
/* Get a handle to an AML mutex */
Status = AcpiGetHandle (NULL, "\\MTX1", &MutexHandle);
if (Status == AE_NOT_FOUND)
{
return;
}
ACPI_CHECK_OK (AcpiGetHandle, Status);
if (ACPI_FAILURE (Status))
{
return;
}
/* Acquire the mutex */
Status = AcpiAcquireMutex (NULL, "\\MTX1", 0xFFFF);
ACPI_CHECK_OK (AcpiAcquireMutex, Status);
if (ACPI_FAILURE (Status))
{
return;
}
/* Release mutex with different parameters */
Status = AcpiReleaseMutex (MutexHandle, NULL);
ACPI_CHECK_OK (AcpiReleaseMutex, Status);
}
/******************************************************************************
*
* FUNCTION: AeHardwareInterfaces
*
* DESCRIPTION: Call various hardware support interfaces
*
*****************************************************************************/
static void
AeHardwareInterfaces (
void)
{
#if (!ACPI_REDUCED_HARDWARE)
ACPI_STATUS Status;
UINT32 Value;
/* If Hardware Reduced flag is set, we are all done */
if (AcpiGbl_ReducedHardware)
{
return;
}
Status = AcpiWriteBitRegister (ACPI_BITREG_WAKE_STATUS, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_SLEEP_ENABLE, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiWriteBitRegister (ACPI_BITREG_ARB_DISABLE, 1);
ACPI_CHECK_OK (AcpiWriteBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_WAKE_STATUS, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_GLOBAL_LOCK_ENABLE, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_SLEEP_ENABLE, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
Status = AcpiReadBitRegister (ACPI_BITREG_ARB_DISABLE, &Value);
ACPI_CHECK_OK (AcpiReadBitRegister, Status);
#endif /* !ACPI_REDUCED_HARDWARE */
}
/******************************************************************************
*
* FUNCTION: AeTestSleepData
*
* DESCRIPTION: Exercise the sleep/wake support (_S0, _S1, etc.)
*
*****************************************************************************/
static void
AeTestSleepData (
void)
{
int State;
UINT8 TypeA;
UINT8 TypeB;
ACPI_STATUS Status;
/* Attempt to get sleep data for all known sleep states */
for (State = ACPI_STATE_S0; State <= ACPI_S_STATES_MAX; State++)
{
Status = AcpiGetSleepTypeData ((UINT8) State, &TypeA, &TypeB);
/* All sleep methods are optional */
if (Status != AE_NOT_FOUND)
{
ACPI_CHECK_OK (AcpiGetSleepTypeData, Status);
}
}
}

View File

@ -793,6 +793,8 @@ ACPI_TYPED_IDENTIFIER_TABLE AcpiIdentifiers[] = {
{"ACPI_MPST_POWER_STATE", SRC_TYPE_STRUCT},
{"ACPI_MCFG_ALLOCATION", SRC_TYPE_STRUCT},
{"ACPI_MSCT_PROXIMITY", SRC_TYPE_STRUCT},
{"ACPI_NFIT_CAPABILITIES", SRC_TYPE_STRUCT},
{"ACPI_NFIT_DEVICE_HANDLE", SRC_TYPE_STRUCT},
{"ACPI_NFIT_HEADER", SRC_TYPE_STRUCT},
{"ACPI_NFIT_SYSTEM_ADDRESS", SRC_TYPE_STRUCT},
{"ACPI_NFIT_MEMORY_MAP", SRC_TYPE_STRUCT},

View File

@ -180,7 +180,7 @@
#define AX_REQUIRED_TABLE 1
#define AX_UTILITY_NAME "ACPI Binary Table Extraction Utility"
#define AX_SUPPORTED_OPTIONS "ahlms:v^"
#define AX_SUPPORTED_OPTIONS "afhlms:v^"
#define AX_MULTI_TABLE_FILENAME "amltables.dat"
#define AX_TABLE_INFO_FORMAT " %4.4s - %7u bytes written (0x%8.8X) - %s\n"
@ -193,7 +193,7 @@
#define AX_LINE_BUFFER_SIZE 256
#define AX_MIN_BLOCK_HEADER_LENGTH 6 /* strlen ("DSDT @") */
#define AX_IS_TABLE_BLOCK_HEADER strstr (Gbl_LineBuffer, " @ ")
#define AX_IS_TABLE_BLOCK_HEADER (strlen (Gbl_LineBuffer) < AX_END_OF_HEX_DATA) && (strstr (Gbl_LineBuffer, " @ "))
#define AX_END_OF_HEX_DATA 55
@ -216,6 +216,7 @@ ACPI_GLOBAL (AX_TABLE_INFO, *Gbl_TableListHead);
ACPI_GLOBAL (char, Gbl_OutputFilename[32]);
ACPI_GLOBAL (unsigned char, Gbl_BinaryData[16]);
ACPI_GLOBAL (unsigned int, Gbl_TableCount);
ACPI_GLOBAL (BOOLEAN, Gbl_ForceExtraction);
/*

View File

@ -176,6 +176,7 @@ DisplayUsage (
ACPI_USAGE_HEADER ("acpixtract [option] <InputFile>");
ACPI_OPTION ("-a", "Extract all tables, not just DSDT/SSDT");
ACPI_OPTION ("-f", "Force extraction, even if there are errors");
ACPI_OPTION ("-l", "List table summaries, do not extract");
ACPI_OPTION ("-m", "Extract multiple DSDT/SSDTs to a single file");
ACPI_OPTION ("-s <signature>", "Extract all tables with <signature>");
@ -208,6 +209,7 @@ main (
Gbl_TableCount = 0;
Gbl_TableListHead = NULL;
Gbl_ForceExtraction = FALSE;
AxAction = AX_EXTRACT_AML_TABLES; /* Default: DSDT & SSDTs */
ACPI_DEBUG_INITIALIZE (); /* For debug version only */
@ -229,6 +231,11 @@ main (
AxAction = AX_EXTRACT_ALL; /* Extract all tables found */
break;
case 'f':
Gbl_ForceExtraction = TRUE; /* Ignore errors */
break;
case 'l':
AxAction = AX_LIST_ALL; /* List tables only, do not extract */

View File

@ -201,6 +201,7 @@ AxIsFileAscii (
FILE *Handle)
{
UINT8 Byte;
UINT32 Offset = 0;
/* Read the entire file */
@ -223,15 +224,27 @@ AxIsFileAscii (
if (!ACPI_IS_ASCII (Byte))
{
goto ErrorExit;
printf ("Found non-ascii char: %2.2X at file offset %u (0x%X)\n",
Byte, Offset, Offset);
if (!Gbl_ForceExtraction)
{
goto ErrorExit;
}
}
/* Ensure character is either printable or a "space" char */
else if (!isprint (Byte) && !isspace (Byte))
{
goto ErrorExit;
printf ("Found non-printable char: %2.2X at file offset %u (0x%X)\n",
Byte, Offset, Offset);
if (!Gbl_ForceExtraction)
{
goto ErrorExit;
}
}
Offset++;
}
/* File is OK (100% ASCII) */

View File

@ -212,9 +212,6 @@ RegionInit (
static void
ExecuteMAIN (void);
static void
ExecuteOSI (void);
ACPI_STATUS
InitializeAcpiTables (
void);
@ -263,7 +260,7 @@ main (
ACPI_EXCEPTION ((AE_INFO, AE_AML_OPERAND_TYPE,
"Example ACPICA exception message"));
ExecuteOSI ();
ExecuteOSI (NULL, 0);
ExecuteMAIN ();
return (0);
}
@ -540,8 +537,10 @@ InstallHandlers (void)
*
*****************************************************************************/
static void
ExecuteOSI (void)
ACPI_STATUS
ExecuteOSI (
char *OsiString,
UINT64 ExpectedResult)
{
ACPI_STATUS Status;
ACPI_OBJECT_LIST ArgList;
@ -569,7 +568,7 @@ ExecuteOSI (void)
if (ACPI_FAILURE (Status))
{
ACPI_EXCEPTION ((AE_INFO, Status, "While executing _OSI"));
return;
return (AE_OK);
}
/* Ensure that the return object is large enough */
@ -598,6 +597,7 @@ ErrorExit:
/* Free a buffer created via ACPI_ALLOCATE_BUFFER */
AcpiOsFree (ReturnValue.Pointer);
return (AE_OK);
}