blob: d375cdc4abd585ad767e3914203bdce19c2a2826 [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 Williams45def222015-04-26 19:26:48 -040017extern struct attribute_group nvdimm_bus_attribute_group;
18
Dan Williamsb94d5232015-05-19 22:54:31 -040019struct nvdimm;
20struct nvdimm_bus_descriptor;
21typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc,
22 struct nvdimm *nvdimm, unsigned int cmd, void *buf,
23 unsigned int buf_len);
24
25struct nvdimm_bus_descriptor {
Dan Williams45def222015-04-26 19:26:48 -040026 const struct attribute_group **attr_groups;
Dan Williamsb94d5232015-05-19 22:54:31 -040027 unsigned long dsm_mask;
28 char *provider_name;
29 ndctl_fn ndctl;
30};
31
32struct device;
Dan Williamsb94d5232015-05-19 22:54:31 -040033struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
34 struct nvdimm_bus_descriptor *nfit_desc);
35void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus);
Dan Williams45def222015-04-26 19:26:48 -040036struct nvdimm_bus *to_nvdimm_bus(struct device *dev);
37struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus);
Dan Williamsb94d5232015-05-19 22:54:31 -040038#endif /* __LIBNVDIMM_H__ */