Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions | Variables
pci-common.c File Reference
#include <linux/kernel.h>
#include <linux/pci.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/bootmem.h>
#include <linux/mm.h>
#include <linux/list.h>
#include <linux/syscalls.h>
#include <linux/irq.h>
#include <linux/vmalloc.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/of_pci.h>
#include <linux/export.h>
#include <asm/processor.h>
#include <asm/io.h>
#include <asm/pci-bridge.h>
#include <asm/byteorder.h>

Go to the source code of this file.


#define NULL_PCI_OP(rw, size, type)
#define EARLY_PCI_OP(rw, size, type)


 LIST_HEAD (hose_list)
void set_pci_dma_ops (struct dma_map_ops *dma_ops)
struct dma_map_opsget_pci_dma_ops (void)
 EXPORT_SYMBOL (get_pci_dma_ops)
struct pci_controllerpcibios_alloc_controller (struct device_node *dev)
void pcibios_free_controller (struct pci_controller *phb)
int pcibios_vaddr_is_ioport (void __iomem *address)
unsigned long pci_address_to_pio (phys_addr_t address)
 EXPORT_SYMBOL_GPL (pci_address_to_pio)
int pci_domain_nr (struct pci_bus *bus)
 EXPORT_SYMBOL (pci_domain_nr)
struct pci_controllerpci_find_hose_for_OF_device (struct device_node *node)
int pcibios_add_platform_entries (struct pci_dev *pdev)
void pcibios_set_master (struct pci_dev *dev)
int pci_read_irq_line (struct pci_dev *pci_dev)
 EXPORT_SYMBOL (pci_read_irq_line)
pgprot_t pci_phys_mem_access_prot (struct file *file, unsigned long pfn, unsigned long size, pgprot_t prot)
int pci_mmap_page_range (struct pci_dev *dev, struct vm_area_struct *vma, enum pci_mmap_state mmap_state, int write_combine)
int pci_legacy_read (struct pci_bus *bus, loff_t port, u32 *val, size_t size)
int pci_legacy_write (struct pci_bus *bus, loff_t port, u32 val, size_t size)
int pci_mmap_legacy_page_range (struct pci_bus *bus, struct vm_area_struct *vma, enum pci_mmap_state mmap_state)
void pci_resource_to_user (const struct pci_dev *dev, int bar, const struct resource *rsrc, resource_size_t *start, resource_size_t *end)
void __devinit pci_process_bridge_OF_ranges (struct pci_controller *hose, struct device_node *dev, int primary)
int pci_proc_domain (struct pci_bus *bus)
 DECLARE_PCI_FIXUP_HEADER (PCI_ANY_ID, PCI_ANY_ID, pcibios_fixup_resources)
void __devinit pcibios_setup_bus_self (struct pci_bus *bus)
void __devinit pcibios_setup_bus_devices (struct pci_bus *bus)
void __devinit pcibios_fixup_bus (struct pci_bus *bus)
 EXPORT_SYMBOL (pcibios_fixup_bus)
resource_size_t pcibios_align_resource (void *data, const struct resource *res, resource_size_t size, resource_size_t align)
 EXPORT_SYMBOL (pcibios_align_resource)
void pcibios_allocate_bus_resources (struct pci_bus *bus)
void __init pcibios_resource_survey (void)
int pcibios_enable_device (struct pci_dev *dev, int mask)
struct device_nodepcibios_get_phb_of_node (struct pci_bus *bus)
 subsys_initcall (pcibios_init)
long sys_pciconfig_iobase (long which, unsigned long bus, unsigned long devfn)
int early_find_capability (struct pci_controller *hose, int bus, int devfn, int cap)


resource_size_t isa_mem_base
unsigned long isa_io_base
unsigned long pci_dram_offset

Macro Definition Documentation

