X86 platform drivers
 help / color / mirror / Atom feed
From: Suma Hegde <suma.hegde@amd.com>
To: <platform-driver-x86@vger.kernel.org>
Cc: <ilpo.jarvinen@linux.intel.com>, <hdegoede@redhat.com>,
	Suma Hegde <suma.hegde@amd.com>,
	Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
Subject: [v3 03/11] platform/x86/amd/hsmp: Move structure and macros to header file
Date: Sat, 20 Jul 2024 17:45:44 +0000	[thread overview]
Message-ID: <20240720174552.946255-3-suma.hegde@amd.com> (raw)
In-Reply-To: <20240720174552.946255-1-suma.hegde@amd.com>

This is in preparation to splitting ACPI and platform device drivers.
No logical change, move common structures and macros to hsmp.h

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>
---
Changes since v2:
None
Changes since v1:
1. Correct typo mistake in commit message
2. Add "Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>"
3. Arrange header files in alphabetical order for hsmp.h

 drivers/platform/x86/amd/hsmp/hsmp.c | 42 ++--------------------
 drivers/platform/x86/amd/hsmp/hsmp.h | 54 ++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 40 deletions(-)
 create mode 100644 drivers/platform/x86/amd/hsmp/hsmp.h

diff --git a/drivers/platform/x86/amd/hsmp/hsmp.c b/drivers/platform/x86/amd/hsmp/hsmp.c
index 10ab9b2437f1..2c9ba51b9614 100644
--- a/drivers/platform/x86/amd/hsmp/hsmp.c
+++ b/drivers/platform/x86/amd/hsmp/hsmp.c
@@ -9,15 +9,14 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include "hsmp.h"
+
 #include <asm/amd_hsmp.h>
 #include <asm/amd_nb.h>
 #include <linux/delay.h>
-#include <linux/io.h>
-#include <linux/miscdevice.h>
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/platform_device.h>
-#include <linux/semaphore.h>
 #include <linux/acpi.h>
 
 #define DRIVER_NAME		"amd_hsmp"
@@ -51,48 +50,11 @@
 #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;
-};
-
-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
index 000000000000..5afc7167fac1
--- /dev/null
+++ b/drivers/platform/x86/amd/hsmp/hsmp.h
@@ -0,0 +1,54 @@
+/* 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/io.h>
+#include <linux/miscdevice.h>
+#include <linux/semaphore.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;
+};
+
+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 */
-- 
2.25.1


  parent reply	other threads:[~2024-07-20 17:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-20 17:45 [v3 01/11] platform/x86/amd/hsmp: Create hsmp/ directory Suma Hegde
2024-07-20 17:45 ` [v3 02/11] platform/x86/amd/hsmp: Create wrapper function init_acpi() Suma Hegde
2024-07-20 17:45 ` Suma Hegde [this message]
2024-08-07 11:39   ` [v3 03/11] platform/x86/amd/hsmp: Move structure and macros to header file Ilpo Järvinen
2024-07-20 17:45 ` [v3 04/11] platform/x86/amd/hsmp: Move platform device specific code to plat.c Suma Hegde
2024-08-07 12:50   ` Ilpo Järvinen
2024-07-20 17:45 ` [v3 05/11] platform/x86/amd/hsmp: Move ACPI code to acpi.c Suma Hegde
2024-07-20 17:45 ` [v3 06/11] platform/x86/amd/hsmp: Change generic plat_dev name to hsmp_pdev Suma Hegde
2024-08-07 12:31   ` Ilpo Järvinen
2024-07-20 17:45 ` [v3 07/11] platform/x86/amd/hsmp: Create mutually exclusive ACPI and plat drivers Suma Hegde
2024-07-30  6:16   ` Suma Hegde
2024-07-30 13:20     ` Ilpo Järvinen
2024-08-06 11:40       ` Suma Hegde
2024-08-07 12:31   ` Ilpo Järvinen
2024-08-07 14:17   ` Ilpo Järvinen
2024-07-20 17:45 ` [v3 08/11] platform/x86/amd/hsmp: Use name space while exporting module symbols Suma Hegde
2024-07-20 17:45 ` [v3 09/11] platform/x86/amd/hsmp: Move read() and is_bin_visible() to respective files Suma Hegde
2024-08-07 12:37   ` Ilpo Järvinen
2024-07-20 17:45 ` [v3 10/11] platform/x86/amd/hsmp: Use dev_groups in the driver structure Suma Hegde
2024-07-20 17:45 ` [v3 11/11] platform/x86/amd/hsmp: Fix potential spectre issue Suma Hegde
2024-08-07 11:33 ` [v3 01/11] platform/x86/amd/hsmp: Create hsmp/ directory Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240720174552.946255-3-suma.hegde@amd.com \
    --to=suma.hegde@amd.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=naveenkrishna.chatradhi@amd.com \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox