From patchwork Sat Aug 24 13:22:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1152639 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="TzNQ3Zck"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 46FzvR6XyRz9s7T for ; Sat, 24 Aug 2019 23:41:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id 95BFFC21E8A; Sat, 24 Aug 2019 13:28:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id ED451C21DDC; Sat, 24 Aug 2019 13:27:53 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id B7114C21DD3; Sat, 24 Aug 2019 13:27:28 +0000 (UTC) Received: from mail-io1-f67.google.com (mail-io1-f67.google.com [209.85.166.67]) by lists.denx.de (Postfix) with ESMTPS id 53502C21D8A for ; Sat, 24 Aug 2019 13:27:24 +0000 (UTC) Received: by mail-io1-f67.google.com with SMTP id s21so26758571ioa.1 for ; Sat, 24 Aug 2019 06:27:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PMASFI/xdJzdP1ocVWQQXe8bREm/dY2PNS4fbQXBnZM=; b=TzNQ3ZckZaTOA+iRmdqHnJxPZxDgDkfLOpUNgDM+5/m/IkjB7Myv1mfbA3A2Ry1kNF gRwg2j6exGsyXbmi+6NAdYSDo2vNEhmo3Qe80qYKa2aiCh0DfbBFSbvZF/vjzUMkbSr0 ZL+QX059+6ZO6K9c0dWN0L45PbvUDDPTRlvLg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PMASFI/xdJzdP1ocVWQQXe8bREm/dY2PNS4fbQXBnZM=; b=hJKC6odzO9k7LrmCwgokj/n7bxH4YEx/cV3kMg/dk0+uMAe6P2qQsDmSxd1didpcJ9 D3biglx0vDeiq4g39XmmOdOGnA29EMupVtCNKbsC4pfrWUiDbb1kMrjguTYBmpFx35ng ho8vY67lchAyp8d4Ba48iWQPEF72VP9HK6guvhsQPr1TAKqI2GAQ9OA2BX9zHzsyvF22 neClx8qGy1veiFR7cW9FSyutS2YgtbQn777zwTC0bRdGeCcwYBMLit3FgshteJYrEmzT Qgyqi/Tpwa/eDNPY3xY+7ol4olKx+pL6fz3lTgKLgQy0r6quU6xcItUMUAdp7Rv/lPVC 50kA== X-Gm-Message-State: APjAAAUDVPU1E2zUSklGkuyawpAPyrOV47Bb8uQZRdYt3heKuIVIfrE1 0m8e70YC5LGUxBo64NCpnfPEegcBIk0= X-Google-Smtp-Source: APXvYqxMeza9/ajk4kJy6ToaxOuJbrVHOm7wL5Rt8QRtMbP9sFrzAeXEpi4zY2VDhjWR5d0+fcumig== X-Received: by 2002:a6b:6812:: with SMTP id d18mr7041913ioc.239.1566653243122; Sat, 24 Aug 2019 06:27:23 -0700 (PDT) Received: from kiwi.bld.corp.google.com ([2620:15c:183:0:8223:87c:a681:66aa]) by smtp.gmail.com with ESMTPSA id l2sm8881790ioq.83.2019.08.24.06.27.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 24 Aug 2019 06:27:22 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Sat, 24 Aug 2019 07:22:50 -0600 Message-Id: <20190824132315.53130-11-sjg@chromium.org> X-Mailer: git-send-email 2.23.0.187.g17f5b7556c-goog In-Reply-To: <20190824132315.53130-1-sjg@chromium.org> References: <20190824132315.53130-1-sjg@chromium.org> MIME-Version: 1.0 Subject: [U-Boot] [PATCH 10/34] binman: Add support for Intel FIT X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" A Firmware Image Table (FIT) is a data structure defined by Intel which contains information about various things needed by the SoC, such as microcode. Add support for this entry as well as the pointer to it. The contents of FIT are fixed at present. Future work is needed to support adding microcode, etc. Signed-off-by: Simon Glass Signed-off-by: Simon Glass --- tools/binman/README.entries | 19 ++++++++++ tools/binman/etype/intel_fit.py | 32 ++++++++++++++++ tools/binman/etype/intel_fit_ptr.py | 41 +++++++++++++++++++++ tools/binman/ftest.py | 20 ++++++++++ tools/binman/test/147_intel_fit.dts | 20 ++++++++++ tools/binman/test/148_intel_fit_missing.dts | 17 +++++++++ 6 files changed, 149 insertions(+) create mode 100644 tools/binman/etype/intel_fit.py create mode 100644 tools/binman/etype/intel_fit_ptr.py create mode 100644 tools/binman/test/147_intel_fit.dts create mode 100644 tools/binman/test/148_intel_fit_missing.dts diff --git a/tools/binman/README.entries b/tools/binman/README.entries index d17b3cb078..dba51e6daa 100644 --- a/tools/binman/README.entries +++ b/tools/binman/README.entries @@ -391,6 +391,25 @@ See README.x86 for information about x86 binary blobs. +Entry: intel-fit: Intel Firmware Image Table (FIT) +-------------------------------------------------- + +This entry contains a dummy FIT as required by recent Intel CPUs. The FIT +contains information about the firmware and microcode available in the +image. + +At present binman only supports a basic FIT with no microcode. + + + +Entry: intel-fit-ptr: Intel Firmware Image Table (FIT) pointer +-------------------------------------------------------------- + +This entry contains a pointer to the FIT. It is required to be at address +0xffffffc0 in the image. + + + Entry: intel-fsp: Entry containing an Intel Firmware Support Package (FSP) file ------------------------------------------------------------------------------- diff --git a/tools/binman/etype/intel_fit.py b/tools/binman/etype/intel_fit.py new file mode 100644 index 0000000000..23606d27d0 --- /dev/null +++ b/tools/binman/etype/intel_fit.py @@ -0,0 +1,32 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass +# +# Entry-type module for Intel Firmware Image Table +# + +import struct + +from blob import Entry_blob + +class Entry_intel_fit(Entry_blob): + """Intel Firmware Image Table (FIT) + + This entry contains a dummy FIT as required by recent Intel CPUs. The FIT + contains information about the firmware and microcode available in the + image. + + At present binman only supports a basic FIT with no microcode. + """ + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) + + def ReadNode(self): + """Force 16-byte alignment as required by FIT pointer""" + Entry_blob.ReadNode(self) + self.align = 16 + + def ObtainContents(self): + data = struct.pack('<8sIHBB', '_FIT_ ', 1, 0x100, 0x80, 0x7d) + self.SetContents(data) + return True diff --git a/tools/binman/etype/intel_fit_ptr.py b/tools/binman/etype/intel_fit_ptr.py new file mode 100644 index 0000000000..148b206c3c --- /dev/null +++ b/tools/binman/etype/intel_fit_ptr.py @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: GPL-2.0+ +# Copyright (c) 2016 Google, Inc +# Written by Simon Glass +# +# Entry-type module for a pointer to an Intel Firmware Image Table +# + +import struct + +from blob import Entry_blob + +class Entry_intel_fit_ptr(Entry_blob): + """Intel Firmware Image Table (FIT) pointer + + This entry contains a pointer to the FIT. It is required to be at address + 0xffffffc0 in the image. + """ + def __init__(self, section, etype, node): + Entry_blob.__init__(self, section, etype, node) + if self.HasSibling('intel-fit') is False: + self.Raise("'intel-fit-ptr' section must have an 'intel-fit' sibling") + + def _GetContents(self): + fit_pos = self.GetSiblingImagePos('intel-fit') + return struct.pack('; + #size-cells = <1>; + + binman { + end-at-4gb; + size = <0x80>; + + u-boot { + }; + + intel-fit { + }; + + intel-fit-ptr { + }; + }; +}; diff --git a/tools/binman/test/148_intel_fit_missing.dts b/tools/binman/test/148_intel_fit_missing.dts new file mode 100644 index 0000000000..388c76b1ab --- /dev/null +++ b/tools/binman/test/148_intel_fit_missing.dts @@ -0,0 +1,17 @@ +/dts-v1/; + +/ { + #address-cells = <1>; + #size-cells = <1>; + + binman { + end-at-4gb; + size = <0x80>; + + u-boot { + }; + + intel-fit-ptr { + }; + }; +};