#define EARLY_PCI_OP (   rw,
int early_##rw##_config_##size(struct pci_controller *hose, int bus, \
int devfn, int offset, type value) \
{ \
return pci_bus_##rw##_config_##size(fake_pci_bus(hose, bus), \

Definition at line 1621 of file pci-common.c.

#define NULL_PCI_OP (   rw,
static int \
null_##rw##_config_##size(struct pci_dev *dev, int offset, type val) \
{ \

Definition at line 1577 of file pci-common.c.

Function Documentation

int early_find_capability ( struct pci_controller hose,
int  bus,
int  devfn,
int  cap 

Definition at line 1636 of file pci-common.c.

EXPORT_SYMBOL ( get_pci_dma_ops  )
EXPORT_SYMBOL ( pci_domain_nr  )
EXPORT_SYMBOL ( pci_read_irq_line  )
EXPORT_SYMBOL ( pcibios_fixup_bus  )
EXPORT_SYMBOL ( pcibios_align_resource  )
EXPORT_SYMBOL_GPL ( pci_address_to_pio  )
struct dma_map_ops* get_pci_dma_ops ( void  )

Definition at line 61 of file pci-common.c.

LIST_HEAD ( hose_list  )
unsigned long pci_address_to_pio ( phys_addr_t  address)

Definition at line 117 of file pci-common.c.

int pci_domain_nr ( struct pci_bus bus)

Definition at line 143 of file pci-common.c.

struct pci_controller* pci_find_hose_for_OF_device ( struct device_node node)

Definition at line 158 of file pci-common.c.

int pci_legacy_read ( struct pci_bus bus,
loff_t  port,
u32 val,
size_t  size 

Definition at line 444 of file pci-common.c.

int pci_legacy_write ( struct pci_bus bus,
loff_t  port,
u32  val,
size_t  size 

Definition at line 484 of file pci-common.c.

int pci_mmap_legacy_page_range ( struct pci_bus bus,
struct vm_area_struct vma,
enum pci_mmap_state  mmap_state 

pci_mmap_legacy_page_range - map legacy memory space to userland : bus whose legacy space we're mapping : vma passed in by mmap

Map legacy memory space for this device back to userspace using a machine vector to get the base address.

Definition at line 529 of file pci-common.c.

int pci_mmap_page_range ( struct pci_dev dev,
struct vm_area_struct vma,
enum pci_mmap_state  mmap_state,
int  write_combine 

Definition at line 420 of file pci-common.c.

pgprot_t pci_phys_mem_access_prot ( struct file file,
unsigned long  pfn,
unsigned long  size,
pgprot_t  prot 

Definition at line 366 of file pci-common.c.

int pci_proc_domain ( struct pci_bus bus)

Definition at line 823 of file pci-common.c.

void __devinit pci_process_bridge_OF_ranges ( struct pci_controller hose,
struct device_node dev,
int  primary 

pci_process_bridge_OF_ranges - Parse PCI bridge resources from device tree : newly allocated pci_controller to be setup : device node of the host bridge : set if primary bus (32 bits only, soon to be deprecated)

This function will parse the "ranges" property of a PCI host bridge device node and setup the resource mapping of a pci controller based on its content.

Life would be boring if it wasn't for a few issues that we have to deal with here:

  • We can only cope with one IO space range and up to 3 Memory space ranges. However, some machines (thanks Apple !) tend to split their space into lots of small contiguous ranges. So we have to coalesce.
  • We can only cope with all memory ranges having the same offset between CPU addresses and PCI addresses. Unfortunately, some bridges are setup for a large 1:1 mapping along with a small "window" which maps PCI address 0 to some arbitrary high address of the CPU space in order to give access to the ISA memory hole. The way out of here that I've chosen for now is to always set the offset based on the first resource found, then override it if we have a different offset and the previous was set by an ISA hole.
  • Some busses have IO space not starting at 0, which causes trouble with the way we do our IO resource renumbering. The code somewhat deals with it for 64 bits but I would expect problems on 32 bits.
  • Some 32 bits platforms such as 4xx can have physical space larger than 32 bits so we need to use 64 bits values for the parsing

Definition at line 658 of file pci-common.c.

int pci_read_irq_line ( struct pci_dev pci_dev)

Definition at line 200 of file pci-common.c.

void pci_resource_to_user ( const struct pci_dev dev,
int  bar,
const struct resource rsrc,
resource_size_t start,
resource_size_t end 

Definition at line 586 of file pci-common.c.

int pcibios_add_platform_entries ( struct pci_dev pdev)

Definition at line 185 of file pci-common.c.

resource_size_t pcibios_align_resource ( void data,
const struct resource res,
resource_size_t  size,
resource_size_t  align 

Definition at line 1040 of file pci-common.c.

struct pci_controller* pcibios_alloc_controller ( struct device_node dev)

Definition at line 67 of file pci-common.c.

void pcibios_allocate_bus_resources ( struct pci_bus bus)

Definition at line 1127 of file pci-common.c.

int pcibios_enable_device ( struct pci_dev dev,
int  mask 

Definition at line 1412 of file pci-common.c.

void __devinit pcibios_fixup_bus ( struct pci_bus bus)

Definition at line 1005 of file pci-common.c.

void pcibios_free_controller ( struct pci_controller phb)

Definition at line 83 of file pci-common.c.

struct device_node* pcibios_get_phb_of_node ( struct pci_bus bus)

Definition at line 1477 of file pci-common.c.

void __init pcibios_resource_survey ( void  )

Definition at line 1324 of file pci-common.c.

void pcibios_set_master ( struct pci_dev dev)

Definition at line 190 of file pci-common.c.

void __devinit pcibios_setup_bus_devices ( struct pci_bus bus)

Definition at line 980 of file pci-common.c.

void __devinit pcibios_setup_bus_self ( struct pci_bus bus)

Definition at line 973 of file pci-common.c.

int pcibios_vaddr_is_ioport ( void __iomem address)

Definition at line 98 of file pci-common.c.

void set_pci_dma_ops ( struct dma_map_ops dma_ops)

Definition at line 56 of file pci-common.c.

subsys_initcall ( pcibios_init  )
long sys_pciconfig_iobase ( long  which,
unsigned long  bus,
unsigned long  devfn 

Definition at line 1548 of file pci-common.c.

Variable Documentation

unsigned long isa_io_base

Definition at line 51 of file pci-common.c.

resource_size_t isa_mem_base

Definition at line 47 of file pci-common.c.

unsigned long pci_dram_offset

Definition at line 52 of file pci-common.c.