# HG changeset patch # User Yu Zhao # Date 1236909313 14400 # Node ID 66f3de153185eddae2d118d088ecfc17e96bf706 # Parent 8de852cacf43ac03f7f4819589bc22f62a8d1b3c Backport: PCI: export __pci_read_base() commit 0b400c7ed4d027e02f6231afa39852a2d48e6f25 Author: Yu Zhao Date: Sat Nov 22 02:40:40 2008 +0800 PCI: export __pci_read_base() Export __pci_read_base() so it can be used by whole PCI subsystem. Signed-off-by: Yu Zhao Signed-off-by: Jesse Barnes Signed-off-by: Yu Zhao diff -r 8de852cacf43 -r 66f3de153185 drivers/pci/pci.h --- a/drivers/pci/pci.h Thu Mar 12 21:53:36 2009 -0400 +++ b/drivers/pci/pci.h Thu Mar 12 21:55:13 2009 -0400 @@ -109,3 +109,13 @@ #ifdef CONFIG_PCI_GUESTDEV int pci_is_guestdev_to_reassign(struct pci_dev *dev); #endif /* CONFIG_PCI_GUESTDEV */ + +enum pci_bar_type { + pci_bar_unknown, /* Standard PCI BAR probe */ + pci_bar_io, /* An io port BAR */ + pci_bar_mem32, /* A 32-bit memory BAR */ + pci_bar_mem64, /* A 64-bit memory BAR */ +}; + +extern int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, + struct resource *res, unsigned int reg); diff -r 8de852cacf43 -r 66f3de153185 drivers/pci/probe.c --- a/drivers/pci/probe.c Thu Mar 12 21:53:36 2009 -0400 +++ b/drivers/pci/probe.c Thu Mar 12 21:55:13 2009 -0400 @@ -141,13 +141,6 @@ return size; } -enum pci_bar_type { - pci_bar_unknown, /* Standard PCI BAR probe */ - pci_bar_io, /* An io port BAR */ - pci_bar_mem32, /* A 32-bit memory BAR */ - pci_bar_mem64, /* A 64-bit memory BAR */ -}; - static inline enum pci_bar_type decode_bar(struct resource *res, u32 bar) { if ((bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_IO) { @@ -162,11 +155,16 @@ return pci_bar_mem32; } -/* - * If the type is not unknown, we assume that the lowest bit is 'enable'. - * Returns 1 if the BAR was 64-bit and 0 if it was 32-bit. +/** + * pci_read_base - read a PCI BAR + * @dev: the PCI device + * @type: type of the BAR + * @res: resource buffer to be filled in + * @pos: BAR position in the config space + * + * Returns 1 if the BAR is 64-bit, or 0 if 32-bit. */ -static int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, +int __pci_read_base(struct pci_dev *dev, enum pci_bar_type type, struct resource *res, unsigned int pos) { u32 l, sz, mask;