aboutsummaryrefslogtreecommitdiff
path: root/sys/contrib/dev/acpica/components/utilities
diff options
context:
space:
mode:
authorJung-uk Kim <jkim@FreeBSD.org>2016-11-22 05:54:37 +0000
committerJung-uk Kim <jkim@FreeBSD.org>2016-11-22 05:54:37 +0000
commit1cc50d6b6a02d2c48cb9b812432a492d284c6dd1 (patch)
treef1bf249b4181d49c5f9ab35e1a81807dbce72c6c /sys/contrib/dev/acpica/components/utilities
parent74a54be9a43af7469a005e893a656774dc3c85dd (diff)
parenta56e3c255d5c5dfa4dd3a2fda4705a1607a6b7f3 (diff)
Merge ACPICA 20161117.
Notes
Notes: svn path=/head/; revision=308953
Diffstat (limited to 'sys/contrib/dev/acpica/components/utilities')
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utdecode.c54
-rw-r--r--sys/contrib/dev/acpica/components/utilities/utresrc.c19
2 files changed, 68 insertions, 5 deletions
diff --git a/sys/contrib/dev/acpica/components/utilities/utdecode.c b/sys/contrib/dev/acpica/components/utilities/utdecode.c
index 8f8f06e862f2..237333f9efdf 100644
--- a/sys/contrib/dev/acpica/components/utilities/utdecode.c
+++ b/sys/contrib/dev/acpica/components/utilities/utdecode.c
@@ -44,6 +44,7 @@
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <contrib/dev/acpica/include/acnamesp.h>
+#include <contrib/dev/acpica/include/amlcode.h>
#define _COMPONENT ACPI_UTILITIES
ACPI_MODULE_NAME ("utdecode")
@@ -604,6 +605,59 @@ AcpiUtGetNotifyName (
return ("Hardware-Specific");
}
+
+
+/*******************************************************************************
+ *
+ * FUNCTION: AcpiUtGetArgumentTypeName
+ *
+ * PARAMETERS: ArgType - an ARGP_* parser argument type
+ *
+ * RETURN: Decoded ARGP_* type
+ *
+ * DESCRIPTION: Decode an ARGP_* parser type, as defined in the amlcode.h file,
+ * and used in the acopcode.h file. For example, ARGP_TERMARG.
+ * Used for debug only.
+ *
+ ******************************************************************************/
+
+static const char *AcpiGbl_ArgumentType[20] =
+{
+ /* 00 */ "Unknown ARGP",
+ /* 01 */ "ByteData",
+ /* 02 */ "ByteList",
+ /* 03 */ "CharList",
+ /* 04 */ "DataObject",
+ /* 05 */ "DataObjectList",
+ /* 06 */ "DWordData",
+ /* 07 */ "FieldList",
+ /* 08 */ "Name",
+ /* 09 */ "NameString",
+ /* 0A */ "ObjectList",
+ /* 0B */ "PackageLength",
+ /* 0C */ "SuperName",
+ /* 0D */ "Target",
+ /* 0E */ "TermArg",
+ /* 0F */ "TermList",
+ /* 10 */ "WordData",
+ /* 11 */ "QWordData",
+ /* 12 */ "SimpleName",
+ /* 13 */ "NameOrRef"
+};
+
+const char *
+AcpiUtGetArgumentTypeName (
+ UINT32 ArgType)
+{
+
+ if (ArgType > ARGP_MAX)
+ {
+ return ("Unknown ARGP");
+ }
+
+ return (AcpiGbl_ArgumentType[ArgType]);
+}
+
#endif
diff --git a/sys/contrib/dev/acpica/components/utilities/utresrc.c b/sys/contrib/dev/acpica/components/utilities/utresrc.c
index 72ebf6565e47..f59d9754855c 100644
--- a/sys/contrib/dev/acpica/components/utilities/utresrc.c
+++ b/sys/contrib/dev/acpica/components/utilities/utresrc.c
@@ -468,9 +468,11 @@ AcpiUtWalkAmlResources (
ACPI_FUNCTION_TRACE (UtWalkAmlResources);
- /* The absolute minimum resource template is one EndTag descriptor */
-
- if (AmlLength < sizeof (AML_RESOURCE_END_TAG))
+ /*
+ * The absolute minimum resource template is one EndTag descriptor.
+ * However, we will treat a lone EndTag as just a simple buffer.
+ */
+ if (AmlLength <= sizeof (AML_RESOURCE_END_TAG))
{
return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
}
@@ -503,8 +505,8 @@ AcpiUtWalkAmlResources (
if (UserFunction)
{
- Status = UserFunction (
- Aml, Length, Offset, ResourceIndex, Context);
+ Status = UserFunction (Aml, Length, Offset,
+ ResourceIndex, Context);
if (ACPI_FAILURE (Status))
{
return_ACPI_STATUS (Status);
@@ -531,6 +533,13 @@ AcpiUtWalkAmlResources (
*Context = Aml;
}
+ /* Check if buffer is defined to be longer than the resource length */
+
+ if (AmlLength > (Offset + Length))
+ {
+ return_ACPI_STATUS (AE_AML_NO_RESOURCE_END_TAG);
+ }
+
/* Normal exit */
return_ACPI_STATUS (AE_OK);