Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion python/qemu/ot/otp/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ def load_secrets(self, secrets: dict[str, Any]) -> bool:
part_size = 0
part_inv_bytes: list[bytes] = []
part_inv_sum = 0
# there is not a 'buffered' boolean in the HJSON file
# the variant is either "unbuffered", "buffered" or "lifecyle";
# however lifeycle partition is actually a buffered partition.
part_buffered = part.get('variant', '').lower() != 'unbuffered'
for item in part['items']:
size = item['size']
name = item['name']
Expand All @@ -183,10 +187,16 @@ def load_secrets(self, secrets: dict[str, Any]) -> bool:
if part_size != part['size']:
raise ValueError(f'Invalid byte count for part {part_name}: '
f"{part_size} != {part['size']}")
if part_inv_sum:
# invalid default values are defined in RTL and HJSON for all
# partitions, whereas they can only be used for buffered partitions;
# discard values for non-buffered partitions
if part_buffered and part_inv_sum:
part_inv_str = hexlify(b''.join(part_inv_bytes)).decode()
self._inv_defaults.append(part_inv_str)
else:
if part_inv_sum:
self._log.debug('Discard inv default values for unbuffered '
'part %s', part_name)
self._inv_defaults.append(None)
total_size += part_size
if total_size != otp_size:
Expand Down
4 changes: 2 additions & 2 deletions scripts/opentitan/autoreg.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,8 @@ def _parse_parameters(self, params: list[dict[str, Any]]) \
-> dict[str, Union[int, bool]]:
parameters: dict[str, Union[int, bool]] = {}
converters = {
'int': int,
'int unsigned': int,
'int': HexInt.parse,
'int unsigned': HexInt.parse,
'bit': bool
}
for param in params:
Expand Down
Loading