Skip to content

Commit ac1955c

Browse files
committed
[dt,otp] Rename misleadingly name field and its documentation
The documentation was probably copy-paste: the digest is not actually an OTP address but a CSR. Rename the field to make it clearer. Signed-off-by: Amaury Pouly <[email protected]>
1 parent e8fccdb commit ac1955c

File tree

5 files changed

+19
-15
lines changed

5 files changed

+19
-15
lines changed

hw/ip_templates/otp_ctrl/util/dt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class OtpCtrlExt(Extension):
5252

5353
OTP_PARTITION_INFO_STRUCT_START_ADDR_FIELD_NAME = Name(["start", "addr"])
5454
OTP_PARTITION_INFO_STRUCT_SIZE_FIELD_NAME = Name(["size"])
55-
OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME = Name(["digest", "addr"])
55+
OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME = Name(["digest", "reg", "offset"])
5656
OTP_PARTITION_INFO_STRUCT_ALIGN_MASK_FIELD_NAME = Name(["align", "mask"])
5757
OTP_PARTITION_INFO_STRUCT_NAME = Name.from_snake_case("dt_otp_partition_info")
5858

@@ -82,7 +82,8 @@ def __init__(self, ip_helper: IpHelper):
8282
self._otp_partition_info_struct.add_field(
8383
name = self.OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME,
8484
field_type = ScalarType("uint32_t"),
85-
docstring = "The absolute OTP address at which this partition's digest starts",
85+
docstring = "The OTP digest CSR (where the digest is buffered) offset for " +
86+
"this partition.",
8687
)
8788
self._otp_partition_info_struct.add_field(
8889
name = self.OTP_PARTITION_INFO_STRUCT_ALIGN_MASK_FIELD_NAME,

hw/top_darjeeling/ip_autogen/otp_ctrl/util/dt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class OtpCtrlExt(Extension):
5252

5353
OTP_PARTITION_INFO_STRUCT_START_ADDR_FIELD_NAME = Name(["start", "addr"])
5454
OTP_PARTITION_INFO_STRUCT_SIZE_FIELD_NAME = Name(["size"])
55-
OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME = Name(["digest", "addr"])
55+
OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME = Name(["digest", "reg", "offset"])
5656
OTP_PARTITION_INFO_STRUCT_ALIGN_MASK_FIELD_NAME = Name(["align", "mask"])
5757
OTP_PARTITION_INFO_STRUCT_NAME = Name.from_snake_case("dt_otp_partition_info")
5858

@@ -82,7 +82,8 @@ def __init__(self, ip_helper: IpHelper):
8282
self._otp_partition_info_struct.add_field(
8383
name = self.OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME,
8484
field_type = ScalarType("uint32_t"),
85-
docstring = "The absolute OTP address at which this partition's digest starts",
85+
docstring = "The OTP digest CSR (where the digest is buffered) offset for " +
86+
"this partition.",
8687
)
8788
self._otp_partition_info_struct.add_field(
8889
name = self.OTP_PARTITION_INFO_STRUCT_ALIGN_MASK_FIELD_NAME,

hw/top_earlgrey/ip_autogen/otp_ctrl/util/dt.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class OtpCtrlExt(Extension):
5252

5353
OTP_PARTITION_INFO_STRUCT_START_ADDR_FIELD_NAME = Name(["start", "addr"])
5454
OTP_PARTITION_INFO_STRUCT_SIZE_FIELD_NAME = Name(["size"])
55-
OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME = Name(["digest", "addr"])
55+
OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME = Name(["digest", "reg", "offset"])
5656
OTP_PARTITION_INFO_STRUCT_ALIGN_MASK_FIELD_NAME = Name(["align", "mask"])
5757
OTP_PARTITION_INFO_STRUCT_NAME = Name.from_snake_case("dt_otp_partition_info")
5858

@@ -82,7 +82,8 @@ def __init__(self, ip_helper: IpHelper):
8282
self._otp_partition_info_struct.add_field(
8383
name = self.OTP_PARTITION_INFO_STRUCT_DIGEST_ADDR_FIELD_NAME,
8484
field_type = ScalarType("uint32_t"),
85-
docstring = "The absolute OTP address at which this partition's digest starts",
85+
docstring = "The OTP digest CSR (where the digest is buffered) offset for " +
86+
"this partition.",
8687
)
8788
self._otp_partition_info_struct.add_field(
8889
name = self.OTP_PARTITION_INFO_STRUCT_ALIGN_MASK_FIELD_NAME,

sw/device/silicon_creator/lib/drivers/otp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ dt_otp_partition_info_t otp_readable_partition_info(otp_partition_t partition) {
5656

5757
uint64_t otp_partition_digest_read(otp_partition_t partition) {
5858
uint32_t reg_offset =
59-
otp_ctrl_base() + otp_readable_partition_info(partition).digest_addr;
59+
otp_ctrl_base() +
60+
otp_readable_partition_info(partition).digest_reg_offset;
6061
uint64_t value = sec_mmio_read32(reg_offset + sizeof(uint32_t));
6162
value <<= 32;
6263
value |= sec_mmio_read32(reg_offset);

sw/device/silicon_creator/rom/e2e/keymgr/rom_e2e_keymgr_init_test.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,17 @@ bool test_main(void) {
4343
// - the digest of the CreatorSwCfg partition,
4444
// - the digest of the OwnerSwCfg partition,
4545
// - the SHA256 integrity hash of the first stage boot keys.
46-
otp_dai_read(
47-
kOtpPartitionCreatorSwCfg,
48-
/*relative_address=*/
49-
otp_readable_partition_info(kOtpPartitionCreatorSwCfg).digest_addr -
50-
OTP_CTRL_PARAM_CREATOR_SW_CFG_OFFSET,
51-
otp_state,
52-
/*num_words=*/2);
46+
otp_dai_read(kOtpPartitionCreatorSwCfg,
47+
/*relative_address=*/
48+
otp_readable_partition_info(kOtpPartitionCreatorSwCfg)
49+
.digest_reg_offset -
50+
OTP_CTRL_PARAM_CREATOR_SW_CFG_OFFSET,
51+
otp_state,
52+
/*num_words=*/2);
5353
otp_dai_read(
5454
kOtpPartitionOwnerSwCfg,
5555
/*relative_address=*/
56-
otp_readable_partition_info(kOtpPartitionOwnerSwCfg).digest_addr -
56+
otp_readable_partition_info(kOtpPartitionOwnerSwCfg).digest_reg_offset -
5757
OTP_CTRL_PARAM_OWNER_SW_CFG_OFFSET,
5858
&otp_state[2],
5959
/*num_words=*/2);

0 commit comments

Comments
 (0)