diff options
Diffstat (limited to 'arch/ppc/kernel/pci.c')
| -rw-r--r-- | arch/ppc/kernel/pci.c | 21 | 
1 files changed, 19 insertions, 2 deletions
| diff --git a/arch/ppc/kernel/pci.c b/arch/ppc/kernel/pci.c index 6d7b92d72458..70cfb6ffd877 100644 --- a/arch/ppc/kernel/pci.c +++ b/arch/ppc/kernel/pci.c | |||
| @@ -1495,7 +1495,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
| 1495 | *offset += hose->pci_mem_offset; | 1495 | *offset += hose->pci_mem_offset; | 
| 1496 | res_bit = IORESOURCE_MEM; | 1496 | res_bit = IORESOURCE_MEM; | 
| 1497 | } else { | 1497 | } else { | 
| 1498 | io_offset = (unsigned long)hose->io_base_virt; | 1498 | io_offset = hose->io_base_virt - ___IO_BASE; | 
| 1499 | *offset += io_offset; | 1499 | *offset += io_offset; | 
| 1500 | res_bit = IORESOURCE_IO; | 1500 | res_bit = IORESOURCE_IO; | 
| 1501 | } | 1501 | } | 
| @@ -1522,7 +1522,7 @@ static struct resource *__pci_mmap_make_offset(struct pci_dev *dev, | |||
| 1522 | 1522 | ||
| 1523 | /* found it! construct the final physical address */ | 1523 | /* found it! construct the final physical address */ | 
| 1524 | if (mmap_state == pci_mmap_io) | 1524 | if (mmap_state == pci_mmap_io) | 
| 1525 | *offset += hose->io_base_phys - _IO_BASE; | 1525 | *offset += hose->io_base_phys - io_offset; | 
| 1526 | return rp; | 1526 | return rp; | 
| 1527 | } | 1527 | } | 
| 1528 | 1528 | ||
| @@ -1739,6 +1739,23 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn) | |||
| 1739 | return result; | 1739 | return result; | 
| 1740 | } | 1740 | } | 
| 1741 | 1741 | ||
| 1742 | void pci_resource_to_user(const struct pci_dev *dev, int bar, | ||
| 1743 | const struct resource *rsrc, | ||
| 1744 | u64 *start, u64 *end) | ||
| 1745 | { | ||
| 1746 | struct pci_controller *hose = pci_bus_to_hose(dev->bus->number); | ||
| 1747 | unsigned long offset = 0; | ||
| 1748 | |||
| 1749 | if (hose == NULL) | ||
| 1750 | return; | ||
| 1751 | |||
| 1752 | if (rsrc->flags & IORESOURCE_IO) | ||
| 1753 | offset = ___IO_BASE - hose->io_base_virt + hose->io_base_phys; | ||
| 1754 | |||
| 1755 | *start = rsrc->start + offset; | ||
| 1756 | *end = rsrc->end + offset; | ||
| 1757 | } | ||
| 1758 | |||
| 1742 | void __init | 1759 | void __init | 
| 1743 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, | 1760 | pci_init_resource(struct resource *res, unsigned long start, unsigned long end, | 
| 1744 | int flags, char *name) | 1761 | int flags, char *name) | 
