Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 138442
b: refs/heads/master
c: c3bd517
h: refs/heads/master
v: v3
  • Loading branch information
Milton Miller authored and Benjamin Herrenschmidt committed Feb 11, 2009
1 parent 9e4a478 commit 4b622c8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 46 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6071ed0487c6ea8dcfadd9844b9b90944cd9de1e
refs/heads/master: c3bd517de67d33c44059656194e316facef181a5
41 changes: 35 additions & 6 deletions trunk/arch/powerpc/kernel/pci-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include <asm/eeh.h>

static DEFINE_SPINLOCK(hose_spinlock);
LIST_HEAD(hose_list);

/* XXX kill that some day ... */
static int global_phb_number; /* Global phb counter */
Expand Down Expand Up @@ -113,19 +114,24 @@ void pcibios_free_controller(struct pci_controller *phb)
kfree(phb);
}

static resource_size_t pcibios_io_size(const struct pci_controller *hose)
{
#ifdef CONFIG_PPC64
return hose->pci_io_size;
#else
return hose->io_resource.end - hose->io_resource.start + 1;
#endif
}

int pcibios_vaddr_is_ioport(void __iomem *address)
{
int ret = 0;
struct pci_controller *hose;
unsigned long size;
resource_size_t size;

spin_lock(&hose_spinlock);
list_for_each_entry(hose, &hose_list, list_node) {
#ifdef CONFIG_PPC64
size = hose->pci_io_size;
#else
size = hose->io_resource.end - hose->io_resource.start + 1;
#endif
size = pcibios_io_size(hose);
if (address >= hose->io_base_virt &&
address < (hose->io_base_virt + size)) {
ret = 1;
Expand All @@ -136,6 +142,29 @@ int pcibios_vaddr_is_ioport(void __iomem *address)
return ret;
}

unsigned long pci_address_to_pio(phys_addr_t address)
{
struct pci_controller *hose;
resource_size_t size;
unsigned long ret = ~0;

spin_lock(&hose_spinlock);
list_for_each_entry(hose, &hose_list, list_node) {
size = pcibios_io_size(hose);
if (address >= hose->io_base_phys &&
address < (hose->io_base_phys + size)) {
unsigned long base =
(unsigned long)hose->io_base_virt - _IO_BASE;
ret = base + (address - hose->io_base_phys);
break;
}
}
spin_unlock(&hose_spinlock);

return ret;
}
EXPORT_SYMBOL_GPL(pci_address_to_pio);

/*
* Return the domain number for this bus.
*/
Expand Down
21 changes: 1 addition & 20 deletions trunk/arch/powerpc/kernel/pci_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include <asm/prom.h>
#include <asm/sections.h>
#include <asm/pci-bridge.h>
#include <asm/ppc-pci.h>
#include <asm/byteorder.h>
#include <asm/uaccess.h>
#include <asm/machdep.h>
Expand All @@ -43,8 +44,6 @@ static u8* pci_to_OF_bus_map;
*/
static int pci_assign_all_buses;

LIST_HEAD(hose_list);

static int pci_bus_count;

/* This will remain NULL for now, until isa-bridge.c is made common
Expand Down Expand Up @@ -491,24 +490,6 @@ long sys_pciconfig_iobase(long which, unsigned long bus, unsigned long devfn)
return result;
}

unsigned long pci_address_to_pio(phys_addr_t address)
{
struct pci_controller *hose, *tmp;

list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
unsigned int size = hose->io_resource.end -
hose->io_resource.start + 1;
if (address >= hose->io_base_phys &&
address < (hose->io_base_phys + size)) {
unsigned long base =
(unsigned long)hose->io_base_virt - _IO_BASE;
return base + (address - hose->io_base_phys);
}
}
return (unsigned int)-1;
}
EXPORT_SYMBOL(pci_address_to_pio);

/*
* Null PCI config access functions, for the case when we can't
* find a hose.
Expand Down
19 changes: 0 additions & 19 deletions trunk/arch/powerpc/kernel/pci_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,6 @@ unsigned long pci_probe_only = 1;
unsigned long pci_io_base = ISA_IO_BASE;
EXPORT_SYMBOL(pci_io_base);

LIST_HEAD(hose_list);

static void fixup_broken_pcnet32(struct pci_dev* dev)
{
if ((dev->class>>8 == PCI_CLASS_NETWORK_ETHERNET)) {
Expand Down Expand Up @@ -524,23 +522,6 @@ int __devinit pcibios_map_io_space(struct pci_bus *bus)
}
EXPORT_SYMBOL_GPL(pcibios_map_io_space);

unsigned long pci_address_to_pio(phys_addr_t address)
{
struct pci_controller *hose, *tmp;

list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
if (address >= hose->io_base_phys &&
address < (hose->io_base_phys + hose->pci_io_size)) {
unsigned long base =
(unsigned long)hose->io_base_virt - _IO_BASE;
return base + (address - hose->io_base_phys);
}
}
return (unsigned int)-1;
}
EXPORT_SYMBOL_GPL(pci_address_to_pio);


#define IOBASE_BRIDGE_NUMBER 0
#define IOBASE_MEMORY 1
#define IOBASE_IO 2
Expand Down

0 comments on commit 4b622c8

Please sign in to comment.