1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-11-02 19:36:22 +01:00

dtoc: Support ACPI paths in of-platdata

The start of an ACPI path typically has backslashes in it. These are not
preserved during the translation from device tree to C code, since dtc
(correctly) uses the first backslash as an escape character, and dtoc
therefore leaves it out of the C string.

Fix this with special-case handling.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-07-07 21:32:06 -06:00
committed by Bin Meng
parent 8d7ff12e63
commit f02d0eb3fa
3 changed files with 7 additions and 1 deletions

View File

@@ -104,7 +104,9 @@ def get_value(ftype, value):
elif ftype == fdt.TYPE_BYTE:
return '%#x' % tools.ToByte(value[0])
elif ftype == fdt.TYPE_STRING:
return '"%s"' % value
# Handle evil ACPI backslashes by adding another backslash before them.
# So "\\_SB.GPO0" in the device tree effectively stays like that in C
return '"%s"' % value.replace('\\', '\\\\')
elif ftype == fdt.TYPE_BOOL:
return 'true'
elif ftype == fdt.TYPE_INT64: