| 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 |  | 
 | 13 | #ifndef ASM_PCI_H | 
 | 14 | #define	ASM_PCI_H | 
 | 15 |  | 
 | 16 | #include <linux/config.h> | 
 | 17 | #include <linux/mm.h> | 
 | 18 | #include <asm/scatterlist.h> | 
 | 19 | #include <asm-generic/pci-dma-compat.h> | 
 | 20 | #include <asm-generic/pci.h> | 
 | 21 |  | 
 | 22 | struct pci_dev; | 
 | 23 |  | 
 | 24 | #define pcibios_assign_all_busses()	0 | 
 | 25 |  | 
 | 26 | static inline void pcibios_add_platform_entries(struct pci_dev *dev) | 
 | 27 | { | 
 | 28 | } | 
 | 29 |  | 
 | 30 | extern void pcibios_set_master(struct pci_dev *dev); | 
 | 31 |  | 
 | 32 | extern void pcibios_penalize_isa_irq(int irq); | 
 | 33 |  | 
 | 34 | #ifdef CONFIG_MMU | 
 | 35 | extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *dma_handle); | 
 | 36 | extern void consistent_free(void *vaddr); | 
 | 37 | extern void consistent_sync(void *vaddr, size_t size, int direction); | 
 | 38 | extern void consistent_sync_page(struct page *page, unsigned long offset, | 
 | 39 | 				 size_t size, int direction); | 
 | 40 | #endif | 
 | 41 |  | 
 | 42 | extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, | 
 | 43 | 				  dma_addr_t *dma_handle); | 
 | 44 |  | 
 | 45 | extern void pci_free_consistent(struct pci_dev *hwdev, size_t size, | 
 | 46 | 				void *vaddr, dma_addr_t dma_handle); | 
 | 47 |  | 
 | 48 | /* This is always fine. */ | 
 | 49 | #define pci_dac_dma_supported(pci_dev, mask)	(1) | 
 | 50 |  | 
 | 51 | /* Return the index of the PCI controller for device PDEV. */ | 
 | 52 | #define pci_controller_num(PDEV)	(0) | 
 | 53 |  | 
 | 54 | /* The PCI address space does equal the physical memory | 
 | 55 |  * address space.  The networking and block device layers use | 
 | 56 |  * this boolean for bounce buffer decisions. | 
 | 57 |  */ | 
 | 58 | #define PCI_DMA_BUS_IS_PHYS	(1) | 
 | 59 |  | 
| Andrew Morton | bb4a61b | 2005-06-06 23:07:46 -0700 | [diff] [blame] | 60 | #ifdef CONFIG_PCI | 
| David S. Miller | e24c2d9 | 2005-06-02 12:55:50 -0700 | [diff] [blame] | 61 | static inline void pci_dma_burst_advice(struct pci_dev *pdev, | 
 | 62 | 					enum pci_dma_burst_strategy *strat, | 
 | 63 | 					unsigned long *strategy_parameter) | 
 | 64 | { | 
 | 65 | 	*strat = PCI_DMA_BURST_INFINITY; | 
 | 66 | 	*strategy_parameter = ~0UL; | 
 | 67 | } | 
| Andrew Morton | bb4a61b | 2005-06-06 23:07:46 -0700 | [diff] [blame] | 68 | #endif | 
| David S. Miller | e24c2d9 | 2005-06-02 12:55:50 -0700 | [diff] [blame] | 69 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 70 | /* | 
 | 71 |  *	These are pretty much arbitary with the CoMEM implementation. | 
 | 72 |  *	We have the whole address space to ourselves. | 
 | 73 |  */ | 
 | 74 | #define PCIBIOS_MIN_IO		0x100 | 
 | 75 | #define PCIBIOS_MIN_MEM		0x00010000 | 
 | 76 |  | 
 | 77 | /* Make physical memory consistent for a single | 
 | 78 |  * streaming mode DMA translation after a transfer. | 
 | 79 |  * | 
 | 80 |  * If you perform a pci_map_single() but wish to interrogate the | 
 | 81 |  * buffer using the cpu, yet do not wish to teardown the PCI dma | 
 | 82 |  * mapping, you must call this function before doing so.  At the | 
 | 83 |  * next point you give the PCI dma address back to the card, the | 
 | 84 |  * device again owns the buffer. | 
 | 85 |  */ | 
 | 86 | static inline void pci_dma_sync_single(struct pci_dev *hwdev, | 
 | 87 | 				       dma_addr_t dma_handle, | 
 | 88 | 				       size_t size, int direction) | 
 | 89 | { | 
 | 90 | 	if (direction == PCI_DMA_NONE) | 
 | 91 |                 BUG(); | 
 | 92 |  | 
 | 93 | 	frv_cache_wback_inv((unsigned long)bus_to_virt(dma_handle), | 
 | 94 | 			    (unsigned long)bus_to_virt(dma_handle) + size); | 
 | 95 | } | 
 | 96 |  | 
 | 97 | /* Make physical memory consistent for a set of streaming | 
 | 98 |  * mode DMA translations after a transfer. | 
 | 99 |  * | 
 | 100 |  * The same as pci_dma_sync_single but for a scatter-gather list, | 
 | 101 |  * same rules and usage. | 
 | 102 |  */ | 
 | 103 | static inline void pci_dma_sync_sg(struct pci_dev *hwdev, | 
 | 104 | 				   struct scatterlist *sg, | 
 | 105 | 				   int nelems, int direction) | 
 | 106 | { | 
 | 107 | 	int i; | 
 | 108 |  | 
 | 109 | 	if (direction == PCI_DMA_NONE) | 
 | 110 |                 BUG(); | 
 | 111 |  | 
 | 112 | 	for (i = 0; i < nelems; i++) | 
 | 113 | 		frv_cache_wback_inv(sg_dma_address(&sg[i]), | 
 | 114 | 				    sg_dma_address(&sg[i])+sg_dma_len(&sg[i])); | 
 | 115 | } | 
 | 116 |  | 
 | 117 |  | 
 | 118 | #endif |