/* Test the hsmp interface on each socket */
ret = hsmp_test(i, 0xDEADBEEF); if (ret) {
dev_err(dev, "HSMP test message failed on Fam:%x model:%x\n",
boot_cpu_data.x86, boot_cpu_data.x86_model);
dev_err(dev, "Is HSMP disabled in BIOS ?\n"); return ret;
}
ret = hsmp_cache_proto_ver(i); if (ret) {
dev_err(dev, "Failed to read HSMP protocol version\n"); return ret;
}
if (hsmp_pdev->proto_ver == HSMP_PROTO_VER6) {
ret = hsmp_get_tbl_dram_base(i); if (ret)
dev_err(dev, "Failed to init metric table\n");
}
/* Register with hwmon interface for reporting power */
ret = hsmp_create_sensor(dev, i); if (ret)
dev_err(dev, "Failed to register HSMP sensors with hwmon\n");
}
return0;
}
staticint hsmp_pltdrv_probe(struct platform_device *pdev)
{ int ret;
hsmp_pdev->sock = devm_kcalloc(&pdev->dev, hsmp_pdev->num_sockets, sizeof(*hsmp_pdev->sock),
GFP_KERNEL); if (!hsmp_pdev->sock) return -ENOMEM;
ret = init_platform_device(&pdev->dev); if (ret) {
dev_err(&pdev->dev, "Failed to init HSMP mailbox\n"); return ret;
}
ret = hsmp_misc_register(&pdev->dev); if (ret) {
dev_err(&pdev->dev, "Failed to register misc device\n"); return ret;
}
dev_dbg(&pdev->dev, "AMD HSMP is probed successfully\n"); return0;
}
staticint __init hsmp_plt_init(void)
{ int ret = -ENODEV;
if (acpi_dev_present(ACPI_HSMP_DEVICE_HID, NULL, -1)) { if (IS_ENABLED(CONFIG_AMD_HSMP_ACPI))
pr_debug("HSMP is supported through ACPI on this platform, please use hsmp_acpi.ko\n"); else
pr_info("HSMP is supported through ACPI on this platform, please enable AMD_HSMP_ACPI config\n"); return -ENODEV;
}
if (!legacy_hsmp_support()) {
pr_info("HSMP interface is either disabled or not supported on family:%x model:%x\n",
boot_cpu_data.x86, boot_cpu_data.x86_model); return ret;
}
hsmp_pdev = get_hsmp_pdev(); if (!hsmp_pdev) return -ENOMEM;
/* *amd_num_nodes()returnsnumberofSMN/DFinterfacespresentinthesystem *ifwehaveNSMN/DFinterfacesthatideallymeansNsockets
*/
hsmp_pdev->num_sockets = amd_num_nodes(); if (hsmp_pdev->num_sockets == 0 || hsmp_pdev->num_sockets > MAX_AMD_NUM_NODES) {
pr_err("Wrong number of sockets\n"); return ret;
}
ret = platform_driver_register(&amd_hsmp_driver); if (ret) return ret;
ret = hsmp_plat_dev_register(); if (ret)
platform_driver_unregister(&amd_hsmp_driver);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.