Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SPARC64]: Implement pci_resource_to_user()

This makes libpciaccess able to mmap() resources of the
device properly.

Signed-off-by: David S. Miller <davem@davemloft.net>

+20
+16
arch/sparc64/kernel/pci.c
··· 1275 1275 return (device_mask & dma_addr_mask) == dma_addr_mask; 1276 1276 } 1277 1277 1278 + void pci_resource_to_user(const struct pci_dev *pdev, int bar, 1279 + const struct resource *rp, resource_size_t *start, 1280 + resource_size_t *end) 1281 + { 1282 + struct pci_pbm_info *pbm = pdev->dev.archdata.host_controller; 1283 + unsigned long offset; 1284 + 1285 + if (rp->flags & IORESOURCE_IO) 1286 + offset = pbm->io_space.start; 1287 + else 1288 + offset = pbm->mem_space.start; 1289 + 1290 + *start = rp->start - offset; 1291 + *end = rp->end - offset; 1292 + } 1293 + 1278 1294 #endif /* !(CONFIG_PCI) */
+4
include/asm-sparc64/pci.h
··· 200 200 struct device_node; 201 201 extern struct device_node *pci_device_to_OF_node(struct pci_dev *pdev); 202 202 203 + #define HAVE_ARCH_PCI_RESOURCE_TO_USER 204 + extern void pci_resource_to_user(const struct pci_dev *dev, int bar, 205 + const struct resource *rsrc, 206 + resource_size_t *start, resource_size_t *end); 203 207 #endif /* __KERNEL__ */ 204 208 205 209 #endif /* __SPARC64_PCI_H */