diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/libnvdimm.h | 28 | ||||
| -rw-r--r-- | include/linux/nd.h | 8 | ||||
| -rw-r--r-- | include/uapi/linux/ndctl.h | 30 |
3 files changed, 32 insertions, 34 deletions
diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h index b519e137b9b7..f4947fda11e7 100644 --- a/include/linux/libnvdimm.h +++ b/include/linux/libnvdimm.h | |||
| @@ -50,23 +50,6 @@ typedef int (*ndctl_fn)(struct nvdimm_bus_descriptor *nd_desc, | |||
| 50 | struct nvdimm *nvdimm, unsigned int cmd, void *buf, | 50 | struct nvdimm *nvdimm, unsigned int cmd, void *buf, |
| 51 | unsigned int buf_len, int *cmd_rc); | 51 | unsigned int buf_len, int *cmd_rc); |
| 52 | 52 | ||
| 53 | struct nd_namespace_label; | ||
| 54 | struct nvdimm_drvdata; | ||
| 55 | |||
| 56 | struct nd_mapping { | ||
| 57 | struct nvdimm *nvdimm; | ||
| 58 | struct nd_namespace_label **labels; | ||
| 59 | u64 start; | ||
| 60 | u64 size; | ||
| 61 | /* | ||
| 62 | * @ndd is for private use at region enable / disable time for | ||
| 63 | * get_ndd() + put_ndd(), all other nd_mapping to ndd | ||
| 64 | * conversions use to_ndd() which respects enabled state of the | ||
| 65 | * nvdimm. | ||
| 66 | */ | ||
| 67 | struct nvdimm_drvdata *ndd; | ||
| 68 | }; | ||
| 69 | |||
| 70 | struct nvdimm_bus_descriptor { | 53 | struct nvdimm_bus_descriptor { |
| 71 | const struct attribute_group **attr_groups; | 54 | const struct attribute_group **attr_groups; |
| 72 | unsigned long cmd_mask; | 55 | unsigned long cmd_mask; |
| @@ -89,9 +72,15 @@ struct nd_interleave_set { | |||
| 89 | u64 cookie; | 72 | u64 cookie; |
| 90 | }; | 73 | }; |
| 91 | 74 | ||
| 75 | struct nd_mapping_desc { | ||
| 76 | struct nvdimm *nvdimm; | ||
| 77 | u64 start; | ||
| 78 | u64 size; | ||
| 79 | }; | ||
| 80 | |||
| 92 | struct nd_region_desc { | 81 | struct nd_region_desc { |
| 93 | struct resource *res; | 82 | struct resource *res; |
| 94 | struct nd_mapping *nd_mapping; | 83 | struct nd_mapping_desc *mapping; |
| 95 | u16 num_mappings; | 84 | u16 num_mappings; |
| 96 | const struct attribute_group **attr_groups; | 85 | const struct attribute_group **attr_groups; |
| 97 | struct nd_interleave_set *nd_set; | 86 | struct nd_interleave_set *nd_set; |
| @@ -129,6 +118,8 @@ static inline struct nd_blk_region_desc *to_blk_region_desc( | |||
| 129 | } | 118 | } |
| 130 | 119 | ||
| 131 | int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length); | 120 | int nvdimm_bus_add_poison(struct nvdimm_bus *nvdimm_bus, u64 addr, u64 length); |
| 121 | void nvdimm_clear_from_poison_list(struct nvdimm_bus *nvdimm_bus, | ||
| 122 | phys_addr_t start, unsigned int len); | ||
| 132 | struct nvdimm_bus *nvdimm_bus_register(struct device *parent, | 123 | struct nvdimm_bus *nvdimm_bus_register(struct device *parent, |
| 133 | struct nvdimm_bus_descriptor *nfit_desc); | 124 | struct nvdimm_bus_descriptor *nfit_desc); |
| 134 | void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus); | 125 | void nvdimm_bus_unregister(struct nvdimm_bus *nvdimm_bus); |
| @@ -139,6 +130,7 @@ struct nd_blk_region *to_nd_blk_region(struct device *dev); | |||
| 139 | struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus); | 130 | struct nvdimm_bus_descriptor *to_nd_desc(struct nvdimm_bus *nvdimm_bus); |
| 140 | struct device *to_nvdimm_bus_dev(struct nvdimm_bus *nvdimm_bus); | 131 | struct device *to_nvdimm_bus_dev(struct nvdimm_bus *nvdimm_bus); |
| 141 | const char *nvdimm_name(struct nvdimm *nvdimm); | 132 | const char *nvdimm_name(struct nvdimm *nvdimm); |
| 133 | struct kobject *nvdimm_kobj(struct nvdimm *nvdimm); | ||
| 142 | unsigned long nvdimm_cmd_mask(struct nvdimm *nvdimm); | 134 | unsigned long nvdimm_cmd_mask(struct nvdimm *nvdimm); |
| 143 | void *nvdimm_provider_data(struct nvdimm *nvdimm); | 135 | void *nvdimm_provider_data(struct nvdimm *nvdimm); |
| 144 | struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data, | 136 | struct nvdimm *nvdimm_create(struct nvdimm_bus *nvdimm_bus, void *provider_data, |
diff --git a/include/linux/nd.h b/include/linux/nd.h index f1ea426d6a5e..fa66aeed441a 100644 --- a/include/linux/nd.h +++ b/include/linux/nd.h | |||
| @@ -77,11 +77,13 @@ struct nd_namespace_io { | |||
| 77 | * @nsio: device and system physical address range to drive | 77 | * @nsio: device and system physical address range to drive |
| 78 | * @alt_name: namespace name supplied in the dimm label | 78 | * @alt_name: namespace name supplied in the dimm label |
| 79 | * @uuid: namespace name supplied in the dimm label | 79 | * @uuid: namespace name supplied in the dimm label |
| 80 | * @id: ida allocated id | ||
| 80 | */ | 81 | */ |
| 81 | struct nd_namespace_pmem { | 82 | struct nd_namespace_pmem { |
| 82 | struct nd_namespace_io nsio; | 83 | struct nd_namespace_io nsio; |
| 83 | char *alt_name; | 84 | char *alt_name; |
| 84 | u8 *uuid; | 85 | u8 *uuid; |
| 86 | int id; | ||
| 85 | }; | 87 | }; |
| 86 | 88 | ||
| 87 | /** | 89 | /** |
| @@ -105,19 +107,19 @@ struct nd_namespace_blk { | |||
| 105 | struct resource **res; | 107 | struct resource **res; |
| 106 | }; | 108 | }; |
| 107 | 109 | ||
| 108 | static inline struct nd_namespace_io *to_nd_namespace_io(struct device *dev) | 110 | static inline struct nd_namespace_io *to_nd_namespace_io(const struct device *dev) |
| 109 | { | 111 | { |
| 110 | return container_of(dev, struct nd_namespace_io, common.dev); | 112 | return container_of(dev, struct nd_namespace_io, common.dev); |
| 111 | } | 113 | } |
| 112 | 114 | ||
| 113 | static inline struct nd_namespace_pmem *to_nd_namespace_pmem(struct device *dev) | 115 | static inline struct nd_namespace_pmem *to_nd_namespace_pmem(const struct device *dev) |
| 114 | { | 116 | { |
| 115 | struct nd_namespace_io *nsio = to_nd_namespace_io(dev); | 117 | struct nd_namespace_io *nsio = to_nd_namespace_io(dev); |
| 116 | 118 | ||
| 117 | return container_of(nsio, struct nd_namespace_pmem, nsio); | 119 | return container_of(nsio, struct nd_namespace_pmem, nsio); |
| 118 | } | 120 | } |
| 119 | 121 | ||
| 120 | static inline struct nd_namespace_blk *to_nd_namespace_blk(struct device *dev) | 122 | static inline struct nd_namespace_blk *to_nd_namespace_blk(const struct device *dev) |
| 121 | { | 123 | { |
| 122 | return container_of(dev, struct nd_namespace_blk, common.dev); | 124 | return container_of(dev, struct nd_namespace_blk, common.dev); |
| 123 | } | 125 | } |
diff --git a/include/uapi/linux/ndctl.h b/include/uapi/linux/ndctl.h index ba5a8c79652a..ede5c6a62164 100644 --- a/include/uapi/linux/ndctl.h +++ b/include/uapi/linux/ndctl.h | |||
| @@ -21,14 +21,16 @@ struct nd_cmd_smart { | |||
| 21 | } __packed; | 21 | } __packed; |
| 22 | 22 | ||
| 23 | #define ND_SMART_HEALTH_VALID (1 << 0) | 23 | #define ND_SMART_HEALTH_VALID (1 << 0) |
| 24 | #define ND_SMART_TEMP_VALID (1 << 1) | 24 | #define ND_SMART_SPARES_VALID (1 << 1) |
| 25 | #define ND_SMART_SPARES_VALID (1 << 2) | 25 | #define ND_SMART_USED_VALID (1 << 2) |
| 26 | #define ND_SMART_ALARM_VALID (1 << 3) | 26 | #define ND_SMART_TEMP_VALID (1 << 3) |
| 27 | #define ND_SMART_USED_VALID (1 << 4) | 27 | #define ND_SMART_CTEMP_VALID (1 << 4) |
| 28 | #define ND_SMART_SHUTDOWN_VALID (1 << 5) | 28 | #define ND_SMART_ALARM_VALID (1 << 9) |
| 29 | #define ND_SMART_VENDOR_VALID (1 << 6) | 29 | #define ND_SMART_SHUTDOWN_VALID (1 << 10) |
| 30 | #define ND_SMART_TEMP_TRIP (1 << 0) | 30 | #define ND_SMART_VENDOR_VALID (1 << 11) |
| 31 | #define ND_SMART_SPARE_TRIP (1 << 1) | 31 | #define ND_SMART_SPARE_TRIP (1 << 0) |
| 32 | #define ND_SMART_TEMP_TRIP (1 << 1) | ||
| 33 | #define ND_SMART_CTEMP_TRIP (1 << 2) | ||
| 32 | #define ND_SMART_NON_CRITICAL_HEALTH (1 << 0) | 34 | #define ND_SMART_NON_CRITICAL_HEALTH (1 << 0) |
| 33 | #define ND_SMART_CRITICAL_HEALTH (1 << 1) | 35 | #define ND_SMART_CRITICAL_HEALTH (1 << 1) |
| 34 | #define ND_SMART_FATAL_HEALTH (1 << 2) | 36 | #define ND_SMART_FATAL_HEALTH (1 << 2) |
| @@ -37,14 +39,15 @@ struct nd_smart_payload { | |||
| 37 | __u32 flags; | 39 | __u32 flags; |
| 38 | __u8 reserved0[4]; | 40 | __u8 reserved0[4]; |
| 39 | __u8 health; | 41 | __u8 health; |
| 40 | __u16 temperature; | ||
| 41 | __u8 spares; | 42 | __u8 spares; |
| 42 | __u8 alarm_flags; | ||
| 43 | __u8 life_used; | 43 | __u8 life_used; |
| 44 | __u8 alarm_flags; | ||
| 45 | __u16 temperature; | ||
| 46 | __u16 ctrl_temperature; | ||
| 47 | __u8 reserved1[15]; | ||
| 44 | __u8 shutdown_state; | 48 | __u8 shutdown_state; |
| 45 | __u8 reserved1; | ||
| 46 | __u32 vendor_size; | 49 | __u32 vendor_size; |
| 47 | __u8 vendor_data[108]; | 50 | __u8 vendor_data[92]; |
| 48 | } __packed; | 51 | } __packed; |
| 49 | 52 | ||
| 50 | struct nd_cmd_smart_threshold { | 53 | struct nd_cmd_smart_threshold { |
| @@ -53,7 +56,8 @@ struct nd_cmd_smart_threshold { | |||
| 53 | } __packed; | 56 | } __packed; |
| 54 | 57 | ||
| 55 | struct nd_smart_threshold_payload { | 58 | struct nd_smart_threshold_payload { |
| 56 | __u16 alarm_control; | 59 | __u8 alarm_control; |
| 60 | __u8 reserved0; | ||
| 57 | __u16 temperature; | 61 | __u16 temperature; |
| 58 | __u8 spares; | 62 | __u8 spares; |
| 59 | __u8 reserved[3]; | 63 | __u8 reserved[3]; |
