blob: c8ef7ac02eea80c5f519a1469944198e45357a70 [file] [log] [blame]
Harrison Mutai19dc4f92024-05-10 16:54:29 +00001Transfer List Compiler
2======================
3
4The Transfer List Compiler (tlc) is a host tool used by TF-A to generate transfer
5lists compliant with the v0.9 of the `Firmware Handoff specification`_. It enables
6developers to statically generate transfer list blobs containing any number of
7transfer entries.
8
9Getting Started
10~~~~~~~~~~~~~~~
11
12``tlc`` is installed by default with TF-A's poetry environment. All of it's
13dependencies are listed in `tools/tlc/pyproject.toml`_.
14
15To install ``tlc`` seperately, run the following command:
16
17.. code::
18
19 make -C tools/tlc install
20
21Creating a Transfer List
22~~~~~~~~~~~~~~~~~~~~~~~~
23
24To create an empty TL, you can use the ``create`` command.
25
26.. code::
27
28 tlc create tl.bin
29
30This commands generates a binary blob representing an empty TL, shown in the
31hexdump below.
32
33.. code::
34
35 $ hexdump tl.bin | head
36 0000000 b10b 4a0f 01a6 0318 0018 0000 1000 0000
37 0000010 0001 0000 0000 0000
38
39A common use-case this tool supports is the addition of TE's via the option
40``--entry``. This takes as input the tag ID and path to a binary blob to be
41included in the transfer list. The snippet below shows how to include an FDT in
42the TL.
43
44.. code::
45
46 tlc create --entry 1 fdt.dtb tl.bin
47
48Alternatively, addition of a device tree is supported through the option
49``--fdt``. This has the same effect as passing the device tree and it's tag ID
50through the ``--entry`` option.
51
52.. code::
53
54 tlc create --fdt fdt.dtb tl.bin
55
56.. note::
57
58 ``tlc`` makes no effort to verify the contents of a binary blob against the
59 provided tag ID. It only checks that the tags provided as input are within
60 range and that there is sufficient memory to include their TE's.
61
62Printing the contents of a TL
63~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64
65Support is provided for dumping the contents of a TL via the ``info`` command.
66This prints the header of the TL and all included TE's.
67
68.. code::
69
70 $ tlc info tl.bin
71 signature 0x4a0fb10b
72 checksum 0xe1
73 version 0x1
74 hdr_size 0x18
75 alignment 0x3
76 size 0x2a6f
77 total_size 0x4e20
78 flags 0x1
79 ----
80 id 0x1
81 data_size 0x2a47
82 hdr_size 0x8
83 offset 0x18
84 ----
85 id 0x0
86 data_size 0x0
87 hdr_size 0x8
88 offset 0x2a68
89
90The example above shows the dump produced by ``tlc`` for a 20Kb TL containing a
91device tree (tag_id=1) and a NULL entry (tag_id=0).
92
93Modifying the contents of an existing TL
94~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
95
96`tlc` supports removal of one or more entries from a TL through the ``remove``
97command. It takes as argument the filename, and one or more tag ID's, passed
98through the ``--tags`` option. It produces a valid TL blob without those
99entries.
100
101
102For example, using the same blob as in the section above, we can remove the FDT
103TE with the command.
104
105.. code::
106
107 $ tlc remove --tags 1 tl.bin
108
109Using the ``info`` command, shows the the TE has been remove:
110
111.. code::
112
113 $ tlc info tl.bin
114
115 signature 0x4a0fb10b
116 checksum 0x38
117 version 0x1
118 hdr_size 0x18
119 alignment 0x3
120 size 0x20
121 total_size 0x4e20
122 flags 0x1
123 ----
124 id 0x0
125 data_size 0x0
126 hdr_size 0x8
127 offset 0x18
128
129Note that more than one entry can be removed at a time. The ``--tags`` option
130accepts multiple tag ID's.
131
132Conversely, TE's can be added to an existing TL. This is achieved through the
133`add` command.
134
135.. code::
136
137 $ tlc add --entry 1 fdt.dtb tl.bin
138
139
140The result of this modification is shown below:
141
142.. code::
143
144 $ tlc info tl.bin
145
146 signature 0x4a0fb10b
147 checksum 0xe1
148 version 0x1
149 hdr_size 0x18
150 alignment 0x3
151 size 0x2a6f
152 total_size 0x4e20
153 flags 0x1
154 ----
155 id 0x0
156 data_size 0x0
157 hdr_size 0x8
158 offset 0x18
159 ----
160 id 0x1
161 data_size 0x2a47
162 hdr_size 0x8
163 offset 0x20
164
165Unpacking a Transfer List
166~~~~~~~~~~~~~~~~~~~~~~~~~
167
168Given a transfer list, ``tlc`` also provides a mechanism for extracting TE data.
169Running the command ``unpack``, yields binary files containing data from all the TE's.
170
171.. code::
172
173 $ tlc create --size 20000 --fdt build/fvp/debug/fdts/fvp-base-gicv3-psci.dtb tl.bin
174 $ tlc unpack tl.bin
175 $ file te_1.bin
176 te_1.bin: Device Tree Blob version 17, size=10823, boot CPU=0, string block size=851, DT structure block size=9900
177
178Validate a Transfer List
179~~~~~~~~~~~~~~~~~~~~~~~~
180
181``tlc validate`` provides a quick and simple mechanism for checking wether the TL
182is compliant with version of the specification supported by the tool. It
183performs the following checks:
184
185#. Validates the signature.
186#. Ensures that the specified version is greater than or equal to the tool’s current version.
187#. Verifies alignment criteria for all TE’s.
188
189--------------
190
191*Copyright (c) 2024, Arm Limited. All rights reserved.*
192
193.. _Firmware Handoff specification: https://github.com/FirmwareHandoff/firmware_handoff/
194.. _tools/tlc/pyproject.toml: https://review.trustedfirmware.org/plugins/gitiles/TF-A/trusted-firmware-a/+/refs/heads/master/tools/tlc/pyproject.toml