Re: [U-Boot] [PATCH v2 4/8] binman: Add support for Powerpc mpc85xx 'bootpg + resetvec' entry

2018-08-28 Thread Bin Meng
On Tue, Aug 28, 2018 at 11:53 AM Jagdish Gediya  wrote:
>
> This entry contains the Powerpc mpc85xx boot page and resetvec

nits: PowerPC

Please fix the title as well

> sections.
>
> Signed-off-by: Jagdish Gediya 
> ---
> Changes for v2:
> - Updated README for new binman entry
> - Added test
>
>  tools/binman/README.entries| 14 +++-
>  .../etype/powerpc_mpc85xx_bootpg_resetvec.py   | 25 
> ++
>  tools/binman/ftest.py  |  8 +++
>  .../test/80_powerpc_mpc85xx_bootpg_resetvec.dts| 16 ++
>  4 files changed, 62 insertions(+), 1 deletion(-)
>  create mode 100644 tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
>  create mode 100644 tools/binman/test/80_powerpc_mpc85xx_bootpg_resetvec.dts
>
> diff --git a/tools/binman/README.entries b/tools/binman/README.entries
> index c6e7b22..99440d6 100644
> --- a/tools/binman/README.entries
> +++ b/tools/binman/README.entries
> @@ -221,6 +221,18 @@ See README.x86 for information about Intel binary blobs.
>
>
>
> +Entry: powerpc-mpc85xx-bootpg-resetvec: Powerpc mpc85xx bootpg + resetvec 
> code for U-Boot

nits: PowerPC, please fix this globally in this patch

