提交 3def0cf2 编写于 作者: S Simon Glass

libfdt: Bring in proposed pylibfdt changes

This provides various patches sent to the devicetree-compiler mailing list
to enhance the Python bindings. A final version of this patch may be
created once upstreaming is complete, but if it takes too long, this can
act as a placeholder.

New pylibfdt features:
- Support for most remaining, relevant libfdt functions
- Support for sequential-write functions

Changes are applied to existing U-Boot tools as needed.
Signed-off-by: NSimon Glass <sjg@chromium.org>
上级 5c890238
......@@ -1313,10 +1313,13 @@ static inline int fdt_property_u64(void *fdt, const char *name, uint64_t val)
fdt64_t tmp = cpu_to_fdt64(val);
return fdt_property(fdt, name, &tmp, sizeof(tmp));
}
#ifndef SWIG /* Not available in Python */
static inline int fdt_property_cell(void *fdt, const char *name, uint32_t val)
{
return fdt_property_u32(fdt, name, val);
}
#endif
/**
* fdt_property_placeholder - add a new property and return a ptr to its value
......
......@@ -36,14 +36,26 @@ sys.path.append(os.path.join(our_path, '../patman'))
import dtb_platdata
def run_tests():
"""Run all the test we have for dtoc"""
def run_tests(args):
"""Run all the test we have for dtoc
Args:
args: List of positional args provided to binman. This can hold a test
name to execute (as in 'binman -t testSections', for example)
"""
import test_dtoc
result = unittest.TestResult()
sys.argv = [sys.argv[0]]
test_name = args and args[0] or None
for module in (test_dtoc.TestDtoc,):
suite = unittest.TestLoader().loadTestsFromTestCase(module)
if test_name:
try:
suite = unittest.TestLoader().loadTestsFromName(test_name, module)
except AttributeError:
continue
else:
suite = unittest.TestLoader().loadTestsFromTestCase(module)
suite.run(result)
print result
......@@ -68,7 +80,7 @@ parser.add_option('-t', '--test', action='store_true', dest='test',
# Run our meagre tests
if options.test:
run_tests()
run_tests(args)
else:
dtb_platdata.run_steps(args, options.dtb_file, options.include_disabled,
......
......@@ -234,7 +234,6 @@ class Node:
be updated.
"""
if self._offset != my_offset:
#print '%s: %d -> %d\n' % (self.path, self._offset, my_offset)
self._offset = my_offset
offset = libfdt.fdt_first_subnode(self._fdt.GetFdt(), self._offset)
for subnode in self.subnodes:
......@@ -359,7 +358,7 @@ class Fdt:
poffset = libfdt.fdt_first_property_offset(self._fdt, node._offset)
while poffset >= 0:
p = self._fdt_obj.get_property_by_offset(poffset)
prop = Prop(node, poffset, p.name, p.value)
prop = Prop(node, poffset, p.name, p)
props_dict[prop.name] = prop
poffset = libfdt.fdt_next_property_offset(self._fdt, poffset)
......
......@@ -4,7 +4,8 @@
"""Tests for the dtb_platdata module
This includes unit tests for some functions and functional tests for
This includes unit tests for some functions and functional tests for the dtoc
tool.
"""
import collections
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册