Commit c893ee3f authored by Mario Limonciello's avatar Mario Limonciello Committed by Borislav Petkov (AMD)
Browse files

x86/amd_node: Add a smn_read_register() helper



Some of the ACP drivers will poll registers through SMN using
read_poll_timeout() which requires returning the result of the register read
as the argument.

Add a helper to do just that.

Signed-off-by: default avatarMario Limonciello <mario.limonciello@amd.com>
Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
Link: https://lore.kernel.org/r/20250217231747.1656228-2-superm1@kernel.org
parent 6b06755a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -46,4 +46,15 @@ static inline int __must_check amd_smn_hsmp_rdwr(u16 node, u32 address, u32 *val
}
#endif /* CONFIG_AMD_NODE */

/* helper for use with read_poll_timeout */
static inline int smn_read_register(u32 reg)
{
	int data, rc;

	rc = amd_smn_read(0, reg, &data);
	if (rc)
		return rc;

	return data;
}
#endif /*_ASM_X86_AMD_NODE_H_*/