Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This program is free software; you can redistribute it and/or |
| 3 | * modify it under the terms of the GNU General Public License |
| 4 | * as published by the Free Software Foundation; either version |
| 5 | * 2 of the License, or (at your option) any later version. |
| 6 | * |
| 7 | * Based on powerpc version |
| 8 | */ |
| 9 | |
| 10 | #ifndef __ASM_MICROBLAZE_PCI_H |
| 11 | #define __ASM_MICROBLAZE_PCI_H |
| 12 | #ifdef __KERNEL__ |
| 13 | |
| 14 | #include <linux/types.h> |
| 15 | #include <linux/slab.h> |
| 16 | #include <linux/string.h> |
| 17 | #include <linux/dma-mapping.h> |
| 18 | #include <linux/pci.h> |
| 19 | |
| 20 | #include <asm/scatterlist.h> |
| 21 | #include <asm/io.h> |
| 22 | #include <asm/prom.h> |
| 23 | #include <asm/pci-bridge.h> |
| 24 | |
John Linn | c74c8b1 | 2010-02-24 12:55:02 -0700 | [diff] [blame] | 25 | #include <asm-generic/pci-dma-compat.h> |
| 26 | |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 27 | #define PCIBIOS_MIN_IO 0x1000 |
| 28 | #define PCIBIOS_MIN_MEM 0x10000000 |
| 29 | |
| 30 | struct pci_dev; |
| 31 | |
| 32 | /* Values for the `which' argument to sys_pciconfig_iobase syscall. */ |
| 33 | #define IOBASE_BRIDGE_NUMBER 0 |
| 34 | #define IOBASE_MEMORY 1 |
| 35 | #define IOBASE_IO 2 |
| 36 | #define IOBASE_ISA_IO 3 |
| 37 | #define IOBASE_ISA_MEM 4 |
| 38 | |
| 39 | #define pcibios_scan_all_fns(a, b) 0 |
| 40 | |
| 41 | /* |
| 42 | * Set this to 1 if you want the kernel to re-assign all PCI |
| 43 | * bus numbers (don't do that on ppc64 yet !) |
| 44 | */ |
Benjamin Herrenschmidt | 72bdee7 | 2011-04-11 11:20:25 +1000 | [diff] [blame] | 45 | #define pcibios_assign_all_busses() 0 |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 46 | |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 47 | #ifdef CONFIG_PCI |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 48 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
| 49 | enum pci_dma_burst_strategy *strat, |
| 50 | unsigned long *strategy_parameter) |
| 51 | { |
| 52 | *strat = PCI_DMA_BURST_INFINITY; |
| 53 | *strategy_parameter = ~0UL; |
| 54 | } |
| 55 | #endif |
| 56 | |
| 57 | extern int pci_domain_nr(struct pci_bus *bus); |
| 58 | |
| 59 | /* Decide whether to display the domain number in /proc */ |
| 60 | extern int pci_proc_domain(struct pci_bus *bus); |
| 61 | |
| 62 | struct vm_area_struct; |
| 63 | /* Map a range of PCI memory or I/O space for a device into user space */ |
| 64 | int pci_mmap_page_range(struct pci_dev *pdev, struct vm_area_struct *vma, |
| 65 | enum pci_mmap_state mmap_state, int write_combine); |
| 66 | |
| 67 | /* Tell drivers/pci/proc.c that we have pci_mmap_page_range() */ |
| 68 | #define HAVE_PCI_MMAP 1 |
| 69 | |
| 70 | extern int pci_legacy_read(struct pci_bus *bus, loff_t port, u32 *val, |
| 71 | size_t count); |
| 72 | extern int pci_legacy_write(struct pci_bus *bus, loff_t port, u32 val, |
| 73 | size_t count); |
| 74 | extern int pci_mmap_legacy_page_range(struct pci_bus *bus, |
| 75 | struct vm_area_struct *vma, |
| 76 | enum pci_mmap_state mmap_state); |
| 77 | |
| 78 | #define HAVE_PCI_LEGACY 1 |
| 79 | |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 80 | /* The PCI address space does equal the physical memory |
| 81 | * address space (no IOMMU). The IDE and SCSI device layers use |
| 82 | * this boolean for bounce buffer decisions. |
| 83 | */ |
| 84 | #define PCI_DMA_BUS_IS_PHYS (1) |
| 85 | |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 86 | extern void pcibios_claim_one_bus(struct pci_bus *b); |
| 87 | |
| 88 | extern void pcibios_finish_adding_to_bus(struct pci_bus *bus); |
| 89 | |
| 90 | extern void pcibios_resource_survey(void); |
| 91 | |
| 92 | extern struct pci_controller *init_phb_dynamic(struct device_node *dn); |
| 93 | extern int remove_phb_dynamic(struct pci_controller *phb); |
| 94 | |
| 95 | extern struct pci_dev *of_create_pci_dev(struct device_node *node, |
| 96 | struct pci_bus *bus, int devfn); |
| 97 | |
| 98 | extern void of_scan_pci_bridge(struct device_node *node, |
| 99 | struct pci_dev *dev); |
| 100 | |
| 101 | extern void of_scan_bus(struct device_node *node, struct pci_bus *bus); |
| 102 | extern void of_rescan_bus(struct device_node *node, struct pci_bus *bus); |
| 103 | |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 104 | extern int pci_bus_find_capability(struct pci_bus *bus, |
| 105 | unsigned int devfn, int cap); |
| 106 | |
| 107 | struct file; |
| 108 | extern pgprot_t pci_phys_mem_access_prot(struct file *file, |
| 109 | unsigned long pfn, |
| 110 | unsigned long size, |
| 111 | pgprot_t prot); |
| 112 | |
| 113 | #define HAVE_ARCH_PCI_RESOURCE_TO_USER |
| 114 | extern void pci_resource_to_user(const struct pci_dev *dev, int bar, |
| 115 | const struct resource *rsrc, |
| 116 | resource_size_t *start, resource_size_t *end); |
| 117 | |
| 118 | extern void pcibios_setup_bus_devices(struct pci_bus *bus); |
| 119 | extern void pcibios_setup_bus_self(struct pci_bus *bus); |
| 120 | |
Lucas De Marchi | 25985ed | 2011-03-30 22:57:33 -0300 | [diff] [blame] | 121 | /* This part of code was originally in xilinx-pci.h */ |
Michal Simek | 733cc21 | 2010-01-18 15:27:11 +0100 | [diff] [blame] | 122 | #ifdef CONFIG_PCI_XILINX |
| 123 | extern void __init xilinx_pci_init(void); |
| 124 | #else |
| 125 | static inline void __init xilinx_pci_init(void) { return; } |
| 126 | #endif |
| 127 | |
Michal Simek | 830980a | 2010-01-18 14:23:16 +0100 | [diff] [blame] | 128 | #endif /* __KERNEL__ */ |
| 129 | #endif /* __ASM_MICROBLAZE_PCI_H */ |