Lines Matching +full:entry +full:- +full:name
1 # SPDX-License-Identifier: GPL-2.0+
30 _pad_before: Number of bytes before the first entry starts. This
31 effectively changes the place where entry offset 0 starts
32 _pad_after: Number of bytes after the last entry ends. The last
33 entry will finish on or before this boundary
34 _pad_byte: Byte to use to pad the section where there is no entry
36 must be in-order in the device tree description
37 _skip_at_start: Number of bytes before the first entry starts. These
39 if _pad_before is 16, then the first entry would start at 16.
40 An entry with offset = 20 would in fact be written at offset 4
44 address (like 0xff800000) is the first entry offset. This causes
46 _name_prefix: Prefix to add to the name of all entries within this
50 def __init__(self, name, parent_section, node, image, test=False): argument
51 global entry
52 global Entry
53 import entry
54 from entry import Entry
57 self._name = name
79 self._align_size = fdt_util.GetInt(self._node, 'align-size')
83 self._pad_before = fdt_util.GetInt(self._node, 'pad-before', 0)
84 self._pad_after = fdt_util.GetInt(self._node, 'pad-after', 0)
85 self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0)
86 self._sort = fdt_util.GetBool(self._node, 'sort-by-offset')
87 self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
88 self._skip_at_start = fdt_util.GetInt(self._node, 'skip-at-start')
91 self._Raise("Section size must be provided when using end-at-4gb")
93 self._Raise("Provide either 'end-at-4gb' or 'skip-at-start'")
95 self._skip_at_start = 0x100000000 - self._size
99 self._name_prefix = fdt_util.GetString(self._node, 'name-prefix')
103 if node.name == 'hash':
105 entry = Entry.Create(self, node)
106 entry.SetPrefix(self._name_prefix)
107 self._entries[node.name] = entry
112 for entry in self._entries.values():
113 fdt_set.update(entry.GetFdtSet())
120 for entry in self._entries.values():
121 entry.ExpandEntries()
124 """Add new properties to the device tree as needed for this entry"""
125 for prop in ['offset', 'size', 'image-pos']:
129 for entry in self._entries.values():
130 entry.AddMissingProperties()
137 image_pos -= self._parent_section.GetRootSkipAtStart()
138 state.SetInt(self._node, 'image-pos', image_pos)
139 for entry in self._entries.values():
140 entry.SetCalculatedProperties()
146 for entry in todo:
147 if not entry.ProcessFdt(fdt):
148 next_todo.append(entry)
160 for entry in self._entries.values():
161 contents_size = max(contents_size, entry.offset + entry.size)
163 contents_size -= self._skip_at_start
176 self._Raise("Size %#x (%d) does not match align-size %#x (%d)" %
199 """Find an entry type in the section
202 etype: Entry type to find
204 entry matching that type, or None if not found
206 for entry in self._entries.values():
207 if entry.etype == etype:
208 return entry
212 """Call ObtainContents() for each entry
214 This calls each entry's ObtainContents() a few times until they all
215 return True. We stop calling an entry's function once it returns
216 True. This allows the contents of one entry to depend on another.
223 for entry in todo:
224 if not entry.ObtainContents():
225 next_todo.append(entry)
234 def _SetEntryOffsetSize(self, name, offset, size): argument
235 """Set the offset and size of an entry
238 name: Entry name to update
242 entry = self._entries.get(name)
243 if not entry:
244 self._Raise("Unable to set offset/size for unknown entry '%s'" %
245 name)
246 entry.SetOffsetSize(self._skip_at_start + offset, size)
251 This calls each entry's GetOffsets() method. If it returns a list
254 for entry in self._entries.values():
255 offset_dict = entry.GetOffsets()
256 for name, info in offset_dict.iteritems():
257 self._SetEntryOffsetSize(name, *info)
262 for entry in self._entries.values():
263 offset = entry.Pack(offset)
268 entries = sorted(self._entries.values(), key=lambda entry: entry.offset)
270 for entry in entries:
271 self._entries[entry._node.name] = entry
276 for entry in self._entries.values():
278 exp_entry.ExpandToLimit(entry.offset)
280 if entry.expand_size:
281 exp_entry = entry
295 for entry in self._entries.values():
296 entry.CheckOffset()
297 if (entry.offset < self._skip_at_start or
298 entry.offset + entry.size > self._skip_at_start + self._size):
299 entry.Raise("Offset %#x (%d) is outside the section starting "
301 (entry.offset, entry.offset, self._skip_at_start,
303 if entry.offset < offset:
304 entry.Raise("Offset %#x (%d) overlaps with previous entry '%s' "
306 (entry.offset, entry.offset, prev_name, offset, offset))
307 offset = entry.offset + entry.size
308 prev_name = entry.GetPath()
312 for entry in self._entries.values():
313 entry.SetImagePos(image_pos)
316 """Call the ProcessContents() method for each entry
318 This is intended to adjust the contents as needed by the entry type.
320 for entry in self._entries.values():
321 entry.ProcessContents()
325 for entry in self._entries.values():
326 entry.WriteSymbols(self)
337 for entry in self._entries.values():
338 data = entry.GetData()
339 base = self._pad_before + entry.offset - self._skip_at_start
347 Looks up a symbol in an ELF file. Only entry types which come from an
350 At present the only entry property supported is offset.
353 sym_name: Symbol name in the ELF file to look up in the format
354 _binman_<entry>_prop_<property> where <entry> is the name of
355 the entry and <property> is the property to find (e.g.
357 _any to <entry> to have it search for any matching entry. E.g.
358 _binman_u_boot_any_prop_offset will match entries called u-boot,
359 u-boot-img and u-boot-nodtb)
377 entry_name = entry_name.replace('_', '-')
378 entry = self._entries.get(entry_name)
379 if not entry:
380 if entry_name.endswith('-any'):
381 root = entry_name[:-4]
382 for name in self._entries:
383 if name.startswith(root):
384 rest = name[len(root):]
385 if rest in ['', '-img', '-nodtb']:
386 entry = self._entries[name]
387 if not entry:
388 err = ("%s: Entry '%s' not found in list (%s)" %
395 return entry.offset
397 return entry.image_pos
412 This is only meaningful if the section has a pre-defined size, or the
417 Entry size in bytes
427 Entry.WriteMapLine(fd, indent, self._name, self._offset, self._size,
429 for entry in self._entries.values():
430 entry.WriteMap(fd, indent + 1)
433 """Get the data contents of an entry specified by a phandle
435 This uses a phandle to look up a node and and find the entry
436 associated with it. Then it returnst he contents of that entry.
440 source_entry: Entry containing that phandle (used for error
444 data from associated entry (as a string), or None if not found
449 for entry in self._entries.values():
450 if entry._node == node:
451 return entry.GetData()
452 source_entry.Raise("Cannot find entry for node '%s'" % node.name)