diff options
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index deeab19d7d10..7e9c0f3936dd 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -2201,6 +2201,28 @@ int pci_select_bars(struct pci_dev *dev, unsigned long flags) | |||
2201 | return bars; | 2201 | return bars; |
2202 | } | 2202 | } |
2203 | 2203 | ||
2204 | /** | ||
2205 | * pci_resource_bar - get position of the BAR associated with a resource | ||
2206 | * @dev: the PCI device | ||
2207 | * @resno: the resource number | ||
2208 | * @type: the BAR type to be filled in | ||
2209 | * | ||
2210 | * Returns BAR position in config space, or 0 if the BAR is invalid. | ||
2211 | */ | ||
2212 | int pci_resource_bar(struct pci_dev *dev, int resno, enum pci_bar_type *type) | ||
2213 | { | ||
2214 | if (resno < PCI_ROM_RESOURCE) { | ||
2215 | *type = pci_bar_unknown; | ||
2216 | return PCI_BASE_ADDRESS_0 + 4 * resno; | ||
2217 | } else if (resno == PCI_ROM_RESOURCE) { | ||
2218 | *type = pci_bar_mem32; | ||
2219 | return dev->rom_base_reg; | ||
2220 | } | ||
2221 | |||
2222 | dev_err(&dev->dev, "BAR: invalid resource #%d\n", resno); | ||
2223 | return 0; | ||
2224 | } | ||
2225 | |||
2204 | static void __devinit pci_no_domains(void) | 2226 | static void __devinit pci_no_domains(void) |
2205 | { | 2227 | { |
2206 | #ifdef CONFIG_PCI_DOMAINS | 2228 | #ifdef CONFIG_PCI_DOMAINS |