diff options
Diffstat (limited to 'arch/s390/pci/pci.c')
| -rw-r--r-- | arch/s390/pci/pci.c | 21 | 
1 files changed, 13 insertions, 8 deletions
diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index c7fea9bea8cb..8e872951c07b 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -27,6 +27,7 @@  #include <linux/seq_file.h>  #include <linux/jump_label.h>  #include <linux/pci.h> +#include <linux/printk.h>  #include <asm/isc.h>  #include <asm/airq.h> @@ -43,7 +44,7 @@ static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES);  static DEFINE_SPINLOCK(zpci_domain_lock);  #define ZPCI_IOMAP_ENTRIES						\ -	min(((unsigned long) ZPCI_NR_DEVICES * PCI_BAR_COUNT / 2),	\ +	min(((unsigned long) ZPCI_NR_DEVICES * PCI_STD_NUM_BARS / 2),	\  	    ZPCI_IOMAP_MAX_ENTRIES)  static DEFINE_SPINLOCK(zpci_iomap_lock); @@ -294,7 +295,7 @@ static void __iomem *pci_iomap_range_mio(struct pci_dev *pdev, int bar,  void __iomem *pci_iomap_range(struct pci_dev *pdev, int bar,  			      unsigned long offset, unsigned long max)  { -	if (!pci_resource_len(pdev, bar) || bar >= PCI_BAR_COUNT) +	if (bar >= PCI_STD_NUM_BARS || !pci_resource_len(pdev, bar))  		return NULL;  	if (static_branch_likely(&have_mio)) @@ -324,7 +325,7 @@ static void __iomem *pci_iomap_wc_range_mio(struct pci_dev *pdev, int bar,  void __iomem *pci_iomap_wc_range(struct pci_dev *pdev, int bar,  				 unsigned long offset, unsigned long max)  { -	if (!pci_resource_len(pdev, bar) || bar >= PCI_BAR_COUNT) +	if (bar >= PCI_STD_NUM_BARS || !pci_resource_len(pdev, bar))  		return NULL;  	if (static_branch_likely(&have_mio)) @@ -416,7 +417,7 @@ static void zpci_map_resources(struct pci_dev *pdev)  	resource_size_t len;  	int i; -	for (i = 0; i < PCI_BAR_COUNT; i++) { +	for (i = 0; i < PCI_STD_NUM_BARS; i++) {  		len = pci_resource_len(pdev, i);  		if (!len)  			continue; @@ -451,7 +452,7 @@ static void zpci_unmap_resources(struct pci_dev *pdev)  	if (zpci_use_mio(zdev))  		return; -	for (i = 0; i < PCI_BAR_COUNT; i++) { +	for (i = 0; i < PCI_STD_NUM_BARS; i++) {  		len = pci_resource_len(pdev, i);  		if (!len)  			continue; @@ -514,7 +515,7 @@ static int zpci_setup_bus_resources(struct zpci_dev *zdev,  	snprintf(zdev->res_name, sizeof(zdev->res_name),  		 "PCI Bus %04x:%02x", zdev->domain, ZPCI_BUS_NR); -	for (i = 0; i < PCI_BAR_COUNT; i++) { +	for (i = 0; i < PCI_STD_NUM_BARS; i++) {  		if (!zdev->bars[i].size)  			continue;  		entry = zpci_alloc_iomap(zdev); @@ -551,7 +552,7 @@ static void zpci_cleanup_bus_resources(struct zpci_dev *zdev)  {  	int i; -	for (i = 0; i < PCI_BAR_COUNT; i++) { +	for (i = 0; i < PCI_STD_NUM_BARS; i++) {  		if (!zdev->bars[i].size || !zdev->bars[i].res)  			continue; @@ -573,7 +574,7 @@ int pcibios_add_device(struct pci_dev *pdev)  	pdev->dev.dma_ops = &s390_pci_dma_ops;  	zpci_map_resources(pdev); -	for (i = 0; i < PCI_BAR_COUNT; i++) { +	for (i = 0; i < PCI_STD_NUM_BARS; i++) {  		res = &pdev->resource[i];  		if (res->parent || !res->flags)  			continue; @@ -659,6 +660,8 @@ static int zpci_alloc_domain(struct zpci_dev *zdev)  		spin_lock(&zpci_domain_lock);  		if (test_bit(zdev->domain, zpci_domain)) {  			spin_unlock(&zpci_domain_lock); +			pr_err("Adding PCI function %08x failed because domain %04x is already assigned\n", +				zdev->fid, zdev->domain);  			return -EEXIST;  		}  		set_bit(zdev->domain, zpci_domain); @@ -670,6 +673,8 @@ static int zpci_alloc_domain(struct zpci_dev *zdev)  	zdev->domain = find_first_zero_bit(zpci_domain, ZPCI_NR_DEVICES);  	if (zdev->domain == ZPCI_NR_DEVICES) {  		spin_unlock(&zpci_domain_lock); +		pr_err("Adding PCI function %08x failed because the configured limit of %d is reached\n", +			zdev->fid, ZPCI_NR_DEVICES);  		return -ENOSPC;  	}  	set_bit(zdev->domain, zpci_domain);  |