From patchwork Fri Nov 10 18:11:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 836821 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=fwts-devel-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 3yYSlt5tpJz9t3f; Sat, 11 Nov 2017 05:11:34 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1eDDm8-0002Uc-KX; Fri, 10 Nov 2017 18:11:32 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1eDDm2-0002Tx-KX for fwts-devel@lists.ubuntu.com; Fri, 10 Nov 2017 18:11:26 +0000 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1eDDm0-0001di-0c; Fri, 10 Nov 2017 18:11:26 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] ACPICA: Update to version 20171110 Date: Fri, 10 Nov 2017 18:11:23 +0000 Message-Id: <20171110181123.18331-1-colin.king@canonical.com> X-Mailer: git-send-email 2.14.1 MIME-Version: 1.0 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: "fwts-devel" From: Colin Ian King Changes in this release of ACPICA are detailed at the following link on the ACPICA developer mailing list: https://lists.acpica.org/pipermail/devel/2017-November/001573.html Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpica/Makefile.am | 1 + src/acpica/source/common/dmtable.c | 1 + src/acpica/source/common/dmtbdump.c | 5 + src/acpica/source/common/dmtbinfo.c | 15 + src/acpica/source/compiler/asldefine.h | 2 +- src/acpica/source/compiler/dttable2.c | 7 +- src/acpica/source/compiler/dttemplate.h | 69 ++-- src/acpica/source/components/debugger/dbexec.c | 124 +++++- src/acpica/source/components/debugger/dbinput.c | 205 +++++---- src/acpica/source/components/dispatcher/dsfield.c | 27 +- src/acpica/source/components/dispatcher/dsobject.c | 3 +- src/acpica/source/components/dispatcher/dsutils.c | 3 +- src/acpica/source/components/dispatcher/dswload.c | 4 +- src/acpica/source/components/dispatcher/dswload2.c | 12 +- src/acpica/source/components/events/evregion.c | 11 + src/acpica/source/components/namespace/nsconvert.c | 3 +- src/acpica/source/components/namespace/nsnames.c | 172 ++++++++ src/acpica/source/components/parser/psargs.c | 2 +- src/acpica/source/components/utilities/utdecode.c | 11 +- src/acpica/source/components/utilities/uterror.c | 78 +++- src/acpica/source/components/utilities/utmutex.c | 7 +- .../source/components/utilities/utstrsuppt.c | 34 +- src/acpica/source/components/utilities/uttrack.c | 2 +- src/acpica/source/components/utilities/utxferror.c | 8 +- src/acpica/source/include/acdebug.h | 6 + src/acpica/source/include/acdisasm.h | 1 + src/acpica/source/include/aclocal.h | 13 +- src/acpica/source/include/acmacros.h | 2 +- src/acpica/source/include/acnamesp.h | 5 + src/acpica/source/include/acpixf.h | 2 +- src/acpica/source/include/actbl1.h | 89 +++- src/acpica/source/include/actbl2.h | 1 + src/acpica/source/include/acutils.h | 14 +- src/acpica/source/tools/acpiexec/aecommon.h | 79 +++- src/acpica/source/tools/acpiexec/aeinstall.c | 457 +++++++++++++++++++++ src/acpica/source/tools/acpiexec/aeregion.c | 278 +------------ 36 files changed, 1267 insertions(+), 486 deletions(-) create mode 100644 src/acpica/source/tools/acpiexec/aeinstall.c diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am index 64755b41..a66ae057 100644 --- a/src/acpica/Makefile.am +++ b/src/acpica/Makefile.am @@ -277,6 +277,7 @@ libfwtsacpica_la_SOURCES = \ source/tools/acpiexec/aehandlers.c \ source/tools/acpiexec/aeexception.c \ source/tools/acpiexec/aeregion.c \ + source/tools/acpiexec/aeinstall.c \ source/os_specific/service_layers/osgendbg.c libfwtsacpica_la_LIBADD = \ diff --git a/src/acpica/source/common/dmtable.c b/src/acpica/source/common/dmtable.c index 07d27faf..60951732 100644 --- a/src/acpica/source/common/dmtable.c +++ b/src/acpica/source/common/dmtable.c @@ -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 */ }; diff --git a/src/acpica/source/common/dmtbdump.c b/src/acpica/source/common/dmtbdump.c index 0f0697e3..1ef91c2d 100644 --- a/src/acpica/source/common/dmtbdump.c +++ b/src/acpica/source/common/dmtbdump.c @@ -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); diff --git a/src/acpica/source/common/dmtbinfo.c b/src/acpica/source/common/dmtbinfo.c index ad546e8a..bccb986f 100644 --- a/src/acpica/source/common/dmtbinfo.c +++ b/src/acpica/source/common/dmtbinfo.c @@ -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 +}; + /******************************************************************************* * diff --git a/src/acpica/source/compiler/asldefine.h b/src/acpica/source/compiler/asldefine.h index a7d1a289..bcdc8c24 100644 --- a/src/acpica/source/compiler/asldefine.h +++ b/src/acpica/source/compiler/asldefine.h @@ -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 */ diff --git a/src/acpica/source/compiler/dttable2.c b/src/acpica/source/compiler/dttable2.c index 172354cd..db79bac7 100644 --- a/src/acpica/source/compiler/dttable2.c +++ b/src/acpica/source/compiler/dttable2.c @@ -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: diff --git a/src/acpica/source/compiler/dttemplate.h b/src/acpica/source/compiler/dttemplate.h index 38750f79..4c77afc1 100644 --- a/src/acpica/source/compiler/dttemplate.h +++ b/src/acpica/source/compiler/dttemplate.h @@ -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[] = diff --git a/src/acpica/source/components/debugger/dbexec.c b/src/acpica/source/components/debugger/dbexec.c index 0a00be81..76f4d9f1 100644 --- a/src/acpica/source/components/debugger/dbexec.c +++ b/src/acpica/source/components/debugger/dbexec.c @@ -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 diff --git a/src/acpica/source/components/debugger/dbinput.c b/src/acpica/source/components/debugger/dbinput.c index d3755f4f..ae044bf5 100644 --- a/src/acpica/source/components/debugger/dbinput.c +++ b/src/acpica/source/components/debugger/dbinput.c @@ -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
|", "\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 ] [console]", "Get/Set debug level for file or console\n"}, - {1, " Locks", "Current status of internal mutexes\n"}, - {1, " Osi [Install|Remove ]", "Display or modify global _OSI list\n"}, - {1, " Quit or Exit", "Exit this command\n"}, - {8, " Stats ", "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, " ! ", "Execute command from history buffer\n"}, - {1, " !!", "Execute last command again\n"}, - - {0, "\nNamespace Access Commands:", "\n"}, - {1, " Businfo", "Display system bus info\n"}, - {1, " Disassemble ", "Disassemble a control method\n"}, - {1, " Find (? 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 ", "Send a notification on Object\n"}, - {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, - {1, " Owner [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 []", "Set or Get current execution prefix\n"}, - {1, " References ", "Find all references to object at addr\n"}, - {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, - {1, " Set N ", "Set value for named integer\n"}, - {1, " Template ", "Format/dump a Buffer/ResourceTemplate\n"}, - {1, " Type ", "Display object type\n"}, - - {0, "\nControl Method Execution Commands:","\n"}, - {1, " Arguments (or Args)", "Display method arguments\n"}, - {1, " Breakpoint ", "Set an AML execution breakpoint\n"}, - {1, " Call", "Run to next control method invocation\n"}, - {1, " Debug [Arguments]", "Single Step a control method\n"}, - {6, " Evaluate", "Synonym for Execute\n"}, - {5, " Execute [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 <#> ", "Set method data (Arguments/Locals)\n"}, - {1, " Stop", "Terminate control method\n"}, - {5, " Trace [] [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, " ", "Single step next AML opcode (over calls)\n"}, + {0, "\nNamespace Access:", "\n"}, + {1, " Businfo", "Display system bus info\n"}, + {1, " Disassemble ", "Disassemble a control method\n"}, + {1, " Find (? 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 ", "Send a notification on Object\n"}, + {1, " Objects [ObjectType]", "Display summary of all objects or just given type\n"}, + {1, " Owner [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 []", "Set or Get current execution prefix\n"}, + {1, " References ", "Find all references to object at addr\n"}, + {1, " Resources [DeviceName]", "Display Device resources (no arg = all devices)\n"}, + {1, " Set N ", "Set value for named integer\n"}, + {1, " Template ", "Format/dump a Buffer/ResourceTemplate\n"}, + {1, " Type ", "Display object type\n"}, + + {0, "\nControl Method Execution:", "\n"}, + {1, " Evaluate [Arguments]", "Evaluate object or control method\n"}, + {1, " Execute [Arguments]", "Synonym for Evaluate\n"}, +#ifdef ACPI_APPLICATION + {1, " Background [Arguments]", "Evaluate object/method in a separate thread\n"}, + {1, " Thread ", "Spawn threads to execute method(s)\n"}, +#endif + {1, " Debug [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, "\nMiscellaneous:", "\n"}, + {1, " Allocations", "Display list of current memory allocations\n"}, + {2, " Dump
|", "\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 ] [console]", "Get/Set debug level for file or console\n"}, + {1, " Locks", "Current status of internal mutexes\n"}, + {1, " Osi [Install|Remove ]", "Display or modify global _OSI list\n"}, + {1, " Quit or Exit", "Exit this command\n"}, + {8, " Stats ", "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, " ! ", "Execute command from history buffer\n"}, + {1, " !!", "Execute last command again\n"}, + + {0, "\nMethod and Namespace Debugging:", "\n"}, + {5, " Trace [] [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 ", "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 ", "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 <#> ", "Set method data (Arguments/Locals)\n"}, + {1, " Stop", "Terminate control method\n"}, + {1, " Tree", "Display control method calling tree\n"}, + {1, " ", "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 ", "Generate AcpiEvent (Fixed/GPE)\n"}, - {1, " Gpe [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 I/O Commands:", "\n"}, - {1, " Close", "Close debug output file\n"}, - {1, " Load ", "Load ACPI table from a file\n"}, - {1, " Open ", "Open a file for debug output\n"}, - {1, " Unload ", "Unload an ACPI table via namespace object\n"}, - - {0, "\nUser Space Commands:", "\n"}, - {1, " Terminate", "Delete namespace and all internal objects\n"}, - {1, " Thread ", "Spawn threads to execute method(s)\n"}, - - {0, "\nDebug Test Commands:", "\n"}, - {3, " Test ", "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, "\nFile Operations:", "\n"}, + {1, " Close", "Close debug output file\n"}, + {1, " Load ", "Load ACPI table from a file\n"}, + {1, " Open ", "Open a file for debug output\n"}, + {1, " Unload ", "Unload an ACPI table via namespace object\n"}, + + {0, "\nHardware Simulation:", "\n"}, + {1, " EnableAcpi", "Enable ACPI (hardware) mode\n"}, + {1, " Event ", "Generate AcpiEvent (Fixed/GPE)\n"}, + {1, " Gpe [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], diff --git a/src/acpica/source/components/dispatcher/dsfield.c b/src/acpica/source/components/dispatcher/dsfield.c index fe9d0605..08ae5caf 100644 --- a/src/acpica/source/components/dispatcher/dsfield.c +++ b/src/acpica/source/components/dispatcher/dsfield.c @@ -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); } diff --git a/src/acpica/source/components/dispatcher/dsobject.c b/src/acpica/source/components/dispatcher/dsobject.c index 4cbd8f78..81dba555 100644 --- a/src/acpica/source/components/dispatcher/dsobject.c +++ b/src/acpica/source/components/dispatcher/dsobject.c @@ -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); } } diff --git a/src/acpica/source/components/dispatcher/dsutils.c b/src/acpica/source/components/dispatcher/dsutils.c index 4688e16e..710c0b3c 100644 --- a/src/acpica/source/components/dispatcher/dsutils.c +++ b/src/acpica/source/components/dispatcher/dsutils.c @@ -732,7 +732,8 @@ AcpiDsCreateOperand ( if (ACPI_FAILURE (Status)) { - ACPI_ERROR_NAMESPACE (NameString, Status); + ACPI_ERROR_NAMESPACE (WalkState->ScopeInfo, + NameString, Status); } } diff --git a/src/acpica/source/components/dispatcher/dswload.c b/src/acpica/source/components/dispatcher/dswload.c index 8793c0ed..1ee7dd64 100644 --- a/src/acpica/source/components/dispatcher/dswload.c +++ b/src/acpica/source/components/dispatcher/dswload.c @@ -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); } } diff --git a/src/acpica/source/components/dispatcher/dswload2.c b/src/acpica/source/components/dispatcher/dswload2.c index 184f6aa3..36885b97 100644 --- a/src/acpica/source/components/dispatcher/dswload2.c +++ b/src/acpica/source/components/dispatcher/dswload2.c @@ -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; diff --git a/src/acpica/source/components/events/evregion.c b/src/acpica/source/components/events/evregion.c index 454b26e9..88edc2d6 100644 --- a/src/acpica/source/components/events/evregion.c +++ b/src/acpica/source/components/events/evregion.c @@ -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 & diff --git a/src/acpica/source/components/namespace/nsconvert.c b/src/acpica/source/components/namespace/nsconvert.c index bb825895..9245beed 100644 --- a/src/acpica/source/components/namespace/nsconvert.c +++ b/src/acpica/source/components/namespace/nsconvert.c @@ -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; } diff --git a/src/acpica/source/components/namespace/nsnames.c b/src/acpica/source/components/namespace/nsnames.c index fb74c44c..bfe27007 100644 --- a/src/acpica/source/components/namespace/nsnames.c +++ b/src/acpica/source/components/namespace/nsnames.c @@ -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); +} diff --git a/src/acpica/source/components/parser/psargs.c b/src/acpica/source/components/parser/psargs.c index baa60f26..bc3f5ce4 100644 --- a/src/acpica/source/components/parser/psargs.c +++ b/src/acpica/source/components/parser/psargs.c @@ -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) diff --git a/src/acpica/source/components/utilities/utdecode.c b/src/acpica/source/components/utilities/utdecode.c index 7cb171bc..5c42badf 100644 --- a/src/acpica/source/components/utilities/utdecode.c +++ b/src/acpica/source/components/utilities/utdecode.c @@ -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 diff --git a/src/acpica/source/components/utilities/uterror.c b/src/acpica/source/components/utilities/uterror.c index a429a7f4..28ad2e32 100644 --- a/src/acpica/source/components/utilities/uterror.c +++ b/src/acpica/source/components/utilities/uterror.c @@ -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 /******************************************************************************* * diff --git a/src/acpica/source/components/utilities/utmutex.c b/src/acpica/source/components/utilities/utmutex.c index 7297929c..503dc508 100644 --- a/src/acpica/source/components/utilities/utmutex.c +++ b/src/acpica/source/components/utilities/utmutex.c @@ -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); } diff --git a/src/acpica/source/components/utilities/utstrsuppt.c b/src/acpica/source/components/utilities/utstrsuppt.c index 9197a57a..bdb2f4fa 100644 --- a/src/acpica/source/components/utilities/utstrsuppt.c +++ b/src/acpica/source/components/utilities/utstrsuppt.c @@ -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 */ diff --git a/src/acpica/source/components/utilities/uttrack.c b/src/acpica/source/components/utilities/uttrack.c index a88a4a3d..e74ff066 100644 --- a/src/acpica/source/components/utilities/uttrack.c +++ b/src/acpica/source/components/utilities/uttrack.c @@ -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)); } diff --git a/src/acpica/source/components/utilities/utxferror.c b/src/acpica/source/components/utilities/utxferror.c index a81352b9..95cb4509 100644 --- a/src/acpica/source/components/utilities/utxferror.c +++ b/src/acpica/source/components/utilities/utxferror.c @@ -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)); } diff --git a/src/acpica/source/include/acdebug.h b/src/acpica/source/include/acdebug.h index a1bc5426..f12c75d7 100644 --- a/src/acpica/source/include/acdebug.h +++ b/src/acpica/source/include/acdebug.h @@ -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, diff --git a/src/acpica/source/include/acdisasm.h b/src/acpica/source/include/acdisasm.h index 0c465602..d8ed7168 100644 --- a/src/acpica/source/include/acdisasm.h +++ b/src/acpica/source/include/acdisasm.h @@ -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[]; diff --git a/src/acpica/source/include/aclocal.h b/src/acpica/source/include/aclocal.h index 7a20fe6f..5ad31902 100644 --- a/src/acpica/source/include/aclocal.h +++ b/src/acpica/source/include/aclocal.h @@ -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]; diff --git a/src/acpica/source/include/acmacros.h b/src/acpica/source/include/acmacros.h index 9d7ed06d..feb45937 100644 --- a/src/acpica/source/include/acmacros.h +++ b/src/acpica/source/include/acmacros.h @@ -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 diff --git a/src/acpica/source/include/acnamesp.h b/src/acpica/source/include/acnamesp.h index 990309eb..43402719 100644 --- a/src/acpica/source/include/acnamesp.h +++ b/src/acpica/source/include/acnamesp.h @@ -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); diff --git a/src/acpica/source/include/acpixf.h b/src/acpica/source/include/acpixf.h index bd5fde17..3af2a137 100644 --- a/src/acpica/source/include/acpixf.h +++ b/src/acpica/source/include/acpixf.h @@ -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" diff --git a/src/acpica/source/include/actbl1.h b/src/acpica/source/include/actbl1.h index 7eed2c55..6d0f5c85 100644 --- a/src/acpica/source/include/actbl1.h +++ b/src/acpica/source/include/actbl1.h @@ -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 */ diff --git a/src/acpica/source/include/actbl2.h b/src/acpica/source/include/actbl2.h index 02a897b0..cdf7ac06 100644 --- a/src/acpica/source/include/actbl2.h +++ b/src/acpica/source/include/actbl2.h @@ -1048,6 +1048,7 @@ typedef struct acpi_iort_smmu_v3 UINT8 Pxm; UINT8 Reserved1; UINT16 Reserved2; + UINT32 IdMappingIndex; } ACPI_IORT_SMMU_V3; diff --git a/src/acpica/source/include/acutils.h b/src/acpica/source/include/acutils.h index a3f0150b..ff9f72db 100644 --- a/src/acpica/source/include/acutils.h +++ b/src/acpica/source/include/acutils.h @@ -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); diff --git a/src/acpica/source/tools/acpiexec/aecommon.h b/src/acpica/source/tools/acpiexec/aecommon.h index 00bf09b4..968efd7a 100644 --- a/src/acpica/source/tools/acpiexec/aecommon.h +++ b/src/acpica/source/tools/acpiexec/aecommon.h @@ -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,29 +322,50 @@ AeGlobalEventHandler ( UINT32 EventNumber, void *Context); -/* aeregion */ +/* aeinitfile */ -ACPI_STATUS -AeInstallDeviceHandlers ( +int +AeOpenInitializationFile ( + char *Filename); + +void +AeDoObjectOverrides ( void); +ACPI_STATUS +AeSetupConfiguration ( + void *RegionAddr); + +/* aeexec */ + void -AeInstallRegionHandlers ( +AeTestBufferArgument ( void); void -AeOverrideRegionHandlers ( +AeTestPackageArgument ( void); +ACPI_STATUS +AeGetDevices ( + ACPI_HANDLE ObjHandle, + UINT32 NestingLevel, + void *Context, + void **ReturnValue); -/* aeinitfile */ +ACPI_STATUS +ExecuteOSI ( + char *OsiString, + UINT64 ExpectedResult); -int -AeOpenInitializationFile ( - char *Filename); +void +AeGenericRegisters ( + void); +#if (!ACPI_REDUCED_HARDWARE) void -AeDoObjectOverrides ( +AfInstallGpeBlock ( void); +#endif /* !ACPI_REDUCED_HARDWARE */ #endif /* _AECOMMON */ diff --git a/src/acpica/source/tools/acpiexec/aeinstall.c b/src/acpica/source/tools/acpiexec/aeinstall.c new file mode 100644 index 00000000..02ff9288 --- /dev/null +++ b/src/acpica/source/tools/acpiexec/aeinstall.c @@ -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); +} diff --git a/src/acpica/source/tools/acpiexec/aeregion.c b/src/acpica/source/tools/acpiexec/aeregion.c index 4076c06b..69c3999f 100644 --- a/src/acpica/source/tools/acpiexec/aeregion.c +++ b/src/acpica/source/tools/acpiexec/aeregion.c @@ -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); -} /******************************************************************************