diff mbox series

[U-Boot,3/8,RESEND] binman: Add a new "start-pos" property in section class

Message ID 1534875507-2531-4-git-send-email-jagdish.gediya@nxp.com
State Superseded
Delegated to: York Sun
Headers show
Series Device Tree support for PowerPC in u-boot | expand

Commit Message

Jagdish Gediya Aug. 21, 2018, 6:18 p.m. UTC
currently binman calculates '_skip_at_start' based on 'end-at-4gb'
property and it is used for x86 images.

for powerpc architecture also, '_skip_at_start' should be set because
memory address 0xeff40000 or 0xfff40000 is the first entry offset.
'end-at-4gb' property is not applicable for 0xeff40000 first entry
offset.

add new property start-pos' in section class so that
'_skip_at_start' can be calculated either based on 'end-at-4gb'
or based on 'start-pos'

Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com>
---
 tools/binman/bsection.py | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

Comments

Bin Meng Aug. 21, 2018, 11:58 a.m. UTC | #1
On Wed, Aug 22, 2018 at 2:06 AM, Jagdish Gediya <jagdish.gediya@nxp.com> wrote:
> currently binman calculates '_skip_at_start' based on 'end-at-4gb'

nits: Currently

> property and it is used for x86 images.
>
> for powerpc architecture also, '_skip_at_start' should be set because

powerpc -> PowerPC Book-E, or maybe just e500?

> memory address 0xeff40000 or 0xfff40000 is the first entry offset.

I think you need describe in more details about what these addresses
are, for example I believe they are the flash address where you want
to store the u-boot image in the flash?

> 'end-at-4gb' property is not applicable for 0xeff40000 first entry
> offset.
>
> add new property start-pos' in section class so that

nits: Add a property 'start-pos' in Section

> '_skip_at_start' can be calculated either based on 'end-at-4gb'
> or based on 'start-pos'
>
> Signed-off-by: Jagdish Gediya <jagdish.gediya@nxp.com>
> ---
>  tools/binman/bsection.py | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
> index a0bd1b6..71f276d 100644
> --- a/tools/binman/bsection.py
> +++ b/tools/binman/bsection.py
> @@ -40,6 +40,10 @@ class Section(object):
>              used for x86 images, which want to use offsets such that a memory
>              address (like 0xff800000) is the first entry offset. This causes
>              _skip_at_start to be set to the starting memory address.
> +        _start_pos: For powerpc, memory address 0xeff40000 or 0xfff40000 is the

powerpc -> PowerPC Book-E or e500?

Also please describe some details about these addresses.

> +            first entry offset. _end_4gb is not re-usable if first entry offset
> +            is 0xeff40000. _start_pos causes _skip_at_start to be set to the
> +            starting memory address.
>          _name_prefix: Prefix to add to the name of all entries within this
>              section
>          _entries: OrderedDict() of entries
> @@ -61,6 +65,7 @@ class Section(object):
>          self._sort = False
>          self._skip_at_start = 0
>          self._end_4gb = False
> +        self._start_pos = 0
>          self._name_prefix = ''
>          self._entries = OrderedDict()
>          if not test:
> @@ -79,10 +84,14 @@ class Section(object):
>          self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0)
>          self._sort = fdt_util.GetBool(self._node, 'sort-by-offset')
>          self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
> -        if self._end_4gb and not self._size:
> -            self._Raise("Section size must be provided when using end-at-4gb")
> +        self._start_pos = fdt_util.GetInt(self._node, 'start-pos', 0)
> +        if (self._end_4gb or self._start_pos) and not self._size:
> +            self._Raise("Section size must be provided when using end-at-4gb or "
> +                    "start-pos")
>          if self._end_4gb:
>              self._skip_at_start = 0x100000000 - self._size
> +        if self._start_pos:
> +            self._skip_at_start = self._start_pos

So the _start_pos takes precedence over the _end_4gb, please document
this. Or if you don't want the precedence, use elif

>          self._name_prefix = fdt_util.GetString(self._node, 'name-prefix')
>
>      def _ReadEntries(self):
> --

Regards,
Bin
diff mbox series

Patch

diff --git a/tools/binman/bsection.py b/tools/binman/bsection.py
index a0bd1b6..71f276d 100644
--- a/tools/binman/bsection.py
+++ b/tools/binman/bsection.py
@@ -40,6 +40,10 @@  class Section(object):
             used for x86 images, which want to use offsets such that a memory
             address (like 0xff800000) is the first entry offset. This causes
             _skip_at_start to be set to the starting memory address.
+        _start_pos: For powerpc, memory address 0xeff40000 or 0xfff40000 is the
+            first entry offset. _end_4gb is not re-usable if first entry offset
+            is 0xeff40000. _start_pos causes _skip_at_start to be set to the
+            starting memory address.
         _name_prefix: Prefix to add to the name of all entries within this
             section
         _entries: OrderedDict() of entries
@@ -61,6 +65,7 @@  class Section(object):
         self._sort = False
         self._skip_at_start = 0
         self._end_4gb = False
+        self._start_pos = 0
         self._name_prefix = ''
         self._entries = OrderedDict()
         if not test:
@@ -79,10 +84,14 @@  class Section(object):
         self._pad_byte = fdt_util.GetInt(self._node, 'pad-byte', 0)
         self._sort = fdt_util.GetBool(self._node, 'sort-by-offset')
         self._end_4gb = fdt_util.GetBool(self._node, 'end-at-4gb')
-        if self._end_4gb and not self._size:
-            self._Raise("Section size must be provided when using end-at-4gb")
+        self._start_pos = fdt_util.GetInt(self._node, 'start-pos', 0)
+        if (self._end_4gb or self._start_pos) and not self._size:
+            self._Raise("Section size must be provided when using end-at-4gb or "
+                    "start-pos")
         if self._end_4gb:
             self._skip_at_start = 0x100000000 - self._size
+        if self._start_pos:
+            self._skip_at_start = self._start_pos
         self._name_prefix = fdt_util.GetString(self._node, 'name-prefix')
 
     def _ReadEntries(self):