1 # SPDX-License-Identifier: GPL-2.0+
2 # Copyright (c) 2016 Google, Inc
3 # Written by Simon Glass <sjg@chromium.org>
5 # Entry-type module for a pointer to an Intel Firmware Image Table
10 from binman.etype.blob import Entry_blob
12 class Entry_intel_fit_ptr(Entry_blob):
13 """Intel Firmware Image Table (FIT) pointer
15 This entry contains a pointer to the FIT. It is required to be at address
16 0xffffffc0 in the image.
18 def __init__(self, section, etype, node):
19 Entry_blob.__init__(self, section, etype, node)
20 if self.HasSibling('intel-fit') is False:
21 self.Raise("'intel-fit-ptr' section must have an 'intel-fit' sibling")
23 def _GetContents(self):
24 fit_pos = self.GetSiblingImagePos('intel-fit')
25 return struct.pack('<II', fit_pos or 0, 0)
27 def ObtainContents(self):
28 self.SetContents(self._GetContents())
31 def ProcessContents(self):
32 """Write an updated version of the FIT pointer to this entry
34 This is necessary since image_pos is not available when ObtainContents()
35 is called, since by then the entries have not been packed in the image.
37 return self.ProcessContentsUpdate(self._GetContents())
39 def Pack(self, offset):
40 """Special pack method to set the offset to the right place"""
41 return Entry_blob.Pack(self, 0xffffffc0)