Rizwan Qureshi has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/35225 )
Change subject: soc/intel/common/block/cse: Move me_read_config32() to common code ......................................................................
Patch Set 11:
(1 comment)
https://review.coreboot.org/c/coreboot/+/35225/11/src/soc/intel/common/block... File src/soc/intel/common/block/cse/cse.c:
https://review.coreboot.org/c/coreboot/+/35225/11/src/soc/intel/common/block... PS11, Line 510: if (offset == PCI_ME_HFSTS1) : index = 1; : else if (offset == PCI_ME_HFSTS2) : index = 2; : else if (offset == PCI_ME_HFSTS3) : index = 3; : else if (offset == PCI_ME_HFSTS4) : index = 4; : else if (offset == PCI_ME_HFSTS5) : index = 5; : else if (offset == PCI_ME_HFSTS6) : index = 6; would using a static structure beautify it? like below..
struct hfsts_index{ uint32_t hfsts; uint32_t index; } struct hfsts_index hfsts_to_index[6] = { {PCI_ME_HFSTS1, 1}, {PCI_ME_HFSTS2, 2}, {PCI_ME_HFSTS3, 3}, {PCI_ME_HFSTS4, 4}, {PCI_ME_HFSTS5, 5}, {PCI_ME_HFSTS6, 6}, };
for (i = 0, i<=6 , i++) { if (hfsts_to_index[i].hfsts == hfsts_reg) index=hfsts_to_index[i].index; }
I think just a switch statement would be more appropriate here.