Commit e631c40f authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] ppc64: cleanups of ppc64 pci.c

This patch applies on top of previously posted "ppc64: Move PCI IO mapping
from pSeries_pci.c to pci.c".

It does cosmetic cleanups & add some debug macros to pci.c without actually
changing any functionality. Further patches against ppc64 pci.c that I'll
post will be against a file already patched with this one.
Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 38e27180
...@@ -11,6 +11,8 @@ ...@@ -11,6 +11,8 @@
* 2 of the License, or (at your option) any later version. * 2 of the License, or (at your option) any later version.
*/ */
#undef DEBUG
#include <linux/config.h> #include <linux/config.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/pci.h> #include <linux/pci.h>
...@@ -39,6 +41,12 @@ ...@@ -39,6 +41,12 @@
#include "pci.h" #include "pci.h"
#ifdef DEBUG
#define DBG(fmt...) udbg_printf(fmt)
#else
#define DBG(fmt...)
#endif
unsigned long pci_probe_only = 1; unsigned long pci_probe_only = 1;
unsigned long pci_assign_all_buses = 0; unsigned long pci_assign_all_buses = 0;
...@@ -106,11 +114,11 @@ static void fixup_windbond_82c105(struct pci_dev* dev) ...@@ -106,11 +114,11 @@ static void fixup_windbond_82c105(struct pci_dev* dev)
dev->resource[i].flags &= ~IORESOURCE_IO; dev->resource[i].flags &= ~IORESOURCE_IO;
} }
} }
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105, fixup_windbond_82c105); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_WINBOND, PCI_DEVICE_ID_WINBOND_82C105,
fixup_windbond_82c105);
void void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region, struct resource *res)
struct resource *res)
{ {
unsigned long offset = 0; unsigned long offset = 0;
struct pci_controller *hose = PCI_GET_PHB_PTR(dev); struct pci_controller *hose = PCI_GET_PHB_PTR(dev);
...@@ -215,8 +223,7 @@ static void phb_set_model(struct pci_controller *hose, ...@@ -215,8 +223,7 @@ static void phb_set_model(struct pci_controller *hose,
/* /*
* Allocate pci_controller(phb) initialized common variables. * Allocate pci_controller(phb) initialized common variables.
*/ */
struct pci_controller * __init struct pci_controller * __init pci_alloc_pci_controller(enum phb_types controller_type)
pci_alloc_pci_controller(enum phb_types controller_type)
{ {
struct pci_controller *hose; struct pci_controller *hose;
...@@ -246,8 +253,7 @@ pci_alloc_pci_controller(enum phb_types controller_type) ...@@ -246,8 +253,7 @@ pci_alloc_pci_controller(enum phb_types controller_type)
/* /*
* Dymnamically allocate pci_controller(phb), initialize common variables. * Dymnamically allocate pci_controller(phb), initialize common variables.
*/ */
struct pci_controller * struct pci_controller * pci_alloc_phb_dynamic(enum phb_types controller_type)
pci_alloc_phb_dynamic(enum phb_types controller_type)
{ {
struct pci_controller *hose; struct pci_controller *hose;
...@@ -430,9 +436,9 @@ int pci_name_bus(char *name, struct pci_bus *bus) ...@@ -430,9 +436,9 @@ int pci_name_bus(char *name, struct pci_bus *bus)
* *
* Returns negative error code on failure, zero on success. * Returns negative error code on failure, zero on success.
*/ */
static __inline__ int static __inline__ int __pci_mmap_make_offset(struct pci_dev *dev,
__pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state) enum pci_mmap_state mmap_state)
{ {
struct pci_controller *hose = PCI_GET_PHB_PTR(dev); struct pci_controller *hose = PCI_GET_PHB_PTR(dev);
unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; unsigned long offset = vma->vm_pgoff << PAGE_SHIFT;
...@@ -487,9 +493,9 @@ __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma, ...@@ -487,9 +493,9 @@ __pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
* Set vm_flags of VMA, as appropriate for this architecture, for a pci device * Set vm_flags of VMA, as appropriate for this architecture, for a pci device
* mapping. * mapping.
*/ */
static __inline__ void static __inline__ void __pci_mmap_set_flags(struct pci_dev *dev,
__pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state) enum pci_mmap_state mmap_state)
{ {
vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO; vma->vm_flags |= VM_SHM | VM_LOCKED | VM_IO;
} }
...@@ -498,9 +504,10 @@ __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma, ...@@ -498,9 +504,10 @@ __pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci * Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
* device mapping. * device mapping.
*/ */
static __inline__ void static __inline__ void __pci_mmap_set_pgprot(struct pci_dev *dev,
__pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vma, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine) enum pci_mmap_state mmap_state,
int write_combine)
{ {
long prot = pgprot_val(vma->vm_page_prot); long prot = pgprot_val(vma->vm_page_prot);
...@@ -613,7 +620,7 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node, ...@@ -613,7 +620,7 @@ static void __devinit pci_process_ISA_OF_ranges(struct device_node *isa_node,
} }
void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
struct device_node *dev) struct device_node *dev)
{ {
unsigned int *ranges; unsigned int *ranges;
unsigned long size; unsigned long size;
...@@ -654,6 +661,8 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, ...@@ -654,6 +661,8 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
res = &hose->io_resource; res = &hose->io_resource;
res->flags = IORESOURCE_IO; res->flags = IORESOURCE_IO;
res->start = pci_addr; res->start = pci_addr;
DBG("phb%d: IO 0x%lx -> 0x%lx\n", hose->global_number,
res->start, res->start + size - 1);
break; break;
case 2: /* memory space */ case 2: /* memory space */
memno = 0; memno = 0;
...@@ -666,6 +675,8 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose, ...@@ -666,6 +675,8 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
res = &hose->mem_resources[memno]; res = &hose->mem_resources[memno];
res->flags = IORESOURCE_MEM; res->flags = IORESOURCE_MEM;
res->start = cpu_phys_addr; res->start = cpu_phys_addr;
DBG("phb%d: MEM 0x%lx -> 0x%lx\n", hose->global_number,
res->start, res->start + size - 1);
} }
break; break;
} }
...@@ -873,7 +884,8 @@ void __devinit pcibios_fixup_device_resources(struct pci_dev *dev, ...@@ -873,7 +884,8 @@ void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,
for (i = 0; i < PCI_NUM_RESOURCES; i++) { for (i = 0; i < PCI_NUM_RESOURCES; i++) {
if (dev->resource[i].flags & IORESOURCE_IO) { if (dev->resource[i].flags & IORESOURCE_IO) {
unsigned long offset = (unsigned long)hose->io_base_virt - pci_io_base; unsigned long offset = (unsigned long)hose->io_base_virt
- pci_io_base;
unsigned long start, end, mask; unsigned long start, end, mask;
start = dev->resource[i].start += offset; start = dev->resource[i].start += offset;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment