blob: 07787f0dd7de14393227d8fb768f1d8ae64114ea [file] [log] [blame]
Dan Williamsb94d5232015-05-19 22:54:31 -04001/*
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__
Dan Williamse6dfb2d2015-04-25 03:56:17 -040017
18enum {
19 /* when a dimm supports both PMEM and BLK access a label is required */
20 NDD_ALIASING = 1 << 0,
21};
22
Dan Williams45def222015-04-26 19:26:48 -040023extern struct attribute_group nvdimm_bus_attribute_group;
24
Dan Williamsb94d5232015-05-19 22:54:31 -040025struct 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 {
Dan Williams45def222015-04-26 19:26:48 -040032 const struct attribute_group **attr_groups;
Dan Williamsb94d5232015-05-19 22:54:31 -040033 unsigned long dsm_mask;
34 char *provider_name;
35 ndctl_fn ndctl;
36};
37
38struct device;
Dan Williamsb94d5232015-05-19 22:54:31 -040039struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
40 struct nvdimm_bus_descriptor *nfit_desc);
41void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus);
Dan Williams45def222015-04-26 19:26:48 -040042struct nvdimm_bus *to_nvdimm_bus(struct device *dev);
Dan Williamse6dfb2d2015-04-25 03:56:17 -040043struct nvdimm *to_nvdimm(struct device *dev);
Dan Williams45def222015-04-26 19:26:48 -040044struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus);
Dan Williamse6dfb2d2015-04-25 03:56:17 -040045const 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);
Dan Williamsb94d5232015-05-19 22:54:31 -040049#endif /* __LIBNVDIMM_H__ */