mirror of
https://github.com/smaeul/u-boot.git
synced 2025-10-14 21:06:01 +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:
parent
8d7ff12e63
commit
f02d0eb3fa
@ -104,7 +104,9 @@ def get_value(ftype, value):
|
|||||||
elif ftype == fdt.TYPE_BYTE:
|
elif ftype == fdt.TYPE_BYTE:
|
||||||
return '%#x' % tools.ToByte(value[0])
|
return '%#x' % tools.ToByte(value[0])
|
||||||
elif ftype == fdt.TYPE_STRING:
|
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:
|
elif ftype == fdt.TYPE_BOOL:
|
||||||
return 'true'
|
return 'true'
|
||||||
elif ftype == fdt.TYPE_INT64:
|
elif ftype == fdt.TYPE_INT64:
|
||||||
|
@ -34,6 +34,7 @@
|
|||||||
longbytearray = [09 0a 0b 0c];
|
longbytearray = [09 0a 0b 0c];
|
||||||
stringval = "message2";
|
stringval = "message2";
|
||||||
stringarray = "another", "multi-word", "message";
|
stringarray = "another", "multi-word", "message";
|
||||||
|
acpi-name = "\\_SB.GPO0";
|
||||||
};
|
};
|
||||||
|
|
||||||
spl-test3 {
|
spl-test3 {
|
||||||
|
@ -72,6 +72,7 @@ class TestDtoc(unittest.TestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
tools.PrepareOutputDir(None)
|
tools.PrepareOutputDir(None)
|
||||||
|
cls.maxDiff = None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
@ -188,6 +189,7 @@ struct dtd_sandbox_pmic_test {
|
|||||||
\tfdt64_t\t\treg[2];
|
\tfdt64_t\t\treg[2];
|
||||||
};
|
};
|
||||||
struct dtd_sandbox_spl_test {
|
struct dtd_sandbox_spl_test {
|
||||||
|
\tconst char * acpi_name;
|
||||||
\tbool\t\tboolval;
|
\tbool\t\tboolval;
|
||||||
\tunsigned char\tbytearray[3];
|
\tunsigned char\tbytearray[3];
|
||||||
\tunsigned char\tbyteval;
|
\tunsigned char\tbyteval;
|
||||||
@ -225,6 +227,7 @@ U_BOOT_DEVICE(spl_test) = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct dtd_sandbox_spl_test dtv_spl_test2 = {
|
static struct dtd_sandbox_spl_test dtv_spl_test2 = {
|
||||||
|
\t.acpi_name\t\t= "\\\\_SB.GPO0",
|
||||||
\t.bytearray\t\t= {0x1, 0x23, 0x34},
|
\t.bytearray\t\t= {0x1, 0x23, 0x34},
|
||||||
\t.byteval\t\t= 0x8,
|
\t.byteval\t\t= 0x8,
|
||||||
\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0},
|
\t.intarray\t\t= {0x5, 0x0, 0x0, 0x0},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user