]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blame - include/linux/libnvdimm.h
libnvdimm, nfit: dimm/memory-devices
[mirror_ubuntu-zesty-kernel.git] / include / linux / libnvdimm.h
CommitLineData
b94d5230
DW
1/*
2 * libnvdimm - Non-volatile-memory Devices Subsystem
3 *
4 * Copyright(c) 2013-2015 Intel Corporation. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15#ifndef __LIBNVDIMM_H__
16#define __LIBNVDIMM_H__
e6dfb2de
DW
17
18enum {
19 /* when a dimm supports both PMEM and BLK access a label is required */
20 NDD_ALIASING = 1 << 0,
21};
22
45def22c
DW
23extern struct attribute_group nvdimm_bus_attribute_group;
24
b94d5230
DW
25struct nvdimm;
26struct nvdimm_bus_descriptor;
27typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc,
28 struct nvdimm *nvdimm, unsigned int cmd, void *buf,
29 unsigned int buf_len);
30
31struct nvdimm_bus_descriptor {
45def22c 32 const struct attribute_group **attr_groups;
b94d5230
DW
33 unsigned long dsm_mask;
34 char *provider_name;
35 ndctl_fn ndctl;
36};
37
38struct device;
b94d5230
DW
39struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
40 struct nvdimm_bus_descriptor *nfit_desc);
41void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus);
45def22c 42struct nvdimm_bus *to_nvdimm_bus(struct device *dev);
e6dfb2de 43struct nvdimm *to_nvdimm(struct device *dev);
45def22c 44struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus);
e6dfb2de
DW
45const char *nvdimm_name(struct nvdimm *nvdimm);
46void *nvdimm_provider_data(struct nvdimm *nvdimm);
47struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data,
48 const struct attribute_group **groups, unsigned long flags);
b94d5230 49#endif /* __LIBNVDIMM_H__ */