Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* pci.h: FR-V specific PCI declarations |
| 2 | * |
| 3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * - Derived from include/asm-m68k/pci.h |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version |
| 10 | * 2 of the License, or (at your option) any later version. |
| 11 | */ |
| 12 | |
Arnd Bergmann | d7c4f1b | 2009-05-13 22:56:31 +0000 | [diff] [blame^] | 13 | #ifndef _ASM_FRV_PCI_H |
| 14 | #define _ASM_FRV_PCI_H |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 15 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #include <linux/mm.h> |
| 17 | #include <asm/scatterlist.h> |
| 18 | #include <asm-generic/pci-dma-compat.h> |
| 19 | #include <asm-generic/pci.h> |
| 20 | |
| 21 | struct pci_dev; |
| 22 | |
| 23 | #define pcibios_assign_all_busses() 0 |
| 24 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 25 | extern void pcibios_set_master(struct pci_dev *dev); |
| 26 | |
| 27 | extern void pcibios_penalize_isa_irq(int irq); |
| 28 | |
| 29 | #ifdef CONFIG_MMU |
Al Viro | a5da7d3 | 2005-10-21 03:21:18 -0400 | [diff] [blame] | 30 | extern void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *dma_handle); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | extern void consistent_free(void *vaddr); |
| 32 | extern void consistent_sync(void *vaddr, size_t size, int direction); |
| 33 | extern void consistent_sync_page(struct page *page, unsigned long offset, |
| 34 | size_t size, int direction); |
| 35 | #endif |
| 36 | |
| 37 | extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, |
| 38 | dma_addr_t *dma_handle); |
| 39 | |
| 40 | extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, |
| 41 | void *vaddr, dma_addr_t dma_handle); |
| 42 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 | /* Return the index of the PCI controller for device PDEV. */ |
| 44 | #define pci_controller_num(PDEV) (0) |
| 45 | |
David Howells | 41be6ae | 2006-01-08 01:01:25 -0800 | [diff] [blame] | 46 | /* pci_unmap_{page,single} is a nop so... */ |
| 47 | #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME) |
| 48 | #define DECLARE_PCI_UNMAP_LEN(LEN_NAME) |
| 49 | #define pci_unmap_addr(PTR, ADDR_NAME) (0) |
| 50 | #define pci_unmap_addr_set(PTR, ADDR_NAME, VAL) do { } while (0) |
| 51 | #define pci_unmap_len(PTR, LEN_NAME) (0) |
| 52 | #define pci_unmap_len_set(PTR, LEN_NAME, VAL) do { } while (0) |
| 53 | |
Andrew Morton | bb4a61b | 2005-06-06 23:07:46 -0700 | [diff] [blame] | 54 | #ifdef CONFIG_PCI |
David S. Miller | e24c2d9 | 2005-06-02 12:55:50 -0700 | [diff] [blame] | 55 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, |
| 56 | enum pci_dma_burst_strategy *strat, |
| 57 | unsigned long *strategy_parameter) |
| 58 | { |
| 59 | *strat = PCI_DMA_BURST_INFINITY; |
| 60 | *strategy_parameter = ~0UL; |
| 61 | } |
Andrew Morton | bb4a61b | 2005-06-06 23:07:46 -0700 | [diff] [blame] | 62 | #endif |
David S. Miller | e24c2d9 | 2005-06-02 12:55:50 -0700 | [diff] [blame] | 63 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 64 | /* |
| 65 | * These are pretty much arbitary with the CoMEM implementation. |
| 66 | * We have the whole address space to ourselves. |
| 67 | */ |
| 68 | #define PCIBIOS_MIN_IO 0x100 |
| 69 | #define PCIBIOS_MIN_MEM 0x00010000 |
| 70 | |
| 71 | /* Make physical memory consistent for a single |
| 72 | * streaming mode DMA translation after a transfer. |
| 73 | * |
| 74 | * If you perform a pci_map_single() but wish to interrogate the |
| 75 | * buffer using the cpu, yet do not wish to teardown the PCI dma |
| 76 | * mapping, you must call this function before doing so. At the |
| 77 | * next point you give the PCI dma address back to the card, the |
| 78 | * device again owns the buffer. |
| 79 | */ |
| 80 | static inline void pci_dma_sync_single(struct pci_dev *hwdev, |
| 81 | dma_addr_t dma_handle, |
| 82 | size_t size, int direction) |
| 83 | { |
| 84 | if (direction == PCI_DMA_NONE) |
| 85 | BUG(); |
| 86 | |
| 87 | frv_cache_wback_inv((unsigned long)bus_to_virt(dma_handle), |
| 88 | (unsigned long)bus_to_virt(dma_handle) + size); |
| 89 | } |
| 90 | |
| 91 | /* Make physical memory consistent for a set of streaming |
| 92 | * mode DMA translations after a transfer. |
| 93 | * |
| 94 | * The same as pci_dma_sync_single but for a scatter-gather list, |
| 95 | * same rules and usage. |
| 96 | */ |
| 97 | static inline void pci_dma_sync_sg(struct pci_dev *hwdev, |
| 98 | struct scatterlist *sg, |
| 99 | int nelems, int direction) |
| 100 | { |
| 101 | int i; |
| 102 | |
| 103 | if (direction == PCI_DMA_NONE) |
| 104 | BUG(); |
| 105 | |
| 106 | for (i = 0; i < nelems; i++) |
| 107 | frv_cache_wback_inv(sg_dma_address(&sg[i]), |
| 108 | sg_dma_address(&sg[i])+sg_dma_len(&sg[i])); |
| 109 | } |
| 110 | |
Arnd Bergmann | d7c4f1b | 2009-05-13 22:56:31 +0000 | [diff] [blame^] | 111 | #endif /* _ASM_FRV_PCI_H */ |