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 @@
* 2 of the License, or (at your option) any later version.
*/
#undef DEBUG
#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/pci.h>
......@@ -39,6 +41,12 @@
#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_assign_all_buses = 0;
......@@ -106,10 +114,10 @@ static void fixup_windbond_82c105(struct pci_dev* dev)
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
pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
void pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
struct resource *res)
{
unsigned long offset = 0;
......@@ -215,8 +223,7 @@ static void phb_set_model(struct pci_controller *hose,
/*
* Allocate pci_controller(phb) initialized common variables.
*/
struct pci_controller * __init
pci_alloc_pci_controller(enum phb_types controller_type)
struct pci_controller * __init pci_alloc_pci_controller(enum phb_types controller_type)
{
struct pci_controller *hose;
......@@ -246,8 +253,7 @@ pci_alloc_pci_controller(enum phb_types controller_type)
/*
* Dymnamically allocate pci_controller(phb), initialize common variables.
*/
struct pci_controller *
pci_alloc_phb_dynamic(enum phb_types controller_type)
struct pci_controller * pci_alloc_phb_dynamic(enum phb_types controller_type)
{
struct pci_controller *hose;
......@@ -430,8 +436,8 @@ int pci_name_bus(char *name, struct pci_bus *bus)
*
* Returns negative error code on failure, zero on success.
*/
static __inline__ int
__pci_mmap_make_offset(struct pci_dev *dev, struct vm_area_struct *vma,
static __inline__ int __pci_mmap_make_offset(struct pci_dev *dev,
struct vm_area_struct *vma,
enum pci_mmap_state mmap_state)
{
struct pci_controller *hose = PCI_GET_PHB_PTR(dev);
......@@ -487,8 +493,8 @@ __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
* mapping.
*/
static __inline__ void
__pci_mmap_set_flags(struct pci_dev *dev, struct vm_area_struct *vma,
static __inline__ void __pci_mmap_set_flags(struct pci_dev *dev,
struct vm_area_struct *vma,
enum pci_mmap_state mmap_state)
{
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,
* Set vm_page_prot of VMA, as appropriate for this architecture, for a pci
* device mapping.
*/
static __inline__ void
__pci_mmap_set_pgprot(struct pci_dev *dev, struct vm_area_struct *vma,
enum pci_mmap_state mmap_state, int write_combine)
static __inline__ void __pci_mmap_set_pgprot(struct pci_dev *dev,
struct vm_area_struct *vma,
enum pci_mmap_state mmap_state,
int write_combine)
{
long prot = pgprot_val(vma->vm_page_prot);
......@@ -654,6 +661,8 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
res = &hose->io_resource;
res->flags = IORESOURCE_IO;
res->start = pci_addr;
DBG("phb%d: IO 0x%lx -> 0x%lx\n", hose->global_number,
res->start, res->start + size - 1);
break;
case 2: /* memory space */
memno = 0;
......@@ -666,6 +675,8 @@ void __devinit pci_process_bridge_OF_ranges(struct pci_controller *hose,
res = &hose->mem_resources[memno];
res->flags = IORESOURCE_MEM;
res->start = cpu_phys_addr;
DBG("phb%d: MEM 0x%lx -> 0x%lx\n", hose->global_number,
res->start, res->start + size - 1);
}
break;
}
......@@ -873,7 +884,8 @@ void __devinit pcibios_fixup_device_resources(struct pci_dev *dev,
for (i = 0; i < PCI_NUM_RESOURCES; i++) {
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;
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