1# SPDX-License-Identifier: GPL-2.0+ 2# Copyright (c) 2018 Google, Inc 3# Written by Simon Glass <sjg@chromium.org> 4# 5# Entry-type module for sections, which are entries which can contain other 6# entries. 7# 8 9from entry import Entry 10import fdt_util 11import tools 12 13import bsection 14 15class Entry_section(Entry): 16 def __init__(self, image, etype, node): 17 Entry.__init__(self, image, etype, node) 18 self._section = bsection.Section(node.name, node) 19 20 def ProcessFdt(self, fdt): 21 return self._section.ProcessFdt(fdt) 22 23 def AddMissingProperties(self): 24 Entry.AddMissingProperties(self) 25 self._section.AddMissingProperties() 26 27 def ObtainContents(self): 28 return self._section.GetEntryContents() 29 30 def GetData(self): 31 return self._section.GetData() 32 33 def GetPositions(self): 34 """Handle entries that want to set the position/size of other entries 35 36 This calls each entry's GetPositions() method. If it returns a list 37 of entries to update, it updates them. 38 """ 39 self._section.GetEntryPositions() 40 return {} 41 42 def Pack(self, pos): 43 """Pack all entries into the section""" 44 self._section.PackEntries() 45 self.size = self._section.CheckSize() 46 return super(Entry_section, self).Pack(pos) 47 48 def WriteSymbols(self, section): 49 """Write symbol values into binary files for access at run time""" 50 self._section.WriteSymbols() 51 52 def SetCalculatedProperties(self): 53 Entry.SetCalculatedProperties(self) 54 self._section.SetCalculatedProperties() 55 56 def ProcessContents(self): 57 self._section.ProcessEntryContents() 58 super(Entry_section, self).ProcessContents() 59 60 def CheckPosition(self): 61 self._section.CheckEntries() 62 63 def WriteMap(self, fd, indent): 64 """Write a map of the section to a .map file 65 66 Args: 67 fd: File to write the map to 68 """ 69 super(Entry_section, self).WriteMap(fd, indent) 70 self._section.WriteMap(fd, indent + 1) 71