memstick: suppress uninitialized-var warning
[linux-2.6/openmoko-kernel/knife-kernel.git] / include / asm-v850 / pci.h
blobde2a7d0a81cc1d7345b1adc9b37eeb4656023d93
1 /*
2 * include/asm-v850/pci.h -- PCI support
4 * Copyright (C) 2001,02,05 NEC Corporation
5 * Copyright (C) 2001,02,05 Miles Bader <miles@gnu.org>
7 * This file is subject to the terms and conditions of the GNU General
8 * Public License. See the file COPYING in the main directory of this
9 * archive for more details.
11 * Written by Miles Bader <miles@gnu.org>
14 #ifndef __V850_PCI_H__
15 #define __V850_PCI_H__
17 /* Get any platform-dependent definitions. */
18 #include <asm/machdep.h>
20 #define pcibios_scan_all_fns(a, b) 0
22 /* Generic declarations. */
24 struct scatterlist;
26 extern void pcibios_set_master (struct pci_dev *dev);
28 /* `Grant' to PDEV the memory block at CPU_ADDR, for doing DMA. The
29 32-bit PCI bus mastering address to use is returned. the device owns
30 this memory until either pci_unmap_single or pci_dma_sync_single_for_cpu is
31 performed. */
32 extern dma_addr_t
33 pci_map_single (struct pci_dev *pdev, void *cpu_addr, size_t size, int dir);
35 /* Return to the CPU the PCI DMA memory block previously `granted' to
36 PDEV, at DMA_ADDR. */
37 extern void
38 pci_unmap_single (struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
39 int dir);
41 /* Make physical memory consistent for a single streaming mode DMA
42 translation after a transfer.
44 If you perform a pci_map_single() but wish to interrogate the
45 buffer using the cpu, yet do not wish to teardown the PCI dma
46 mapping, you must call this function before doing so. At the next
47 point you give the PCI dma address back to the card, you must first
48 perform a pci_dma_sync_for_device, and then the device again owns
49 the buffer. */
50 extern void
51 pci_dma_sync_single_for_cpu (struct pci_dev *dev, dma_addr_t dma_addr,
52 size_t size, int dir);
54 extern void
55 pci_dma_sync_single_for_device (struct pci_dev *dev, dma_addr_t dma_addr,
56 size_t size, int dir);
59 /* Do multiple DMA mappings at once. */
60 extern int
61 pci_map_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len, int dir);
63 /* Unmap multiple DMA mappings at once. */
64 extern void
65 pci_unmap_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len,
66 int dir);
68 /* SG-list versions of pci_dma_sync functions. */
69 extern void
70 pci_dma_sync_sg_for_cpu (struct pci_dev *dev,
71 struct scatterlist *sg, int sg_len,
72 int dir);
73 extern void
74 pci_dma_sync_sg_for_device (struct pci_dev *dev,
75 struct scatterlist *sg, int sg_len,
76 int dir);
78 #define pci_map_page(dev, page, offs, size, dir) \
79 pci_map_single(dev, (page_address(page) + (offs)), size, dir)
80 #define pci_unmap_page(dev,addr,sz,dir) \
81 pci_unmap_single(dev, addr, sz, dir)
83 /* Test for pci_map_single or pci_map_page having generated an error. */
84 static inline int
85 pci_dma_mapping_error (dma_addr_t dma_addr)
87 return dma_addr == 0;
90 /* Allocate and map kernel buffer using consistent mode DMA for PCI
91 device. Returns non-NULL cpu-view pointer to the buffer if
92 successful and sets *DMA_ADDR to the pci side dma address as well,
93 else DMA_ADDR is undefined. */
94 extern void *
95 pci_alloc_consistent (struct pci_dev *pdev, size_t size, dma_addr_t *dma_addr);
97 /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
98 be values that were returned from pci_alloc_consistent. SIZE must be
99 the same as what as passed into pci_alloc_consistent. References to
100 the memory and mappings assosciated with CPU_ADDR or DMA_ADDR past
101 this call are illegal. */
102 extern void
103 pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
104 dma_addr_t dma_addr);
106 #ifdef CONFIG_PCI
107 static inline void pci_dma_burst_advice(struct pci_dev *pdev,
108 enum pci_dma_burst_strategy *strat,
109 unsigned long *strategy_parameter)
111 *strat = PCI_DMA_BURST_INFINITY;
112 *strategy_parameter = ~0UL;
114 #endif
116 extern void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max);
117 extern void pci_iounmap (struct pci_dev *dev, void __iomem *addr);
119 #endif /* __V850_PCI_H__ */