Commit bb965401fd2afa26629b244e7bb2e48a117dc238
Committed by
Jesse Barnes
1 parent
c6a415761c
Exists in
master
and in
7 other branches
PCI: show dma_mask bits in /sys
So we can catch if the driver sets an incorrect dma_mask. Reviewed-by: Grant Grundler <grundler@google.com> Signed-off-by: Yinghai Lu <yinghai@kernel.org> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Showing 1 changed file with 17 additions and 0 deletions Side-by-side Diff
drivers/pci/pci-sysfs.c
... | ... | @@ -184,6 +184,21 @@ |
184 | 184 | #endif |
185 | 185 | |
186 | 186 | static ssize_t |
187 | +dma_mask_bits_show(struct device *dev, struct device_attribute *attr, char *buf) | |
188 | +{ | |
189 | + struct pci_dev *pdev = to_pci_dev(dev); | |
190 | + | |
191 | + return sprintf (buf, "%d\n", fls64(pdev->dma_mask)); | |
192 | +} | |
193 | + | |
194 | +static ssize_t | |
195 | +consistent_dma_mask_bits_show(struct device *dev, struct device_attribute *attr, | |
196 | + char *buf) | |
197 | +{ | |
198 | + return sprintf (buf, "%d\n", fls64(dev->coherent_dma_mask)); | |
199 | +} | |
200 | + | |
201 | +static ssize_t | |
187 | 202 | msi_bus_show(struct device *dev, struct device_attribute *attr, char *buf) |
188 | 203 | { |
189 | 204 | struct pci_dev *pdev = to_pci_dev(dev); |
... | ... | @@ -314,6 +329,8 @@ |
314 | 329 | #ifdef CONFIG_NUMA |
315 | 330 | __ATTR_RO(numa_node), |
316 | 331 | #endif |
332 | + __ATTR_RO(dma_mask_bits), | |
333 | + __ATTR_RO(consistent_dma_mask_bits), | |
317 | 334 | __ATTR(enable, 0600, is_enabled_show, is_enabled_store), |
318 | 335 | __ATTR(broken_parity_status,(S_IRUGO|S_IWUSR), |
319 | 336 | broken_parity_status_show,broken_parity_status_store), |