@@ -11,6 +11,7 @@
#include <linux/log2.h>
#include <linux/node.h>
#include <linux/io.h>
+#include <cxl/cxl.h>
extern const struct nvdimm_security_ops *cxl_security_ops;
@@ -819,37 +820,6 @@ bool is_cxl_region(struct device *dev);
extern struct bus_type cxl_bus_type;
-struct cxl_driver {
- const char *name;
- int (*probe)(struct device *dev);
- void (*remove)(struct device *dev);
- struct device_driver drv;
- int id;
-};
-
-#define to_cxl_drv(__drv) container_of_const(__drv, struct cxl_driver, drv)
-
-int __cxl_driver_register(struct cxl_driver *cxl_drv, struct module *owner,
- const char *modname);
-#define cxl_driver_register(x) __cxl_driver_register(x, THIS_MODULE, KBUILD_MODNAME)
-void cxl_driver_unregister(struct cxl_driver *cxl_drv);
-
-#define module_cxl_driver(__cxl_driver) \
- module_driver(__cxl_driver, cxl_driver_register, cxl_driver_unregister)
-
-#define CXL_DEVICE_NVDIMM_BRIDGE 1
-#define CXL_DEVICE_NVDIMM 2
-#define CXL_DEVICE_PORT 3
-#define CXL_DEVICE_ROOT 4
-#define CXL_DEVICE_MEMORY_EXPANDER 5
-#define CXL_DEVICE_REGION 6
-#define CXL_DEVICE_PMEM_REGION 7
-#define CXL_DEVICE_DAX_REGION 8
-#define CXL_DEVICE_PMU 9
-
-#define MODULE_ALIAS_CXL(type) MODULE_ALIAS("cxl:t" __stringify(type) "*")
-#define CXL_MODALIAS_FMT "cxl:t%d"
-
struct cxl_nvdimm_bridge *to_cxl_nvdimm_bridge(struct device *dev);
struct cxl_nvdimm_bridge *devm_cxl_add_nvdimm_bridge(struct device *host,
struct cxl_port *port);
new file mode 100644
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/* Copyright(c) 2024 Intel Corporation. */
+#ifndef __CXL_GLOBAL_H__
+#define __CXL_GLOBAL_H__
+
+struct cxl_driver {
+ const char *name;
+ int (*probe)(struct device *dev);
+ void (*remove)(struct device *dev);
+ struct device_driver drv;
+ int id;
+};
+
+#define to_cxl_drv(__drv) container_of_const(__drv, struct cxl_driver, drv)
+
+int __cxl_driver_register(struct cxl_driver *cxl_drv, struct module *owner,
+ const char *modname);
+#define cxl_driver_register(x) __cxl_driver_register(x, THIS_MODULE, KBUILD_MODNAME)
+void cxl_driver_unregister(struct cxl_driver *cxl_drv);
+
+#define module_cxl_driver(__cxl_driver) \
+ module_driver(__cxl_driver, cxl_driver_register, cxl_driver_unregister)
+
+#define CXL_DEVICE_NVDIMM_BRIDGE 1
+#define CXL_DEVICE_NVDIMM 2
+#define CXL_DEVICE_PORT 3
+#define CXL_DEVICE_ROOT 4
+#define CXL_DEVICE_MEMORY_EXPANDER 5
+#define CXL_DEVICE_REGION 6
+#define CXL_DEVICE_PMEM_REGION 7
+#define CXL_DEVICE_DAX_REGION 8
+#define CXL_DEVICE_PMU 9
+
+#define MODULE_ALIAS_CXL(type) MODULE_ALIAS("cxl:t" __stringify(type) "*")
+#define CXL_MODALIAS_FMT "cxl:t%d"
+
+#endif
Move the code related to cxl_driver to allow external drivers such as cxl_fwctl to utilize the cxl_bus. Signed-off-by: Dave Jiang <dave.jiang@intel.com> --- drivers/cxl/cxl.h | 32 +------------------------------- include/cxl/cxl.h | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 31 deletions(-) create mode 100644 include/cxl/cxl.h