[U-Boot] [PATCH 27/34] binman: Add support for Intel FSP meminit

Simon Glass sjg at chromium.org
Sat Aug 24 13:23:07 UTC 2019


The Intel FSP supports initialising memory early during boot using a binary
blob called 'fspm'. Add support for this.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/binman/README.entries           | 17 +++++++++++++++++
 tools/binman/etype/intel_fsp_m.py     | 27 +++++++++++++++++++++++++++
 tools/binman/ftest.py                 |  8 ++++++++
 tools/binman/test/152_intel_fsp_m.dts | 14 ++++++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 tools/binman/etype/intel_fsp_m.py
 create mode 100644 tools/binman/test/152_intel_fsp_m.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index dba51e6daa..bce2244596 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -427,6 +427,23 @@ See README.x86 for information about x86 binary blobs.
 
 
 
+Entry: intel-fsp-m: Entry containing Intel Firmware Support Package (FSP) memory init
+-------------------------------------------------------------------------------------
+
+Properties / Entry arguments:
+    - filename: Filename of file to read into entry
+
+This file contains a binary blob which is used on some devices to set up
+SDRAM. U-Boot executes this code in SPL so that it can make full use of
+memory. Documentation is typically not available in sufficient detail to
+allow U-Boot do this this itself..
+
+An example filename is 'fsp_m.bin'
+
+See README.x86 for information about x86 binary blobs.
+
+
+
 Entry: intel-ifwi: Entry containing an Intel Integrated Firmware Image (IFWI) file
 ----------------------------------------------------------------------------------
 
diff --git a/tools/binman/etype/intel_fsp_m.py b/tools/binman/etype/intel_fsp_m.py
new file mode 100644
index 0000000000..2d6b2b6621
--- /dev/null
+++ b/tools/binman/etype/intel_fsp_m.py
@@ -0,0 +1,27 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2019 Google LLC
+# Written by Simon Glass <sjg at chromium.org>
+#
+# Entry-type module for Intel Firmware Support Package binary blob (T section)
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_intel_fsp_m(Entry_blob):
+    """Entry containing Intel Firmware Support Package (FSP) memory init
+
+    Properties / Entry arguments:
+        - filename: Filename of file to read into entry
+
+    This file contains a binary blob which is used on some devices to set up
+    SDRAM. U-Boot executes this code in SPL so that it can make full use of
+    memory. Documentation is typically not available in sufficient detail to
+    allow U-Boot do this this itself..
+
+    An example filename is 'fsp_m.bin'
+
+    See README.x86 for information about x86 binary blobs.
+    """
+    def __init__(self, section, etype, node):
+        Entry_blob.__init__(self, section, etype, node)
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a740c3e03d..b0b942dfdc 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -72,6 +72,7 @@ FILES_DATA            = (b"sorry I'm late\nOh, don't bother apologising, I'm " +
                          b"sorry you're alive\n")
 COMPRESS_DATA         = b'compress xxxxxxxxxxxxxxxxxxxxxx data'
 REFCODE_DATA          = b'refcode'
+FSP_M_DATA            = b'fsp_m'
 
 # The expected size for the device tree in some tests
 EXTRACT_DTB_SIZE = 0x3c9
@@ -147,6 +148,7 @@ class TestFunctional(unittest.TestCase):
         TestFunctional._MakeInputDir('devkeys')
         TestFunctional._MakeInputFile('bmpblk.bin', BMPBLK_DATA)
         TestFunctional._MakeInputFile('refcode.bin', REFCODE_DATA)
+        TestFunctional._MakeInputFile('fsp_m.bin', FSP_M_DATA)
 
         cls._elf_testdir = os.path.join(cls._indir, 'elftest')
         elf_test.BuildElfTestFiles(cls._elf_testdir)
@@ -3329,6 +3331,12 @@ class TestFunctional(unittest.TestCase):
         data = self._DoReadFile('151_x86_rom_ifwi_section.dts')
         self._CheckIfwi(data)
 
+    def testPackFspM(self):
+        """Test that an image with a FSP memory-init binary can be created"""
+        data = self._DoReadFile('152_intel_fsp_m.dts')
+        self.assertEqual(FSP_M_DATA, data[:len(FSP_M_DATA)])
+
+
 
 if __name__ == "__main__":
     unittest.main()
diff --git a/tools/binman/test/152_intel_fsp_m.dts b/tools/binman/test/152_intel_fsp_m.dts
new file mode 100644
index 0000000000..b6010f31c2
--- /dev/null
+++ b/tools/binman/test/152_intel_fsp_m.dts
@@ -0,0 +1,14 @@
+/dts-v1/;
+
+/ {
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	binman {
+		size = <16>;
+
+		intel-fsp-m {
+			filename = "fsp_m.bin";
+		};
+	};
+};
-- 
2.23.0.187.g17f5b7556c-goog



More information about the U-Boot mailing list