Furquan Shaikh has posted comments on this change. ( https://review.coreboot.org/18669 )
Change subject: soc/intel/common/block: Add Intel common PCR support ......................................................................
Patch Set 5:
(7 comments)
https://review.coreboot.org/#/c/18669/5/src/soc/intel/common/block/include/i... File src/soc/intel/common/block/include/intelblocks/pcr.h:
PS5, Line 20: #include <stddef.h> What is this required for?
https://review.coreboot.org/#/c/18669/5/src/soc/intel/common/block/pcr/pcr.c File src/soc/intel/common/block/pcr/pcr.c:
PS5, Line 34: return pcr_reg_address(pid, offset); Can we just pull in the above pcr_reg_address code into this? This function isn't doing other than returning whatever pcr_reg_address returns.
Line 112: read32(pcr_reg_address(pid, offset));
Again, this is still wrong. offset could be misaligned. Therefore you shoul
Maybe we could define the functions as:
pch_pcr_read(void *addr, size_t size, void *data) pch_pcr_write(void *addr, size_t size, void *data)
and within pch_pcr_write we can simply call pch_pcr_read(addr, size, data); as a dummy read that Aaron suggested. We wouldn't have to recalculate pcr_reg_address again in that case.
PS5, Line 133: Write PCR register. (This is internal function) This might need a better explanation. Its a read-modify-write and not just a write.
PS5, Line 140: pcr_and_then_or nitpick: We have two internal functions with prefix pch_ and one with pcr_. Might help to make it more consistent.
PS5, Line 145: if (pch_pcr_read(pid, offset, size, &data32) != 0) : return -1; : : data32 &= anddata; : data32 |= ordata; : : return pch_pcr_write(pid, offset, size, data32); Right now this is recalculating pcr_reg_address three times. If we change to passing in void *addr to pch_pcr_read/pch_pcr_write, we can avoid doing that.
PS5, Line 154: pcr_andthenor32 can we follow the same convention as above: pcr_and_then_or_32 or something? Its easier to read that way.