mirror of
https://github.com/dgibson/dtc.git
synced 2026-10-10 08:03:00 -04:00
pylibfdt: Add add_mem_rsv() and del_mem_rsv()
The memory reserve map can be read through num_mem_rsv() and get_mem_rsv(), but changing it requires calling the raw fdt_* wrappers with the private Fdt._fdt buffer, as the class exposes no methods for the write side. Add them next to the existing accessors, and test them. Signed-off-by: Alexey Charkov <alchark@flipper.net> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
3750493c8b
commit
89c99ce78a
2 changed files with 50 additions and 0 deletions
|
|
@ -411,6 +411,20 @@ class PyLibfdtBasicTests(unittest.TestCase):
|
|||
self.fdt.get_mem_rsv(0))
|
||||
self.assertEqual([123456789, 0o10000], self.fdt.get_mem_rsv(1))
|
||||
|
||||
def testAddDelReserveMap(self):
|
||||
"""Test that we can add to and remove from the memory reserve map"""
|
||||
fdt = _ReadFdt('test_tree1.dtb')
|
||||
fdt.resize(fdt.totalsize() + 64)
|
||||
|
||||
self.assertEqual(0, fdt.add_mem_rsv(0x40000000, 0x2000))
|
||||
self.assertEqual(3, fdt.num_mem_rsv())
|
||||
self.assertEqual([0x40000000, 0x2000], fdt.get_mem_rsv(2))
|
||||
|
||||
self.assertEqual(0, fdt.del_mem_rsv(2))
|
||||
self.assertEqual(2, fdt.num_mem_rsv())
|
||||
self.assertEqual(-libfdt.NOTFOUND,
|
||||
fdt.del_mem_rsv(2, QUIET_NOTFOUND))
|
||||
|
||||
def testCells(self):
|
||||
"""Test that we can read #address-cells and #size-cells"""
|
||||
self.assertEqual(1, self.fdt.address_cells(0))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue