[3/8] platform/x86/intel/sdsi: Add header file

Message ID 20240201010747.471141-4-david.e.box@linux.intel.com
State New
Headers
Series Intel On Demand: Add netlink interface for SPDM attestation |

Commit Message

David E. Box Feb. 1, 2024, 1:07 a.m. UTC
  In preparation for new source files, move common structures to a new
header flie.

Signed-off-by: David E. Box <david.e.box@linux.intel.com>
---
 MAINTAINERS                       |  1 +
 drivers/platform/x86/intel/sdsi.c | 23 +----------------------
 drivers/platform/x86/intel/sdsi.h | 31 +++++++++++++++++++++++++++++++
 3 files changed, 33 insertions(+), 22 deletions(-)
 create mode 100644 drivers/platform/x86/intel/sdsi.h
  

Comments

Ilpo Järvinen Feb. 8, 2024, 1:41 p.m. UTC | #1
On Wed, 31 Jan 2024, David E. Box wrote:

> In preparation for new source files, move common structures to a new
> header flie.
> 
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
>  MAINTAINERS                       |  1 +
>  drivers/platform/x86/intel/sdsi.c | 23 +----------------------
>  drivers/platform/x86/intel/sdsi.h | 31 +++++++++++++++++++++++++++++++
>  3 files changed, 33 insertions(+), 22 deletions(-)
>  create mode 100644 drivers/platform/x86/intel/sdsi.h
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8d1052fa6a69..09ef8497e48a 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11042,6 +11042,7 @@ INTEL SDSI DRIVER
>  M:	David E. Box <david.e.box@linux.intel.com>
>  S:	Supported
>  F:	drivers/platform/x86/intel/sdsi.c
> +F:	drivers/platform/x86/intel/sdsi.h

Use this instead:

drivers/platform/x86/intel/sdsi*

Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
  
Kuppuswamy Sathyanarayanan Feb. 8, 2024, 9:52 p.m. UTC | #2
On 1/31/24 5:07 PM, David E. Box wrote:
> In preparation for new source files, move common structures to a new
> header flie.

Add some detail about why you adding new source files.

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>
> Signed-off-by: David E. Box <david.e.box@linux.intel.com>
> ---
>  MAINTAINERS                       |  1 +
>  drivers/platform/x86/intel/sdsi.c | 23 +----------------------
>  drivers/platform/x86/intel/sdsi.h | 31 +++++++++++++++++++++++++++++++
>  3 files changed, 33 insertions(+), 22 deletions(-)
>  create mode 100644 drivers/platform/x86/intel/sdsi.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8d1052fa6a69..09ef8497e48a 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11042,6 +11042,7 @@ INTEL SDSI DRIVER
>  M:	David E. Box <david.e.box@linux.intel.com>
>  S:	Supported
>  F:	drivers/platform/x86/intel/sdsi.c
> +F:	drivers/platform/x86/intel/sdsi.h
>  F:	tools/arch/x86/intel_sdsi/
>  F:	tools/testing/selftests/drivers/sdsi/
>  
> diff --git a/drivers/platform/x86/intel/sdsi.c b/drivers/platform/x86/intel/sdsi.c
> index 05a35f2f85b6..d48bb648f0b2 100644
> --- a/drivers/platform/x86/intel/sdsi.c
> +++ b/drivers/platform/x86/intel/sdsi.c
> @@ -22,24 +22,16 @@
>  #include <linux/types.h>
>  #include <linux/uaccess.h>
>  
> +#include "sdsi.h"
>  #include "vsec.h"
>  
>  #define ACCESS_TYPE_BARID		2
>  #define ACCESS_TYPE_LOCAL		3
>  
>  #define SDSI_MIN_SIZE_DWORDS		276
> -#define SDSI_SIZE_MAILBOX		1024
>  #define SDSI_SIZE_REGS			80
>  #define SDSI_SIZE_CMD			sizeof(u64)
>  
> -/*
> - * Write messages are currently up to the size of the mailbox
> - * while read messages are up to 4 times the size of the
> - * mailbox, sent in packets
> - */
> -#define SDSI_SIZE_WRITE_MSG		SDSI_SIZE_MAILBOX
> -#define SDSI_SIZE_READ_MSG		(SDSI_SIZE_MAILBOX * 4)
> -
>  #define SDSI_ENABLED_FEATURES_OFFSET	16
>  #define SDSI_FEATURE_SDSI		BIT(3)
>  #define SDSI_FEATURE_METERING		BIT(26)
> @@ -103,19 +95,6 @@ struct disc_table {
>  	u32	offset;
>  };
>  
> -struct sdsi_priv {
> -	struct mutex		mb_lock;	/* Mailbox access lock */
> -	struct device		*dev;
> -	void __iomem		*control_addr;
> -	void __iomem		*mbox_addr;
> -	void __iomem		*regs_addr;
> -	int			control_size;
> -	int			maibox_size;
> -	int			registers_size;
> -	u32			guid;
> -	u32			features;
> -};
> -
>  /* SDSi mailbox operations must be performed using 64bit mov instructions */
>  static __always_inline void
>  sdsi_memcpy64_toio(u64 __iomem *to, const u64 *from, size_t count_bytes)
> diff --git a/drivers/platform/x86/intel/sdsi.h b/drivers/platform/x86/intel/sdsi.h
> new file mode 100644
> index 000000000000..d0d7450c7b2b
> --- /dev/null
> +++ b/drivers/platform/x86/intel/sdsi.h
> @@ -0,0 +1,31 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __PDx86_SDSI_H_
> +#define __PDx86_SDSI_H_
> +#include <linux/mutex.h>
> +#include <linux/types.h>
> +
> +#define SDSI_SIZE_MAILBOX		1024
> +
> +/*
> + * Write messages are currently up to the size of the mailbox
> + * while read messages are up to 4 times the size of the
> + * mailbox, sent in packets
> + */
> +#define SDSI_SIZE_WRITE_MSG		SDSI_SIZE_MAILBOX
> +#define SDSI_SIZE_READ_MSG		(SDSI_SIZE_MAILBOX * 4)
> +
> +struct device;
> +
> +struct sdsi_priv {
> +	struct mutex			mb_lock;	/* Mailbox access lock */
> +	struct device			*dev;
> +	void __iomem			*control_addr;
> +	void __iomem			*mbox_addr;
> +	void __iomem			*regs_addr;
> +	int				control_size;
> +	int				maibox_size;
> +	int				registers_size;
> +	u32				guid;
> +	u32				features;
> +};
> +#endif
  

Patch

diff --git a/MAINTAINERS b/MAINTAINERS
index 8d1052fa6a69..09ef8497e48a 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11042,6 +11042,7 @@  INTEL SDSI DRIVER
 M:	David E. Box <david.e.box@linux.intel.com>
 S:	Supported
 F:	drivers/platform/x86/intel/sdsi.c
+F:	drivers/platform/x86/intel/sdsi.h
 F:	tools/arch/x86/intel_sdsi/
 F:	tools/testing/selftests/drivers/sdsi/
 
diff --git a/drivers/platform/x86/intel/sdsi.c b/drivers/platform/x86/intel/sdsi.c
index 05a35f2f85b6..d48bb648f0b2 100644
--- a/drivers/platform/x86/intel/sdsi.c
+++ b/drivers/platform/x86/intel/sdsi.c
@@ -22,24 +22,16 @@ 
 #include <linux/types.h>
 #include <linux/uaccess.h>
 
+#include "sdsi.h"
 #include "vsec.h"
 
 #define ACCESS_TYPE_BARID		2
 #define ACCESS_TYPE_LOCAL		3
 
 #define SDSI_MIN_SIZE_DWORDS		276
-#define SDSI_SIZE_MAILBOX		1024
 #define SDSI_SIZE_REGS			80
 #define SDSI_SIZE_CMD			sizeof(u64)
 
-/*
- * Write messages are currently up to the size of the mailbox
- * while read messages are up to 4 times the size of the
- * mailbox, sent in packets
- */
-#define SDSI_SIZE_WRITE_MSG		SDSI_SIZE_MAILBOX
-#define SDSI_SIZE_READ_MSG		(SDSI_SIZE_MAILBOX * 4)
-
 #define SDSI_ENABLED_FEATURES_OFFSET	16
 #define SDSI_FEATURE_SDSI		BIT(3)
 #define SDSI_FEATURE_METERING		BIT(26)
@@ -103,19 +95,6 @@  struct disc_table {
 	u32	offset;
 };
 
-struct sdsi_priv {
-	struct mutex		mb_lock;	/* Mailbox access lock */
-	struct device		*dev;
-	void __iomem		*control_addr;
-	void __iomem		*mbox_addr;
-	void __iomem		*regs_addr;
-	int			control_size;
-	int			maibox_size;
-	int			registers_size;
-	u32			guid;
-	u32			features;
-};
-
 /* SDSi mailbox operations must be performed using 64bit mov instructions */
 static __always_inline void
 sdsi_memcpy64_toio(u64 __iomem *to, const u64 *from, size_t count_bytes)
diff --git a/drivers/platform/x86/intel/sdsi.h b/drivers/platform/x86/intel/sdsi.h
new file mode 100644
index 000000000000..d0d7450c7b2b
--- /dev/null
+++ b/drivers/platform/x86/intel/sdsi.h
@@ -0,0 +1,31 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+#ifndef __PDx86_SDSI_H_
+#define __PDx86_SDSI_H_
+#include <linux/mutex.h>
+#include <linux/types.h>
+
+#define SDSI_SIZE_MAILBOX		1024
+
+/*
+ * Write messages are currently up to the size of the mailbox
+ * while read messages are up to 4 times the size of the
+ * mailbox, sent in packets
+ */
+#define SDSI_SIZE_WRITE_MSG		SDSI_SIZE_MAILBOX
+#define SDSI_SIZE_READ_MSG		(SDSI_SIZE_MAILBOX * 4)
+
+struct device;
+
+struct sdsi_priv {
+	struct mutex			mb_lock;	/* Mailbox access lock */
+	struct device			*dev;
+	void __iomem			*control_addr;
+	void __iomem			*mbox_addr;
+	void __iomem			*regs_addr;
+	int				control_size;
+	int				maibox_size;
+	int				registers_size;
+	u32				guid;
+	u32				features;
+};
+#endif