aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform
diff options
context:
space:
mode:
authorSuma Hegde <suma.hegde@amd.com>2024-01-06 02:25:22 +0000
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>2024-01-25 14:51:05 +0200
commite6100ef3c0bf52e801d08d247cea93cfa73a0d31 (patch)
treed3f2334081a62132ba6e456749efc1f31747a7ff /drivers/platform
parent3f399b5d7189bcb608c75abc85fe39f7a5509cfa (diff)
downloadlinux-e6100ef3c0bf52e801d08d247cea93cfa73a0d31.tar.gz
platform/x86/amd/hsmp: Move hsmp_test to probe
This is in advance to supporting ACPI based probe. In case of non-ACPI driver, hsmp_test() can be performed either in plat init() or in probe(). however, in case of ACPI probing, hsmp_test() cannot be called in init(), as the mailbox reg offsets and base addresses are read from ACPI table in the probe(). Hence, move hsmp_test() to probe as preparation for ACPI support. Also use hsmp_send_message() directly in hsmp_test() as the semaphore is already initialized in probe. Signed-off-by: Suma Hegde <suma.hegde@amd.com> Signed-off-by: Naveen Krishna Chatradhi <nchatrad@amd.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/r/20240106022532.1746932-1-suma.hegde@amd.com Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/x86/amd/hsmp.c30
1 files changed, 11 insertions, 19 deletions
diff --git a/drivers/platform/x86/amd/hsmp.c b/drivers/platform/x86/amd/hsmp.c
index b55d80e291393e..3c17b488f4f8ac 100644
--- a/drivers/platform/x86/amd/hsmp.c
+++ b/drivers/platform/x86/amd/hsmp.c
@@ -244,12 +244,7 @@ EXPORT_SYMBOL_GPL(hsmp_send_message);
static int hsmp_test(u16 sock_ind, u32 value)
{
struct hsmp_message msg = { 0 };
- struct amd_northbridge *nb;
- int ret = -ENODEV;
-
- nb = node_to_amd_nb(sock_ind);
- if (!nb || !nb->root)
- return ret;
+ int ret;
/*
* Test the hsmp port by performing TEST command. The test message
@@ -261,7 +256,7 @@ static int hsmp_test(u16 sock_ind, u32 value)
msg.args[0] = value;
msg.sock_ind = sock_ind;
- ret = __hsmp_send_message(nb->root, &msg);
+ ret = hsmp_send_message(&msg);
if (ret)
return ret;
@@ -504,6 +499,15 @@ static int hsmp_pltdrv_probe(struct platform_device *pdev)
for (i = 0; i < plat_dev.num_sockets; i++) {
sema_init(&plat_dev.sock[i].hsmp_sem, 1);
plat_dev.sock[i].sock_ind = i;
+
+ /* Test the hsmp interface on each socket */
+ ret = hsmp_test(i, 0xDEADBEEF);
+ if (ret) {
+ pr_err("HSMP test message failed on Fam:%x model:%x\n",
+ boot_cpu_data.x86, boot_cpu_data.x86_model);
+ pr_err("Is HSMP disabled in BIOS ?\n");
+ return ret;
+ }
}
plat_dev.hsmp_device.name = HSMP_CDEV_NAME;
@@ -544,7 +548,6 @@ static struct platform_device *amd_hsmp_platdev;
static int __init hsmp_plt_init(void)
{
int ret = -ENODEV;
- int i;
if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD || boot_cpu_data.x86 < 0x19) {
pr_err("HSMP is not supported on Family:%x model:%x\n",
@@ -560,17 +563,6 @@ static int __init hsmp_plt_init(void)
if (plat_dev.num_sockets == 0)
return ret;
- /* Test the hsmp interface on each socket */
- for (i = 0; i < plat_dev.num_sockets; i++) {
- ret = hsmp_test(i, 0xDEADBEEF);
- if (ret) {
- pr_err("HSMP test message failed on Fam:%x model:%x\n",
- boot_cpu_data.x86, boot_cpu_data.x86_model);
- pr_err("Is HSMP disabled in BIOS ?\n");
- return ret;
- }
- }
-
ret = platform_driver_register(&amd_hsmp_driver);
if (ret)
return ret;