]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
platform/x86/amd/hsmp: Move structure and macros to header file
authorSuma Hegde <suma.hegde@amd.com>
Mon, 21 Oct 2024 11:14:21 +0000 (11:14 +0000)
committerIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Tue, 22 Oct 2024 10:36:52 +0000 (13:36 +0300)
This is in preparation to splitting ACPI and platform device drivers.
No logical change, move common structures, macros to hsmp.h,
add missed header files, remove unwanted header inclusions,
and re-order the header file in hsmp.c file.

Signed-off-by: Suma Hegde <suma.hegde@amd.com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20241021111428.2676884-4-suma.hegde@amd.com
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
drivers/platform/x86/amd/hsmp/hsmp.c
drivers/platform/x86/amd/hsmp/hsmp.h [new file with mode: 0644]

index 759c824f2c4fadc988cac2f51a56306b29a20984..ea2f13bda629ee0b88e0a45c415e7ceccd134a6a 100644 (file)
 
 #include <asm/amd_hsmp.h>
 #include <asm/amd_nb.h>
+
+#include <linux/acpi.h>
 #include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/miscdevice.h>
+#include <linux/device.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
 #include <linux/semaphore.h>
-#include <linux/acpi.h>
+#include <linux/sysfs.h>
+
+#include "hsmp.h"
 
 #define DRIVER_NAME            "amd_hsmp"
 #define DRIVER_VERSION         "2.2"
 #define HSMP_INDEX_REG         0xc4
 #define HSMP_DATA_REG          0xc8
 
-#define HSMP_CDEV_NAME         "hsmp_cdev"
-#define HSMP_DEVNODE_NAME      "hsmp"
-#define HSMP_METRICS_TABLE_NAME        "metrics_bin"
-
-#define HSMP_ATTR_GRP_NAME_SIZE        10
-
 /* These are the strings specified in ACPI table */
 #define MSG_IDOFF_STR          "MsgIdOffset"
 #define MSG_ARGOFF_STR         "MsgArgOffset"
 #define MSG_RESPOFF_STR                "MsgRspOffset"
 
-#define MAX_AMD_SOCKETS 8
-
-struct hsmp_mbaddr_info {
-       u32 base_addr;
-       u32 msg_id_off;
-       u32 msg_resp_off;
-       u32 msg_arg_off;
-       u32 size;
-};
-
-struct hsmp_socket {
-       struct bin_attribute hsmp_attr;
-       struct hsmp_mbaddr_info mbinfo;
-       void __iomem *metric_tbl_addr;
-       void __iomem *virt_base_addr;
-       struct semaphore hsmp_sem;
-       char name[HSMP_ATTR_GRP_NAME_SIZE];
-       struct pci_dev *root;
-       struct device *dev;
-       u16 sock_ind;
-       int (*amd_hsmp_rdwr)(struct hsmp_socket *sock, u32 off, u32 *val, bool rw);
-};
-
-struct hsmp_plat_device {
-       struct miscdevice hsmp_device;
-       struct hsmp_socket *sock;
-       u32 proto_ver;
-       u16 num_sockets;
-       bool is_acpi_device;
-       bool is_probed;
-};
-
 static struct hsmp_plat_device plat_dev;
 
 static int amd_hsmp_pci_rdwr(struct hsmp_socket *sock, u32 offset,
diff --git a/drivers/platform/x86/amd/hsmp/hsmp.h b/drivers/platform/x86/amd/hsmp/hsmp.h
new file mode 100644 (file)
index 0000000..d54b968
--- /dev/null
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * AMD HSMP Platform Driver
+ * Copyright (c) 2024, AMD.
+ * All Rights Reserved.
+ *
+ * Header file for HSMP driver
+ */
+
+#ifndef HSMP_H
+#define HSMP_H
+
+#include <linux/compiler_types.h>
+#include <linux/device.h>
+#include <linux/miscdevice.h>
+#include <linux/pci.h>
+#include <linux/semaphore.h>
+#include <linux/sysfs.h>
+
+#define HSMP_METRICS_TABLE_NAME        "metrics_bin"
+
+#define HSMP_ATTR_GRP_NAME_SIZE        10
+
+#define MAX_AMD_SOCKETS 8
+
+#define HSMP_CDEV_NAME         "hsmp_cdev"
+#define HSMP_DEVNODE_NAME      "hsmp"
+
+struct hsmp_mbaddr_info {
+       u32 base_addr;
+       u32 msg_id_off;
+       u32 msg_resp_off;
+       u32 msg_arg_off;
+       u32 size;
+};
+
+struct hsmp_socket {
+       struct bin_attribute hsmp_attr;
+       struct hsmp_mbaddr_info mbinfo;
+       void __iomem *metric_tbl_addr;
+       void __iomem *virt_base_addr;
+       struct semaphore hsmp_sem;
+       char name[HSMP_ATTR_GRP_NAME_SIZE];
+       struct pci_dev *root;
+       struct device *dev;
+       u16 sock_ind;
+       int (*amd_hsmp_rdwr)(struct hsmp_socket *sock, u32 off, u32 *val, bool rw);
+};
+
+struct hsmp_plat_device {
+       struct miscdevice hsmp_device;
+       struct hsmp_socket *sock;
+       u32 proto_ver;
+       u16 num_sockets;
+       bool is_acpi_device;
+       bool is_probed;
+};
+#endif /* HSMP_H */