aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2016-04-28 19:17:07 -0400
committerDan Williams <dan.j.williams@intel.com>2016-04-28 19:23:16 -0400
commite3654eca70d63704c94a60a2aafc0b3c7b46a00b (patch)
tree2e2d1c136d04f1918908b841a45de2c551f01533 /drivers/acpi
parent40abf9be8f52d440e442206182916e3dcc68f722 (diff)
nfit, libnvdimm: clarify "commands" vs "_DSMs"
Clarify the distinction between "commands", the ioctls userspace calls to request the kernel take some action on a given dimm device, and "_DSMs", the actual function numbers used in the firmware interface to the DIMM. _DSMs are ACPI specific whereas commands are Linux kernel generic. This is in preparation for breaking the 1:1 implicit relationship between the kernel ioctl number space and the firmware specific function numbers. Cc: Jerry Hoemann <jerry.hoemann@hpe.com> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/nfit.c21
-rw-r--r--drivers/acpi/nfit.h4
2 files changed, 15 insertions, 10 deletions
diff --git a/drivers/acpi/nfit.c b/drivers/acpi/nfit.c
index d0f35e63640b..1b98e9dc6138 100644
--- a/drivers/acpi/nfit.c
+++ b/drivers/acpi/nfit.c
@@ -175,7 +175,7 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
175 union acpi_object in_obj, in_buf, *out_obj; 175 union acpi_object in_obj, in_buf, *out_obj;
176 struct device *dev = acpi_desc->dev; 176 struct device *dev = acpi_desc->dev;
177 const char *cmd_name, *dimm_name; 177 const char *cmd_name, *dimm_name;
178 unsigned long dsm_mask; 178 unsigned long cmd_mask;
179 acpi_handle handle; 179 acpi_handle handle;
180 const u8 *uuid; 180 const u8 *uuid;
181 u32 offset; 181 u32 offset;
@@ -189,7 +189,7 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
189 return -ENOTTY; 189 return -ENOTTY;
190 dimm_name = nvdimm_name(nvdimm); 190 dimm_name = nvdimm_name(nvdimm);
191 cmd_name = nvdimm_cmd_name(cmd); 191 cmd_name = nvdimm_cmd_name(cmd);
192 dsm_mask = nfit_mem->dsm_mask; 192 cmd_mask = nvdimm_cmd_mask(nvdimm);
193 desc = nd_cmd_dimm_desc(cmd); 193 desc = nd_cmd_dimm_desc(cmd);
194 uuid = to_nfit_uuid(NFIT_DEV_DIMM); 194 uuid = to_nfit_uuid(NFIT_DEV_DIMM);
195 handle = adev->handle; 195 handle = adev->handle;
@@ -197,7 +197,7 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
197 struct acpi_device *adev = to_acpi_dev(acpi_desc); 197 struct acpi_device *adev = to_acpi_dev(acpi_desc);
198 198
199 cmd_name = nvdimm_bus_cmd_name(cmd); 199 cmd_name = nvdimm_bus_cmd_name(cmd);
200 dsm_mask = nd_desc->dsm_mask; 200 cmd_mask = nd_desc->cmd_mask;
201 desc = nd_cmd_bus_desc(cmd); 201 desc = nd_cmd_bus_desc(cmd);
202 uuid = to_nfit_uuid(NFIT_DEV_BUS); 202 uuid = to_nfit_uuid(NFIT_DEV_BUS);
203 handle = adev->handle; 203 handle = adev->handle;
@@ -207,7 +207,7 @@ static int acpi_nfit_ctl(struct nvdimm_bus_descriptor *nd_desc,
207 if (!desc || (cmd && (desc->out_num + desc->in_num == 0))) 207 if (!desc || (cmd && (desc->out_num + desc->in_num == 0)))
208 return -ENOTTY; 208 return -ENOTTY;
209 209
210 if (!test_bit(cmd, &dsm_mask)) 210 if (!test_bit(cmd, &cmd_mask))
211 return -ENOTTY; 211 return -ENOTTY;
212 212
213 in_obj.type = ACPI_TYPE_PACKAGE; 213 in_obj.type = ACPI_TYPE_PACKAGE;
@@ -926,7 +926,8 @@ static int acpi_nfit_add_dimm(struct acpi_nfit_desc *acpi_desc,
926 const u8 *uuid = to_nfit_uuid(NFIT_DEV_DIMM); 926 const u8 *uuid = to_nfit_uuid(NFIT_DEV_DIMM);
927 int i; 927 int i;
928 928
929 nfit_mem->dsm_mask = acpi_desc->dimm_dsm_force_en; 929 /* nfit test assumes 1:1 relationship between commands and dsms */
930 nfit_mem->dsm_mask = acpi_desc->dimm_cmd_force_en;
930 adev = to_acpi_dev(acpi_desc); 931 adev = to_acpi_dev(acpi_desc);
931 if (!adev) 932 if (!adev)
932 return 0; 933 return 0;
@@ -976,9 +977,13 @@ static int acpi_nfit_register_dimms(struct acpi_nfit_desc *acpi_desc)
976 if (rc) 977 if (rc)
977 continue; 978 continue;
978 979
980 /*
981 * For now there is 1:1 relationship between cmd_mask and
982 * dsm_mask.
983 */
979 nvdimm = nvdimm_create(acpi_desc->nvdimm_bus, nfit_mem, 984 nvdimm = nvdimm_create(acpi_desc->nvdimm_bus, nfit_mem,
980 acpi_nfit_dimm_attribute_groups, 985 acpi_nfit_dimm_attribute_groups,
981 flags, &nfit_mem->dsm_mask); 986 flags, nfit_mem->dsm_mask);
982 if (!nvdimm) 987 if (!nvdimm)
983 return -ENOMEM; 988 return -ENOMEM;
984 989
@@ -1007,14 +1012,14 @@ static void acpi_nfit_init_dsms(struct acpi_nfit_desc *acpi_desc)
1007 struct acpi_device *adev; 1012 struct acpi_device *adev;
1008 int i; 1013 int i;
1009 1014
1010 nd_desc->dsm_mask = acpi_desc->bus_dsm_force_en; 1015 nd_desc->cmd_mask = acpi_desc->bus_cmd_force_en;
1011 adev = to_acpi_dev(acpi_desc); 1016 adev = to_acpi_dev(acpi_desc);
1012 if (!adev) 1017 if (!adev)
1013 return; 1018 return;
1014 1019
1015 for (i = ND_CMD_ARS_CAP; i <= ND_CMD_CLEAR_ERROR; i++) 1020 for (i = ND_CMD_ARS_CAP; i <= ND_CMD_CLEAR_ERROR; i++)
1016 if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i)) 1021 if (acpi_check_dsm(adev->handle, uuid, 1, 1ULL << i))
1017 set_bit(i, &nd_desc->dsm_mask); 1022 set_bit(i, &nd_desc->cmd_mask);
1018} 1023}
1019 1024
1020static ssize_t range_index_show(struct device *dev, 1025static ssize_t range_index_show(struct device *dev,
diff --git a/drivers/acpi/nfit.h b/drivers/acpi/nfit.h
index c75576b2d50e..332ee6f01662 100644
--- a/drivers/acpi/nfit.h
+++ b/drivers/acpi/nfit.h
@@ -132,8 +132,8 @@ struct acpi_nfit_desc {
132 size_t ars_status_size; 132 size_t ars_status_size;
133 struct work_struct work; 133 struct work_struct work;
134 unsigned int cancel:1; 134 unsigned int cancel:1;
135 unsigned long dimm_dsm_force_en; 135 unsigned long dimm_cmd_force_en;
136 unsigned long bus_dsm_force_en; 136 unsigned long bus_cmd_force_en;
137 int (*blk_do_io)(struct nd_blk_region *ndbr, resource_size_t dpa, 137 int (*blk_do_io)(struct nd_blk_region *ndbr, resource_size_t dpa,
138 void *iobuf, u64 len, int rw); 138 void *iobuf, u64 len, int rw);
139}; 139};