1# SPDX-License-Identifier: GPL-2.0+
2# Copyright (c) 2016 Google, Inc
3# Written by Simon Glass <sjg@chromium.org>
4#
5# Entry-type module for Intel Firmware Image Table
6#
7
8import struct
9
10from binman.etype.blob_ext import Entry_blob_ext
11
12class Entry_intel_fit(Entry_blob_ext):
13    """Intel Firmware Image Table (FIT)
14
15    This entry contains a dummy FIT as required by recent Intel CPUs. The FIT
16    contains information about the firmware and microcode available in the
17    image.
18
19    At present binman only supports a basic FIT with no microcode.
20    """
21    def __init__(self, section, etype, node):
22        super().__init__(section, etype, node)
23
24    def ReadNode(self):
25        """Force 16-byte alignment as required by FIT pointer"""
26        super().ReadNode()
27        self.align = 16
28
29    def ObtainContents(self):
30        data = struct.pack('<8sIHBB', b'_FIT_   ', 1, 0x100, 0x80, 0x7d)
31        self.SetContents(data)
32        return True
33