def testGetInt64(self): self.assertEqual(0x123456789abcdef0, fdt_util.GetInt64(self.node, 'int64val')) self.assertEqual(3, fdt_util.GetInt64(self.node, 'missing', 3)) with self.assertRaises(ValueError) as e: fdt_util.GetInt64(self.node, 'intarray') self.assertIn( "property 'intarray' should be a list with 2 items for 64-bit values", str(e.exception))
def ReadNode(self): """Read properties from the atf-fip node""" super().ReadNode() self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0) self._fip_flags = fdt_util.GetInt64(self._node, 'fip-hdr-flags', 0) self._fip_align = fdt_util.GetInt(self._node, 'fip-align', 1) if tools.not_power_of_two(self._fip_align): raise ValueError( "Node '%s': FIP alignment %s must be a power of two" % (self._node.path, self._fip_align)) self.ReadEntries()
def ReadEntries(self): """Read the subnodes to find out what should go in this FIP""" for node in self._node.subnodes: fip_type = None etype = None if node.name in FIP_TYPES: fip_type = node.name etype = 'blob-ext' entry = Entry.Create(self, node, etype) entry._fip_uuid = fdt_util.GetBytes(node, 'fip-uuid', UUID_LEN) if not fip_type and not entry._fip_uuid: fip_type = fdt_util.GetString(node, 'fip-type') if not fip_type: self.Raise( "Must provide a fip-type (node name '%s' is not a known FIP type)" % node.name) entry._fip_type = fip_type entry._fip_flags = fdt_util.GetInt64(node, 'fip-flags', 0) entry.ReadNode() entry._fip_name = node.name self._entries[entry._fip_name] = entry