diff mbox series

[U-Boot,v2,19/37] binman: Don't assume there is an ME region

Message ID 20190708191856.138863-20-sjg@chromium.org
State Accepted
Commit fa1c93783274dd27da9a88d9d1bf3933f5631b12
Delegated to: Simon Glass
Headers show
Series binman: Add CBFS support | expand

Commit Message

Simon Glass July 8, 2019, 7:18 p.m. UTC
At present having a descriptor means that there is an ME (Intel
Management Engine) entry as well. The descriptor provides the ME location
and assumes that it is present.

For some SoCs this is not true. Before providing the location of a
potentially non-existent entry, check if it is present.

Update the comment in the ME entry also.

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

Changes in v2: None

 tools/binman/README.entries            |  2 ++
 tools/binman/entry.py                  |  9 +++++++++
 tools/binman/etype/intel_descriptor.py | 10 +++++++---
 tools/binman/etype/intel_me.py         |  2 ++
 4 files changed, 20 insertions(+), 3 deletions(-)

Comments

Simon Glass July 18, 2019, 1:59 a.m. UTC | #1
At present having a descriptor means that there is an ME (Intel
Management Engine) entry as well. The descriptor provides the ME location
and assumes that it is present.

For some SoCs this is not true. Before providing the location of a
potentially non-existent entry, check if it is present.

Update the comment in the ME entry also.

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

Changes in v2: None

 tools/binman/README.entries            |  2 ++
 tools/binman/entry.py                  |  9 +++++++++
 tools/binman/etype/intel_descriptor.py | 10 +++++++---
 tools/binman/etype/intel_me.py         |  2 ++
 4 files changed, 20 insertions(+), 3 deletions(-)

Applied to u-boot-dm, thanks!
diff mbox series

Patch

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index 357946d6305..702fc9fda08 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -206,6 +206,8 @@  does not directly execute code in the ME binary.
 
 A typical filename is 'me.bin'.
 
+The position of this entry is generally set by the intel-descriptor entry.
+
 See README.x86 for information about x86 binary blobs.
 
 
diff --git a/tools/binman/entry.py b/tools/binman/entry.py
index e8d0adec1e9..7ead997e0fd 100644
--- a/tools/binman/entry.py
+++ b/tools/binman/entry.py
@@ -544,3 +544,12 @@  features to produce new behaviours.
             # the data grows. This should not fail, but check it to be sure.
             if not self.ObtainContents():
                 self.Raise('Cannot obtain contents when expanding entry')
+
+    def HasSibling(self, name):
+        """Check if there is a sibling of a given name
+
+        Returns:
+            True if there is an entry with this name in the the same section,
+                else False
+        """
+        return name in self.section.GetEntries()
diff --git a/tools/binman/etype/intel_descriptor.py b/tools/binman/etype/intel_descriptor.py
index 661063457ed..65ba2391e69 100644
--- a/tools/binman/etype/intel_descriptor.py
+++ b/tools/binman/etype/intel_descriptor.py
@@ -60,6 +60,10 @@  class Entry_intel_descriptor(Entry_blob):
         for i in range(MAX_REGIONS):
             self._regions.append(Region(self.data, frba, i))
 
-        # Set the offset for ME only, for now, since the others are not used
-        return {'intel-me': [self._regions[REGION_ME].base,
-                             self._regions[REGION_ME].size]}
+        # Set the offset for ME (Management Engine) only, for now, since the
+        # others are not used
+        info = {}
+        if self.HasSibling('intel-me'):
+            info['intel-me'] = [self._regions[REGION_ME].base,
+                                self._regions[REGION_ME].size]
+        return info
diff --git a/tools/binman/etype/intel_me.py b/tools/binman/etype/intel_me.py
index 247c5b33866..c932ec52225 100644
--- a/tools/binman/etype/intel_me.py
+++ b/tools/binman/etype/intel_me.py
@@ -22,6 +22,8 @@  class Entry_intel_me(Entry_blob):
 
     A typical filename is 'me.bin'.
 
+    The position of this entry is generally set by the intel-descriptor entry.
+
     See README.x86 for information about x86 binary blobs.
     """
     def __init__(self, section, etype, node):