From 315737fcdf438f1ed1d312ce818984ef5beaa76d Mon Sep 17 00:00:00 2001 From: Tejun Heo Date: Wed, 12 Mar 2008 15:26:34 +0900 Subject: [PATCH] --- yaml --- r: 87421 b: refs/heads/master c: 916fbfb7ae5f8c8f86399794d89e6d273df8826b h: refs/heads/master i: 87419: d01debb48ec4ebf849cc0996e5c75e63a7db5704 v: v3 --- [refs] | 2 +- trunk/include/linux/pci.h | 2 ++ trunk/lib/devres.c | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index f1277fcb3bd5..a415f5bdb11f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 233f112042d0b50170212dbff99c3b34b8773cd3 +refs/heads/master: 916fbfb7ae5f8c8f86399794d89e6d273df8826b diff --git a/trunk/include/linux/pci.h b/trunk/include/linux/pci.h index 9010f5458767..b7e4b633c69b 100644 --- a/trunk/include/linux/pci.h +++ b/trunk/include/linux/pci.h @@ -1045,6 +1045,8 @@ void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen); void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr); void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name); +int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask, + const char *name); void pcim_iounmap_regions(struct pci_dev *pdev, u16 mask); extern int pci_pci_problems; diff --git a/trunk/lib/devres.c b/trunk/lib/devres.c index b1d336ce7f3d..edc27a5d1b73 100644 --- a/trunk/lib/devres.c +++ b/trunk/lib/devres.c @@ -297,6 +297,31 @@ int pcim_iomap_regions(struct pci_dev *pdev, u16 mask, const char *name) } EXPORT_SYMBOL(pcim_iomap_regions); +/** + * pcim_iomap_regions_request_all - Request all BARs and iomap specified ones + * @pdev: PCI device to map IO resources for + * @mask: Mask of BARs to iomap + * @name: Name used when requesting regions + * + * Request all PCI BARs and iomap regions specified by @mask. + */ +int pcim_iomap_regions_request_all(struct pci_dev *pdev, u16 mask, + const char *name) +{ + int request_mask = ((1 << 6) - 1) & ~mask; + int rc; + + rc = pci_request_selected_regions(pdev, request_mask, name); + if (rc) + return rc; + + rc = pcim_iomap_regions(pdev, mask, name); + if (rc) + pci_release_selected_regions(pdev, request_mask); + return rc; +} +EXPORT_SYMBOL(pcim_iomap_regions_request_all); + /** * pcim_iounmap_regions - Unmap and release PCI BARs * @pdev: PCI device to map IO resources for