summaryrefslogtreecommitdiffstats
path: root/sys/contrib/dev/acpica/common/dmextern.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/contrib/dev/acpica/common/dmextern.c')
-rw-r--r--sys/contrib/dev/acpica/common/dmextern.c41
1 files changed, 36 insertions, 5 deletions
diff --git a/sys/contrib/dev/acpica/common/dmextern.c b/sys/contrib/dev/acpica/common/dmextern.c
index d0290c1..f5d676d 100644
--- a/sys/contrib/dev/acpica/common/dmextern.c
+++ b/sys/contrib/dev/acpica/common/dmextern.c
@@ -153,10 +153,17 @@ AcpiDmNormalizeParentPrefix (
char *Fullpath;
char *ParentPath;
ACPI_SIZE Length;
+ UINT32 Index = 0;
- /* Search upwards in the parse tree until we reach a namespace node */
+ if (!Op)
+ {
+ return (NULL);
+ }
+
+ /* Search upwards in the parse tree until we reach the next namespace node */
+ Op = Op->Common.Parent;
while (Op)
{
if (Op->Common.Node)
@@ -205,6 +212,13 @@ AcpiDmNormalizeParentPrefix (
* for the required dot separator (ParentPath.Path)
*/
Length++;
+
+ /* For External() statements, we do not want a leading '\' */
+
+ if (*ParentPath == AML_ROOT_PREFIX)
+ {
+ Index = 1;
+ }
}
Fullpath = ACPI_ALLOCATE_ZEROED (Length);
@@ -219,7 +233,7 @@ AcpiDmNormalizeParentPrefix (
*
* Copy the parent path
*/
- ACPI_STRCAT (Fullpath, ParentPath);
+ ACPI_STRCPY (Fullpath, &ParentPath[Index]);
/*
* Add dot separator
@@ -366,7 +380,22 @@ AcpiDmAddToExternalList (
return;
}
- /* Externalize the ACPI path */
+ /*
+ * We don't want External() statements to contain a leading '\'.
+ * This prevents duplicate external statements of the form:
+ *
+ * External (\ABCD)
+ * External (ABCD)
+ *
+ * This would cause a compile time error when the disassembled
+ * output file is recompiled.
+ */
+ if ((*Path == AML_ROOT_PREFIX) && (Path[1]))
+ {
+ Path++;
+ }
+
+ /* Externalize the ACPI pathname */
Status = AcpiNsExternalizeName (ACPI_UINT32_MAX, Path,
NULL, &ExternalPath);
@@ -375,8 +404,10 @@ AcpiDmAddToExternalList (
return;
}
- /* Get the full pathname from root if "Path" has a parent prefix */
-
+ /*
+ * Get the full pathname from the root if "Path" has one or more
+ * parent prefixes (^). Note: path will not contain a leading '\'.
+ */
if (*Path == (UINT8) AML_PARENT_PREFIX)
{
Fullpath = AcpiDmNormalizeParentPrefix (Op, ExternalPath);
OpenPOWER on IntegriCloud