The software revision field in the combined board config binary header was hardcoded to 1, preventing independent control from SBL SWREV configured via ti-secure-rom's sw-rev property.
Add support for the optional 'sw-rev' DTS property in ti_board_config nodes, which sets the SWREV byte in the header. Defaults to 1 for backward compatibility. Signed-off-by: Shiva Tripathi <[email protected]> --- tools/binman/etype/ti_board_config.py | 4 ++- tools/binman/ftest.py | 5 ++++ .../vendor/ti_board_cfg_combined_sw_rev.dts | 26 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 tools/binman/test/vendor/ti_board_cfg_combined_sw_rev.dts diff --git a/tools/binman/etype/ti_board_config.py b/tools/binman/etype/ti_board_config.py index 7c6773ac7bc..3f2135f8f33 100644 --- a/tools/binman/etype/ti_board_config.py +++ b/tools/binman/etype/ti_board_config.py @@ -38,6 +38,8 @@ class Entry_ti_board_config(Entry_section): - config-file: File containing board configuration data in YAML - schema-file: File containing board configuration YAML schema against which the config file is validated + - sw-rev: Software revision for the board config binary header + (optional, default 1) Output files: - board config binary: File containing board configuration binary @@ -80,11 +82,11 @@ class Entry_ti_board_config(Entry_section): self._fmt = '<HHHBB' self._index = 0 self._binary_offset = 0 - self._sw_rev = 1 self._devgrp = 0 def ReadNode(self): super().ReadNode() + self._sw_rev = fdt_util.GetInt(self._node, 'sw-rev', 1) self._config = fdt_util.GetString(self._node, 'config') self._schema = fdt_util.GetString(self._node, 'schema') # Depending on whether config file is present in node, we determine diff --git a/tools/binman/ftest.py b/tools/binman/ftest.py index bf98b268ac1..ea2fa6eb83a 100644 --- a/tools/binman/ftest.py +++ b/tools/binman/ftest.py @@ -7212,6 +7212,11 @@ fdt fdtmap Extract the devicetree blob from the fdtmap configlen_noheader = TI_BOARD_CONFIG_DATA * 4 self.assertGreater(data, configlen_noheader) + def testTIBoardConfigCombinedSwRev(self): + """Test that sw-rev property is honoured in combined board config""" + data = self._DoReadFile('vendor/ti_board_cfg_combined_sw_rev.dts') + self.assertEqual(2, data[1]) + def testTIBoardConfigNoDataType(self): """Test that error is thrown when data type is not supported""" with self.assertRaises(ValueError) as e: diff --git a/tools/binman/test/vendor/ti_board_cfg_combined_sw_rev.dts b/tools/binman/test/vendor/ti_board_cfg_combined_sw_rev.dts new file mode 100644 index 00000000000..b998d22c2da --- /dev/null +++ b/tools/binman/test/vendor/ti_board_cfg_combined_sw_rev.dts @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: GPL-2.0+ +/dts-v1/; + +/ { + binman { + ti-board-config { + sw-rev = <2>; + board-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + sec-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + rm-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + pm-cfg { + config = "yaml/config.yaml"; + schema = "yaml/schema.yaml"; + }; + }; + }; +}; -- 2.34.1

