Skip to content

Conversation

AlexJones0
Copy link

These memcpys were accidentally using the size of the dereferenced byte array (i.e., always just 1 byte), and so were only copying the first byte of the HW_CFG device ID and manufacturing state that were being loaded from the OTP.

Copy link

@rivos-eblot rivos-eblot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add static_assert to ensure that for some reason the size of those arrays change, they cannot overflow the dedicated registers?

@AlexJones0
Copy link
Author

AlexJones0 commented Oct 3, 2025

Shouldn't we add static_assert to ensure that for some reason the size of those arrays change, they cannot overflow the dedicated registers?

Yes, I will add that to this PR.

Edit: Pushed that now. Not sure if there is a cleaner way to do this, feedback welcome :)

These `memcpy`s were accidentally using the size of the dereferenced
byte array (i.e., always just 1 byte), and so were only copying the
first byte of the HW_CFG device ID and manufacturing state that were
being loaded from the OTP.

Also add some local calculations and static assertions to check that the
HW_CFG value sizes that are given do not become out of sync with the
size of the registers.

Signed-off-by: Alex Jones <alex.jones@lowrisc.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants