@@ -7,8 +7,8 @@ controller virtual device.
7
7
8
8
```` text
9
9
usage: otptool.py [-h] [-j HJSON] [-m VMEM] [-l SV] [-o C] [-r RAW]
10
- [-k {auto,otp,fuz}] [-e BITS] [-c INT ] [-i INT] [-w] [-n ]
11
- [-s] [-E] [-D] [-U] [--empty PARTITION]
10
+ [-k {auto,otp,fuz}] [-e BITS] [-C CONFIG ] [-c INT] [-i INT ]
11
+ [-w] [-n] [- s] [-E] [-D] [-U] [--empty PARTITION]
12
12
[--clear-bit CLEAR_BIT] [--set-bit SET_BIT]
13
13
[--toggle-bit TOGGLE_BIT] [-L | -P | -R] [-v] [-d]
14
14
@@ -30,6 +30,8 @@ Parameters:
30
30
-k {auto,otp,fuz}, --kind {auto,otp,fuz}
31
31
kind of content in VMEM input file, default: auto
32
32
-e BITS, --ecc BITS ECC bit count
33
+ -C CONFIG, --config CONFIG
34
+ read Present constants from QEMU config file
33
35
-c INT, --constant INT
34
36
finalization constant for Present scrambler
35
37
-i INT, --iv INT initialization vector for Present scrambler
@@ -87,12 +89,18 @@ Fuse RAW images only use the v1 type.
87
89
` -D ` to verify partition digests, and stored in the optional QEMU OTP RAW image file for use by
88
90
the virtual OTP controller when used along with the ` -r ` option.
89
91
90
- * ` -c ` specify the register file, which is only useful to decode OTP content (see ` -s ` option).
91
- This option is required when ` -D ` Present digest checking is used.
92
+ * ` -C ` specify a QEMU [ configuration file] ( otcfg.md ) from which to read the Present constants that
93
+ are required for digest computation. It is a convenience switch to replace both ` -i ` and options.
94
+ See [ ` cfggen.py ` ] ( cfggen.md ) tool to generate such a file.
95
+
96
+ * ` -c ` specify the initialization constant for the Present scrambler used for partition digests.
97
+ This option is required when ` -D ` Present digest checking is used. See also ` -i ` option switch.
98
+ Override option ` -C ` if any.
92
99
93
100
* ` -D ` performs a partition digest checks for all partitions with a defined digest. The Present
94
101
constant should be defined to perform digest verification. They can be specified with the ` -c ` and
95
- ` -i ` options switches, or when using a QEMU OTP RAW v2 file that stores these constants.
102
+ ` -i ` options switches, or when using a QEMU OTP RAW v2 file that stores these constants, or when
103
+ a QEMU configuration file is specified with the ` -C ` option.
96
104
97
105
* ` -d ` only useful to debug the script, reports any Python traceback to the standard error stream.
98
106
@@ -101,6 +109,12 @@ Fuse RAW images only use the v1 type.
101
109
* ` -e ` specify how many bits are used in the VMEM file to store ECC information. Note that ECC
102
110
information is not stored in the QEMU RAW file for now.
103
111
112
+ * ` -i ` specify the initialization vector for the Present scrambler used for partition digests.
113
+ This value is "usually" found within the ` hw/ip/otp_ctrl/rtl/otp_ctrl_part_pkg.sv ` OT file,
114
+ from the last entry of ` RndCnstDigestIV ` array, _ i.e._ item 0. It is used along with option
115
+ ` -D ` to verify partition digests, and stored in the optional output OTP image file for use by
116
+ the virtual OTP controller when used along with the ` -o ` option. Override option ` -C ` if any.
117
+
104
118
* ` -j ` specify the path to the HJSON OTP controller map file, usually stored in OT
105
119
` hw/ip/otp_ctrl/data/otp_ctrl_mmap.hjson ` . This file is required with many options when the OTP
106
120
image file needs to be interpreted, such as digest verification, content dump, C file generation,
@@ -117,12 +131,6 @@ Fuse RAW images only use the v1 type.
117
131
states. This option is not required to generate a RAW image file, but required when the ` -L `
118
132
option switch is used.
119
133
120
- * ` -i ` specify the initialization vector for the Present scrambler used for partition digests.
121
- This value is "usually" found within the ` hw/ip/otp_ctrl/rtl/otp_ctrl_part_pkg.sv ` OT file,
122
- from the last entry of ` RndCnstDigestIV ` array, _ i.e._ item 0. It is used along with option
123
- ` -D ` to verify partition digests, and stored in the optional output OTP image file for use by
124
- the virtual OTP controller when used along with the ` -o ` option.
125
-
126
134
* ` -m ` specify the input VMEM file that contains the OTP fuse content. See also the ` -k ` option.
127
135
128
136
* ` -n ` tell the script not to attempt to decode the content of encoded fields, such as the hardened
@@ -170,8 +178,8 @@ Fuse RAW images only use the v1 type.
170
178
171
179
#### Note
172
180
173
- Earlgrey OTP virtual device has not been updated to support Present scrambler, so neither ` -C ` nor
174
- ` -I ` option should be used to generate an Earlgrey-compatible RAW image.
181
+ Earlgrey OTP virtual device has not been updated to support Present scrambler, so neither ` -c ` nor
182
+ ` -i ` option should be used to generate an Earlgrey-compatible RAW image.
175
183
176
184
### Bit position specifier [ #bit-syntax]
177
185
@@ -206,6 +214,12 @@ scripts/opentitan/otptool.py -m img_rma.24.vmem -r otp.raw \
206
214
-i 0x0123456789abcdef -c 0x00112233445566778899aabbccddeeff
207
215
````
208
216
217
+ Generate a QEMU RAW v2 image for the virtual OTP controller, here with an RMA OTP configuration,
218
+ load Present constants from a QEMU configuration file.
219
+ ```` sh
220
+ scripts/opentitan/otptool.py -m img_rma.24.vmem -r otp.raw -i ot.cfg
221
+ ````
222
+
209
223
Decode the content of an OTP VMEM file:
210
224
```` sh
211
225
scripts/opentitan/otptool.py -m img_rma.24.vmem -j otp_ctrl_mmap.hjson -s
0 commit comments