David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 1 | /* MN10300 PCI definitions |
| 2 | * |
| 3 | * Copyright (C) 2007 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public Licence |
| 8 | * as published by the Free Software Foundation; either version |
| 9 | * 2 of the Licence, or (at your option) any later version. |
| 10 | */ |
| 11 | #ifndef _ASM_PCI_H |
| 12 | #define _ASM_PCI_H |
| 13 | |
| 14 | #ifdef __KERNEL__ |
| 15 | #include <linux/mm.h> /* for struct page */ |
| 16 | |
| 17 | #if 0 |
| 18 | #define __pcbdebug(FMT, ADDR, ...) \ |
| 19 | printk(KERN_DEBUG "PCIBRIDGE[%08x]: "FMT"\n", \ |
| 20 | (u32)(ADDR), ##__VA_ARGS__) |
| 21 | |
| 22 | #define __pcidebug(FMT, BUS, DEVFN, WHERE,...) \ |
| 23 | do { \ |
| 24 | printk(KERN_DEBUG "PCI[%02x:%02x.%x + %02x]: "FMT"\n", \ |
| 25 | (BUS)->number, \ |
| 26 | PCI_SLOT(DEVFN), \ |
| 27 | PCI_FUNC(DEVFN), \ |
| 28 | (u32)(WHERE), ##__VA_ARGS__); \ |
| 29 | } while (0) |
| 30 | |
| 31 | #else |
| 32 | #define __pcbdebug(FMT, ADDR, ...) do {} while (0) |
| 33 | #define __pcidebug(FMT, BUS, DEVFN, WHERE, ...) do {} while (0) |
| 34 | #endif |
| 35 | |
| 36 | /* Can be used to override the logic in pci_scan_bus for skipping |
| 37 | * already-configured bus numbers - to be used for buggy BIOSes or |
| 38 | * architectures with incomplete PCI setup by the loader */ |
| 39 | |
| 40 | #ifdef CONFIG_PCI |
| 41 | #define pcibios_assign_all_busses() 1 |
| 42 | extern void unit_pci_init(void); |
| 43 | #else |
| 44 | #define pcibios_assign_all_busses() 0 |
| 45 | #endif |
| 46 | |
| 47 | extern unsigned long pci_mem_start; |
| 48 | #define PCIBIOS_MIN_IO 0xBE000004 |
| 49 | #define PCIBIOS_MIN_MEM 0xB8000000 |
| 50 | |
| 51 | void pcibios_set_master(struct pci_dev *dev); |
| 52 | void pcibios_penalize_isa_irq(int irq); |
| 53 | |
| 54 | /* Dynamic DMA mapping stuff. |
| 55 | * i386 has everything mapped statically. |
| 56 | */ |
| 57 | |
| 58 | #include <linux/types.h> |
| 59 | #include <linux/slab.h> |
| 60 | #include <asm/scatterlist.h> |
| 61 | #include <linux/string.h> |
| 62 | #include <linux/mm.h> |
| 63 | #include <asm/io.h> |
| 64 | |
| 65 | struct pci_dev; |
| 66 | |
| 67 | /* The PCI address space does equal the physical memory |
| 68 | * address space. The networking and block device layers use |
| 69 | * this boolean for bounce buffer decisions. |
| 70 | */ |
| 71 | #define PCI_DMA_BUS_IS_PHYS (1) |
| 72 | |
| 73 | |
| 74 | /* This is always fine. */ |
| 75 | #define pci_dac_dma_supported(pci_dev, mask) (0) |
| 76 | |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 77 | /* Return the index of the PCI controller for device. */ |
| 78 | static inline int pci_controller_num(struct pci_dev *dev) |
| 79 | { |
| 80 | return 0; |
| 81 | } |
| 82 | |
| 83 | #define HAVE_PCI_MMAP |
| 84 | extern int pci_mmap_page_range(struct pci_dev *dev, struct vm_area_struct *vma, |
| 85 | enum pci_mmap_state mmap_state, |
| 86 | int write_combine); |
| 87 | |
| 88 | #endif /* __KERNEL__ */ |
| 89 | |
| 90 | /* implement the pci_ DMA API in terms of the generic device dma_ one */ |
| 91 | #include <asm-generic/pci-dma-compat.h> |
| 92 | |
| 93 | /** |
| 94 | * pcibios_resource_to_bus - convert resource to PCI bus address |
| 95 | * @dev: device which owns this resource |
| 96 | * @region: converted bus-centric region (start,end) |
| 97 | * @res: resource to convert |
| 98 | * |
| 99 | * Convert a resource to a PCI device bus address or bus window. |
| 100 | */ |
| 101 | extern void pcibios_resource_to_bus(struct pci_dev *dev, |
| 102 | struct pci_bus_region *region, |
| 103 | struct resource *res); |
| 104 | |
| 105 | extern void pcibios_bus_to_resource(struct pci_dev *dev, |
| 106 | struct resource *res, |
| 107 | struct pci_bus_region *region); |
| 108 | |
| 109 | static inline struct resource * |
| 110 | pcibios_select_root(struct pci_dev *pdev, struct resource *res) |
| 111 | { |
| 112 | struct resource *root = NULL; |
| 113 | |
| 114 | if (res->flags & IORESOURCE_IO) |
| 115 | root = &ioport_resource; |
| 116 | if (res->flags & IORESOURCE_MEM) |
| 117 | root = &iomem_resource; |
| 118 | |
| 119 | return root; |
| 120 | } |
| 121 | |
| 122 | #define pcibios_scan_all_fns(a, b) 0 |
| 123 | |
Bartlomiej Zolnierkiewicz | b75aa12 | 2009-03-24 23:22:48 +0100 | [diff] [blame] | 124 | static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel) |
| 125 | { |
| 126 | return channel ? 15 : 14; |
| 127 | } |
| 128 | |
David Howells | b920de1 | 2008-02-08 04:19:31 -0800 | [diff] [blame] | 129 | #endif /* _ASM_PCI_H */ |