Loading...
Note: File does not exist in v5.9.
1/* SPDX-License-Identifier: GPL-2.0-only */
2/* Copyright(c) 2020 Intel Corporation. */
3
4#ifndef __CXL_CORE_H__
5#define __CXL_CORE_H__
6
7extern const struct device_type cxl_nvdimm_bridge_type;
8extern const struct device_type cxl_nvdimm_type;
9
10extern struct attribute_group cxl_base_attribute_group;
11
12#ifdef CONFIG_CXL_REGION
13extern struct device_attribute dev_attr_create_pmem_region;
14extern struct device_attribute dev_attr_delete_region;
15extern struct device_attribute dev_attr_region;
16extern const struct device_type cxl_pmem_region_type;
17extern const struct device_type cxl_region_type;
18void cxl_decoder_kill_region(struct cxl_endpoint_decoder *cxled);
19#define CXL_REGION_ATTR(x) (&dev_attr_##x.attr)
20#define CXL_REGION_TYPE(x) (&cxl_region_type)
21#define SET_CXL_REGION_ATTR(x) (&dev_attr_##x.attr),
22#define CXL_PMEM_REGION_TYPE(x) (&cxl_pmem_region_type)
23int cxl_region_init(void);
24void cxl_region_exit(void);
25#else
26static inline void cxl_decoder_kill_region(struct cxl_endpoint_decoder *cxled)
27{
28}
29static inline int cxl_region_init(void)
30{
31 return 0;
32}
33static inline void cxl_region_exit(void)
34{
35}
36#define CXL_REGION_ATTR(x) NULL
37#define CXL_REGION_TYPE(x) NULL
38#define SET_CXL_REGION_ATTR(x)
39#define CXL_PMEM_REGION_TYPE(x) NULL
40#endif
41
42struct cxl_send_command;
43struct cxl_mem_query_commands;
44int cxl_query_cmd(struct cxl_memdev *cxlmd,
45 struct cxl_mem_query_commands __user *q);
46int cxl_send_cmd(struct cxl_memdev *cxlmd, struct cxl_send_command __user *s);
47void __iomem *devm_cxl_iomap_block(struct device *dev, resource_size_t addr,
48 resource_size_t length);
49
50struct dentry *cxl_debugfs_create_dir(const char *dir);
51int cxl_dpa_set_mode(struct cxl_endpoint_decoder *cxled,
52 enum cxl_decoder_mode mode);
53int cxl_dpa_alloc(struct cxl_endpoint_decoder *cxled, unsigned long long size);
54int cxl_dpa_free(struct cxl_endpoint_decoder *cxled);
55resource_size_t cxl_dpa_size(struct cxl_endpoint_decoder *cxled);
56resource_size_t cxl_dpa_resource_start(struct cxl_endpoint_decoder *cxled);
57extern struct rw_semaphore cxl_dpa_rwsem;
58
59bool is_switch_decoder(struct device *dev);
60struct cxl_switch_decoder *to_cxl_switch_decoder(struct device *dev);
61
62int cxl_memdev_init(void);
63void cxl_memdev_exit(void);
64void cxl_mbox_init(void);
65
66#endif /* __CXL_CORE_H__ */