Attention is currently required from: Felix Singer, Arthur Heymans, Sergii Dmytruk, Timothy Pearson, Ron Minnich. Krystian Hebel has posted comments on this change. ( https://review.coreboot.org/c/coreboot/+/57078 )
Change subject: src/cpu/power9: add file structure for power9, implement SCOM access ......................................................................
Patch Set 11:
(1 comment)
File src/include/cpu/power/scom.h:
https://review.coreboot.org/c/coreboot/+/57078/comment/4799aeb8_e78f23f1 PS11, Line 91: static uint64_t read_scom_direct(uint64_t reg_address) : { : uint64_t val; : uint64_t hmer = 0; : do { : /* : * Clearing HMER on every SCOM access seems to slow down CCS up : * to a point where it starts hitting timeout on "less ideal" : * DIMMs for write centering. Clear it only if this do...while : * executes more than once. : */ : if ((hmer & SPR_HMER_XSCOM_STATUS) == SPR_HMER_XSCOM_OCCUPIED) : clear_hmer(); : : eieio(); : asm volatile( : "ldcix %0, %1, %2" : : "=r"(val) : : "b"(MMIO_GROUP0_CHIP0_SCOM_BASE_ADDR), : "r"(reg_address << 3)); : eieio(); : hmer = read_hmer(); : } while ((hmer & SPR_HMER_XSCOM_STATUS) == SPR_HMER_XSCOM_OCCUPIED); : : if (hmer & SPR_HMER_XSCOM_STATUS) { : reset_scom_engine(); : /* : * All F's are returned in case of error, but code polls for a set bit : * after changes that can make such error appear (e.g. clock settings). : * Return 0 so caller won't have to test for all F's in that case. : */ : return 0; : } : return val; : } : : static void write_scom_direct(uint64_t reg_address, uint64_t data) : { : uint64_t hmer = 0; : do { : /* See comment in read_scom_direct() */ : if ((hmer & SPR_HMER_XSCOM_STATUS) == SPR_HMER_XSCOM_OCCUPIED) : clear_hmer(); : : eieio(); : asm volatile( : "stdcix %0, %1, %2":: : "r"(data), : "b"(MMIO_GROUP0_CHIP0_SCOM_BASE_ADDR), : "r"(reg_address << 3)); : eieio(); : hmer = read_hmer(); : } while ((hmer & SPR_HMER_XSCOM_STATUS) == SPR_HMER_XSCOM_OCCUPIED); : : if (hmer & SPR_HMER_XSCOM_STATUS) : reset_scom_engine(); : }
What is the rationale to not put this in a compilation unit?
None at this moment I guess. It started as just inlined `asm volatile(...); eieio();` but got way more complicated since. This should be moved to scom.c.