> +-
> +
> +Properties / Entry arguments:
> +- filename: Filename of u-boot-br.bin (default 'u-boot-br.bin')
> +
> +This enrty is valid for Powerpc mpc85xx cpus. This entry holds
> +'bootpg + resetvec' code for Powerpc mpc85xx CPUs which needs to be
> +placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'.
> +
> +
> +
>  Entry: section: Entry that contains other entries
>  -
>
> @@ -543,7 +555,7 @@ Properties / Entry arguments:
>  - kernelkey: Name of the kernel key to use (inside keydir)
>  - preamble-flags: Value of the vboot preamble flags (typically 0)
>
> -Chromium OS  signs the read-write firmware and kernel, writing the signature
> +Chromium OS signs the read-write firmware and kernel, writing the signature
>  in this block. This allows U-Boot to verify that the next firmware stage
>  and kernel are genuine.
>
> diff --git a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py 
> b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
> new file mode 100644
> index 000..37cf408
> --- /dev/null
> +++ b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
> @@ -0,0 +1,25 @@
> +# SPDX-License-Identifier: GPL-2.0+
> +# Copyright 2018 NXP
> +#
> +# Entry-type module for the Powerpc mpc85xx bootpg and resetvec code for 
> U-Boot
> +#
> +
> +from entry import Entry
> +from blob import Entry_blob
> +
> +class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob):
> +"""Powerpc mpc85xx bootpg + resetvec code for U-Boot
> +
> +Properties / Entry arguments:
> +- filename: Filename of u-boot-br.bin (default 'u-boot-br.bin')
> +
> +This enrty is valid for Powerpc mpc85xx cpus. This entry holds
> +'bootpg + resetvec' code for Powerpc mpc85xx CPUs which needs to be
> +placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'.
> +"""
> +
> +def __init__(self, section, etype, node):
> +Entry_blob.__init__(self, section, etype, node)
> +
> +def GetDefaultFilename(self):
> +return 'u-boot-br.bin'
> diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
> index a8456c2..7a6a5ae 100644
> --- a/tools/binman/ftest.py
> +++ b/tools/binman/ftest.py
> @@ -39,6 +39,7 @@ U_BOOT_SPL_DTB_DATA   = 'spldtb'
>  U_BOOT_TPL_DTB_DATA   = 'tpldtb'
>  X86_START16_DATA  = 'start16'
>  X86_START16_SPL_DATA  = 'start16spl'
> +PPC_MPC85XX_BR_DATA   = 'ppcmpc85xxbr'
>  U_BOOT_NODTB_DATA = 'nodtb with microcode pointer somewhere in here'
>  U_BOOT_SPL_NODTB_DATA = 'splnodtb with microcode pointer somewhere in here'
>  FSP_DATA  = 'fsp'
> @@ -90,6 +91,7 @@ class TestFunctional(unittest.TestCase):
>  TestFunctional._MakeInputFile('vga.bin', VGA_DATA)
>  self._ResetDtbs()
>  TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', 
> X86_START16_DATA)
> +TestFunctional._MakeInputFile('u-boot-br.bin', PPC_MPC85XX_BR_DATA)
>  TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
>X86_START16_SPL_DATA)
>  TestFunctional._MakeInputFile('u-boot-nodtb.bin', U_BOOT_NODTB_DATA)
> @@ -756,6 +758,12 @@ class TestFunctional(unittest.TestCase):
>  data = self._DoReadFile('33_x86-start16.dts')
>  self.assertEqual(X86_START16_DATA, data[:len(X86_START16_DATA)])
>
> +def testPackPowerpcMpc85xxBootpgResetvec(self):
> +"""Test that an image with powerpc-mpc85xx-bootpg-resetvec can be
> +created"""
> +data = self._DoReadFile('80_powerpc_mpc85xx_bootpg_resetvec.dts')
> +self.assertEqual(PPC_MPC85XX_BR_DATA, 
> data[:len(PPC_MPC85XX_BR_DATA)])
> +
>  def _RunMicrocodeTest(self, dts_fname, 

[U-Boot] [PATCH v2 4/8] binman: Add support for Powerpc mpc85xx 'bootpg + resetvec' entry

2018-08-27 Thread Jagdish Gediya
This entry contains the Powerpc mpc85xx boot page and resetvec
sections.

Signed-off-by: Jagdish Gediya 
---
Changes for v2:
- Updated README for new binman entry
- Added test

 tools/binman/README.entries| 14 +++-
 .../etype/powerpc_mpc85xx_bootpg_resetvec.py   | 25 ++
 tools/binman/ftest.py  |  8 +++
 .../test/80_powerpc_mpc85xx_bootpg_resetvec.dts| 16 ++
 4 files changed, 62 insertions(+), 1 deletion(-)
 create mode 100644 tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
 create mode 100644 tools/binman/test/80_powerpc_mpc85xx_bootpg_resetvec.dts

diff --git a/tools/binman/README.entries b/tools/binman/README.entries
index c6e7b22..99440d6 100644
--- a/tools/binman/README.entries
+++ b/tools/binman/README.entries
@@ -221,6 +221,18 @@ See README.x86 for information about Intel binary blobs.
 
 
 
+Entry: powerpc-mpc85xx-bootpg-resetvec: Powerpc mpc85xx bootpg + resetvec code 
for U-Boot
+-
+
+Properties / Entry arguments:
+- filename: Filename of u-boot-br.bin (default 'u-boot-br.bin')
+
+This enrty is valid for Powerpc mpc85xx cpus. This entry holds
+'bootpg + resetvec' code for Powerpc mpc85xx CPUs which needs to be
+placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'.
+
+
+
 Entry: section: Entry that contains other entries
 -
 
@@ -543,7 +555,7 @@ Properties / Entry arguments:
 - kernelkey: Name of the kernel key to use (inside keydir)
 - preamble-flags: Value of the vboot preamble flags (typically 0)
 
-Chromium OS  signs the read-write firmware and kernel, writing the signature
+Chromium OS signs the read-write firmware and kernel, writing the signature
 in this block. This allows U-Boot to verify that the next firmware stage
 and kernel are genuine.
 
diff --git a/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py 
b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
new file mode 100644
index 000..37cf408
--- /dev/null
+++ b/tools/binman/etype/powerpc_mpc85xx_bootpg_resetvec.py
@@ -0,0 +1,25 @@
+# SPDX-License-Identifier: GPL-2.0+
+# Copyright 2018 NXP
+#
+# Entry-type module for the Powerpc mpc85xx bootpg and resetvec code for U-Boot
+#
+
+from entry import Entry
+from blob import Entry_blob
+
+class Entry_powerpc_mpc85xx_bootpg_resetvec(Entry_blob):
+"""Powerpc mpc85xx bootpg + resetvec code for U-Boot
+
+Properties / Entry arguments:
+- filename: Filename of u-boot-br.bin (default 'u-boot-br.bin')
+
+This enrty is valid for Powerpc mpc85xx cpus. This entry holds
+'bootpg + resetvec' code for Powerpc mpc85xx CPUs which needs to be
+placed at offset 'RESET_VECTOR_ADDRESS - 0xffc'.
+"""
+
+def __init__(self, section, etype, node):
+Entry_blob.__init__(self, section, etype, node)
+
+def GetDefaultFilename(self):
+return 'u-boot-br.bin'
diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py
index a8456c2..7a6a5ae 100644
--- a/tools/binman/ftest.py
+++ b/tools/binman/ftest.py
@@ -39,6 +39,7 @@ U_BOOT_SPL_DTB_DATA   = 'spldtb'
 U_BOOT_TPL_DTB_DATA   = 'tpldtb'
 X86_START16_DATA  = 'start16'
 X86_START16_SPL_DATA  = 'start16spl'
+PPC_MPC85XX_BR_DATA   = 'ppcmpc85xxbr'
 U_BOOT_NODTB_DATA = 'nodtb with microcode pointer somewhere in here'
 U_BOOT_SPL_NODTB_DATA = 'splnodtb with microcode pointer somewhere in here'
 FSP_DATA  = 'fsp'
@@ -90,6 +91,7 @@ class TestFunctional(unittest.TestCase):
 TestFunctional._MakeInputFile('vga.bin', VGA_DATA)
 self._ResetDtbs()
 TestFunctional._MakeInputFile('u-boot-x86-16bit.bin', X86_START16_DATA)
+TestFunctional._MakeInputFile('u-boot-br.bin', PPC_MPC85XX_BR_DATA)
 TestFunctional._MakeInputFile('spl/u-boot-x86-16bit-spl.bin',
   X86_START16_SPL_DATA)
 TestFunctional._MakeInputFile('u-boot-nodtb.bin', U_BOOT_NODTB_DATA)
@@ -756,6 +758,12 @@ class TestFunctional(unittest.TestCase):
 data = self._DoReadFile('33_x86-start16.dts')
 self.assertEqual(X86_START16_DATA, data[:len(X86_START16_DATA)])
 
+def testPackPowerpcMpc85xxBootpgResetvec(self):
+"""Test that an image with powerpc-mpc85xx-bootpg-resetvec can be
+created"""
+data = self._DoReadFile('80_powerpc_mpc85xx_bootpg_resetvec.dts')
+self.assertEqual(PPC_MPC85XX_BR_DATA, data[:len(PPC_MPC85XX_BR_DATA)])
+
 def _RunMicrocodeTest(self, dts_fname, nodtb_data, ucode_second=False):
 """Handle running a test for insertion of microcode
 
diff --git a/tools/binman/test/80_powerpc_mpc85xx_bootpg_resetvec.dts 
b/tools/binman/test/80_powerpc_mpc85xx_bootpg_resetvec.dts
new file mode 100644
index 000..8f4b16c
--- /dev/null
+++ b/tools/binman/test/80_powerpc_mpc85xx_bootpg_resetvec.dts
@@ -0,0 +1,16 @@
+//