diff options
-rw-r--r-- | drivers/acpi/nfit/core.c | 3 | ||||
-rw-r--r-- | drivers/nvdimm/btt.c | 1 | ||||
-rw-r--r-- | drivers/nvdimm/btt_devs.c | 20 | ||||
-rw-r--r-- | drivers/nvdimm/nd.h | 1 | ||||
-rw-r--r-- | tools/testing/nvdimm/test/nfit.c | 2 |
5 files changed, 26 insertions, 1 deletions
diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 8c234dd9b8bc..80cc7c089a15 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers/acpi/nfit/core.c | |||
@@ -1527,11 +1527,12 @@ static u32 read_blk_stat(struct nfit_blk *nfit_blk, unsigned int bw) | |||
1527 | { | 1527 | { |
1528 | struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; | 1528 | struct nfit_blk_mmio *mmio = &nfit_blk->mmio[DCR]; |
1529 | u64 offset = nfit_blk->stat_offset + mmio->size * bw; | 1529 | u64 offset = nfit_blk->stat_offset + mmio->size * bw; |
1530 | const u32 STATUS_MASK = 0x80000037; | ||
1530 | 1531 | ||
1531 | if (mmio->num_lines) | 1532 | if (mmio->num_lines) |
1532 | offset = to_interleave_offset(offset, mmio); | 1533 | offset = to_interleave_offset(offset, mmio); |
1533 | 1534 | ||
1534 | return readl(mmio->addr.base + offset); | 1535 | return readl(mmio->addr.base + offset) & STATUS_MASK; |
1535 | } | 1536 | } |
1536 | 1537 | ||
1537 | static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw, | 1538 | static void write_blk_ctl(struct nfit_blk *nfit_blk, unsigned int bw, |
diff --git a/drivers/nvdimm/btt.c b/drivers/nvdimm/btt.c index 88e91666f145..368795aad5c9 100644 --- a/drivers/nvdimm/btt.c +++ b/drivers/nvdimm/btt.c | |||
@@ -1269,6 +1269,7 @@ static int btt_blk_init(struct btt *btt) | |||
1269 | } | 1269 | } |
1270 | } | 1270 | } |
1271 | set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); | 1271 | set_capacity(btt->btt_disk, btt->nlba * btt->sector_size >> 9); |
1272 | btt->nd_btt->size = btt->nlba * (u64)btt->sector_size; | ||
1272 | revalidate_disk(btt->btt_disk); | 1273 | revalidate_disk(btt->btt_disk); |
1273 | 1274 | ||
1274 | return 0; | 1275 | return 0; |
diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index 3fa7919f94a8..97dd2925ed6e 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c | |||
@@ -140,10 +140,30 @@ static ssize_t namespace_store(struct device *dev, | |||
140 | } | 140 | } |
141 | static DEVICE_ATTR_RW(namespace); | 141 | static DEVICE_ATTR_RW(namespace); |
142 | 142 | ||
143 | static ssize_t size_show(struct device *dev, | ||
144 | struct device_attribute *attr, char *buf) | ||
145 | { | ||
146 | struct nd_btt *nd_btt = to_nd_btt(dev); | ||
147 | ssize_t rc; | ||
148 | |||
149 | device_lock(dev); | ||
150 | if (dev->driver) | ||
151 | rc = sprintf(buf, "%llu\n", nd_btt->size); | ||
152 | else { | ||
153 | /* no size to convey if the btt instance is disabled */ | ||
154 | rc = -ENXIO; | ||
155 | } | ||
156 | device_unlock(dev); | ||
157 | |||
158 | return rc; | ||
159 | } | ||
160 | static DEVICE_ATTR_RO(size); | ||
161 | |||
143 | static struct attribute *nd_btt_attributes[] = { | 162 | static struct attribute *nd_btt_attributes[] = { |
144 | &dev_attr_sector_size.attr, | 163 | &dev_attr_sector_size.attr, |
145 | &dev_attr_namespace.attr, | 164 | &dev_attr_namespace.attr, |
146 | &dev_attr_uuid.attr, | 165 | &dev_attr_uuid.attr, |
166 | &dev_attr_size.attr, | ||
147 | NULL, | 167 | NULL, |
148 | }; | 168 | }; |
149 | 169 | ||
diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h index 40476399d227..8024a0ef86d3 100644 --- a/drivers/nvdimm/nd.h +++ b/drivers/nvdimm/nd.h | |||
@@ -143,6 +143,7 @@ struct nd_btt { | |||
143 | struct nd_namespace_common *ndns; | 143 | struct nd_namespace_common *ndns; |
144 | struct btt *btt; | 144 | struct btt *btt; |
145 | unsigned long lbasize; | 145 | unsigned long lbasize; |
146 | u64 size; | ||
146 | u8 *uuid; | 147 | u8 *uuid; |
147 | int id; | 148 | int id; |
148 | }; | 149 | }; |
diff --git a/tools/testing/nvdimm/test/nfit.c b/tools/testing/nvdimm/test/nfit.c index 5404efa578a3..dd48f421844c 100644 --- a/tools/testing/nvdimm/test/nfit.c +++ b/tools/testing/nvdimm/test/nfit.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
15 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
16 | #include <linux/workqueue.h> | ||
16 | #include <linux/libnvdimm.h> | 17 | #include <linux/libnvdimm.h> |
17 | #include <linux/vmalloc.h> | 18 | #include <linux/vmalloc.h> |
18 | #include <linux/device.h> | 19 | #include <linux/device.h> |
@@ -1474,6 +1475,7 @@ static int nfit_test_probe(struct platform_device *pdev) | |||
1474 | if (nfit_test->setup != nfit_test0_setup) | 1475 | if (nfit_test->setup != nfit_test0_setup) |
1475 | return 0; | 1476 | return 0; |
1476 | 1477 | ||
1478 | flush_work(&acpi_desc->work); | ||
1477 | nfit_test->setup_hotplug = 1; | 1479 | nfit_test->setup_hotplug = 1; |
1478 | nfit_test->setup(nfit_test); | 1480 | nfit_test->setup(nfit_test); |
1479 | 1481 | ||