#define pr_fmt(fmt) …
#include <linux/libnvdimm.h>
#include <linux/sched/mm.h>
#include <linux/vmalloc.h>
#include <linux/uaccess.h>
#include <linux/module.h>
#include <linux/blkdev.h>
#include <linux/fcntl.h>
#include <linux/async.h>
#include <linux/ndctl.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/cpu.h>
#include <linux/fs.h>
#include <linux/io.h>
#include <linux/mm.h>
#include <linux/nd.h>
#include "nd-core.h"
#include "nd.h"
#include "pfn.h"
int nvdimm_major;
static int nvdimm_bus_major;
static DEFINE_IDA(nd_ida);
static const struct class nd_class = …;
static int to_nd_device_type(const struct device *dev)
{ … }
static int nvdimm_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{ … }
static struct module *to_bus_provider(struct device *dev)
{ … }
static void nvdimm_bus_probe_start(struct nvdimm_bus *nvdimm_bus)
{ … }
static void nvdimm_bus_probe_end(struct nvdimm_bus *nvdimm_bus)
{ … }
static int nvdimm_bus_probe(struct device *dev)
{ … }
static void nvdimm_bus_remove(struct device *dev)
{ … }
static void nvdimm_bus_shutdown(struct device *dev)
{ … }
void nd_device_notify(struct device *dev, enum nvdimm_event event)
{ … }
EXPORT_SYMBOL(…);
void nvdimm_region_notify(struct nd_region *nd_region, enum nvdimm_event event)
{ … }
EXPORT_SYMBOL_GPL(…);
struct clear_badblocks_context { … };
static int nvdimm_clear_badblocks_region(struct device *dev, void *data)
{ … }
static void nvdimm_clear_badblocks_regions(struct nvdimm_bus *nvdimm_bus,
phys_addr_t phys, u64 cleared)
{ … }
static void nvdimm_account_cleared_poison(struct nvdimm_bus *nvdimm_bus,
phys_addr_t phys, u64 cleared)
{ … }
long nvdimm_clear_poison(struct device *dev, phys_addr_t phys,
unsigned int len)
{ … }
EXPORT_SYMBOL_GPL(…);
static int nvdimm_bus_match(struct device *dev, const struct device_driver *drv);
static const struct bus_type nvdimm_bus_type = …;
static void nvdimm_bus_release(struct device *dev)
{ … }
static const struct device_type nvdimm_bus_dev_type = …;
bool is_nvdimm_bus(struct device *dev)
{ … }
struct nvdimm_bus *walk_to_nvdimm_bus(struct device *nd_dev)
{ … }
struct nvdimm_bus *to_nvdimm_bus(struct device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
struct nvdimm_bus *nvdimm_to_bus(struct nvdimm *nvdimm)
{ … }
EXPORT_SYMBOL_GPL(…);
static struct lock_class_key nvdimm_bus_key;
struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
struct nvdimm_bus_descriptor *nd_desc)
{ … }
EXPORT_SYMBOL_GPL(…);
void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus)
{ … }
EXPORT_SYMBOL_GPL(…);
static int child_unregister(struct device *dev, void *data)
{ … }
static void free_badrange_list(struct list_head *badrange_list)
{ … }
static void nd_bus_remove(struct device *dev)
{ … }
static int nd_bus_probe(struct device *dev)
{ … }
static struct nd_device_driver nd_bus_driver = …;
static int nvdimm_bus_match(struct device *dev, const struct device_driver *drv)
{ … }
static ASYNC_DOMAIN_EXCLUSIVE(nd_async_domain);
void nd_synchronize(void)
{ … }
EXPORT_SYMBOL_GPL(…);
static void nd_async_device_register(void *d, async_cookie_t cookie)
{ … }
static void nd_async_device_unregister(void *d, async_cookie_t cookie)
{ … }
static void __nd_device_register(struct device *dev, bool sync)
{ … }
void nd_device_register(struct device *dev)
{ … }
EXPORT_SYMBOL(…);
void nd_device_register_sync(struct device *dev)
{ … }
void nd_device_unregister(struct device *dev, enum nd_async_mode mode)
{ … }
EXPORT_SYMBOL(…);
int __nd_driver_register(struct nd_device_driver *nd_drv, struct module *owner,
const char *mod_name)
{ … }
EXPORT_SYMBOL(…);
void nvdimm_check_and_set_ro(struct gendisk *disk)
{ … }
EXPORT_SYMBOL(…);
static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(modalias);
static ssize_t devtype_show(struct device *dev, struct device_attribute *attr,
char *buf)
{ … }
static DEVICE_ATTR_RO(devtype);
static struct attribute *nd_device_attributes[] = …;
const struct attribute_group nd_device_attribute_group = …;
static ssize_t numa_node_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(numa_node);
static int nvdimm_dev_to_target_node(struct device *dev)
{ … }
static ssize_t target_node_show(struct device *dev,
struct device_attribute *attr, char *buf)
{ … }
static DEVICE_ATTR_RO(target_node);
static struct attribute *nd_numa_attributes[] = …;
static umode_t nd_numa_attr_visible(struct kobject *kobj, struct attribute *a,
int n)
{ … }
const struct attribute_group nd_numa_attribute_group = …;
static void ndctl_release(struct device *dev)
{ … }
static struct lock_class_key nvdimm_ndctl_key;
int nvdimm_bus_create_ndctl(struct nvdimm_bus *nvdimm_bus)
{ … }
void nvdimm_bus_destroy_ndctl(struct nvdimm_bus *nvdimm_bus)
{ … }
static const struct nd_cmd_desc __nd_cmd_dimm_descs[] = …;
const struct nd_cmd_desc *nd_cmd_dimm_desc(int cmd)
{ … }
EXPORT_SYMBOL_GPL(…);
static const struct nd_cmd_desc __nd_cmd_bus_descs[] = …;
const struct nd_cmd_desc *nd_cmd_bus_desc(int cmd)
{ … }
EXPORT_SYMBOL_GPL(…);
u32 nd_cmd_in_size(struct nvdimm *nvdimm, int cmd,
const struct nd_cmd_desc *desc, int idx, void *buf)
{ … }
EXPORT_SYMBOL_GPL(…);
u32 nd_cmd_out_size(struct nvdimm *nvdimm, int cmd,
const struct nd_cmd_desc *desc, int idx, const u32 *in_field,
const u32 *out_field, unsigned long remainder)
{ … }
EXPORT_SYMBOL_GPL(…);
void wait_nvdimm_bus_probe_idle(struct device *dev)
{ … }
static int nd_pmem_forget_poison_check(struct device *dev, void *data)
{ … }
static int nd_ns_forget_poison_check(struct device *dev, void *data)
{ … }
static int nd_cmd_clear_to_send(struct nvdimm_bus *nvdimm_bus,
struct nvdimm *nvdimm, unsigned int cmd, void *data)
{ … }
static int __nd_ioctl(struct nvdimm_bus *nvdimm_bus, struct nvdimm *nvdimm,
int read_only, unsigned int ioctl_cmd, unsigned long arg)
{ … }
enum nd_ioctl_mode { … };
static int match_dimm(struct device *dev, void *data)
{ … }
static long nd_ioctl(struct file *file, unsigned int cmd, unsigned long arg,
enum nd_ioctl_mode mode)
{ … }
static long bus_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
static long dimm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{ … }
static int nd_open(struct inode *inode, struct file *file)
{ … }
static const struct file_operations nvdimm_bus_fops = …;
static const struct file_operations nvdimm_fops = …;
int __init nvdimm_bus_init(void)
{ … }
void nvdimm_bus_exit(void)
{ … }