Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 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__ |
Dan Williams | e6dfb2d | 2015-04-25 03:56:17 -0400 | [diff] [blame^] | 17 | |
| 18 | enum { |
| 19 | /* when a dimm supports both PMEM and BLK access a label is required */ |
| 20 | NDD_ALIASING = 1 << 0, |
| 21 | }; |
| 22 | |
Dan Williams | 45def22 | 2015-04-26 19:26:48 -0400 | [diff] [blame] | 23 | extern struct attribute_group nvdimm_bus_attribute_group; |
| 24 | |
Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 25 | struct nvdimm; |
| 26 | struct nvdimm_bus_descriptor; |
| 27 | typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, |
| 28 | struct nvdimm *nvdimm, unsigned int cmd, void *buf, |
| 29 | unsigned int buf_len); |
| 30 | |
| 31 | struct nvdimm_bus_descriptor { |
Dan Williams | 45def22 | 2015-04-26 19:26:48 -0400 | [diff] [blame] | 32 | const struct attribute_group **attr_groups; |
Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 33 | unsigned long dsm_mask; |
| 34 | char *provider_name; |
| 35 | ndctl_fn ndctl; |
| 36 | }; |
| 37 | |
| 38 | struct device; |
Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 39 | struct nvdimm_bus *nvdimm_bus_register(struct device *parent, |
| 40 | struct nvdimm_bus_descriptor *nfit_desc); |
| 41 | void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus); |
Dan Williams | 45def22 | 2015-04-26 19:26:48 -0400 | [diff] [blame] | 42 | struct nvdimm_bus *to_nvdimm_bus(struct device *dev); |
Dan Williams | e6dfb2d | 2015-04-25 03:56:17 -0400 | [diff] [blame^] | 43 | struct nvdimm *to_nvdimm(struct device *dev); |
Dan Williams | 45def22 | 2015-04-26 19:26:48 -0400 | [diff] [blame] | 44 | struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus); |
Dan Williams | e6dfb2d | 2015-04-25 03:56:17 -0400 | [diff] [blame^] | 45 | const char *nvdimm_name(struct nvdimm *nvdimm); |
| 46 | void *nvdimm_provider_data(struct nvdimm *nvdimm); |
| 47 | struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data, |
| 48 | const struct attribute_group **groups, unsigned long flags); |
Dan Williams | b94d523 | 2015-05-19 22:54:31 -0400 | [diff] [blame] | 49 | #endif /* __LIBNVDIMM_H__ */ |