More cleaning ...
[linux-2.6/linux-mips.git] / include / asm-v850 / pci.h
blobb915819c609b9a30119398026b29ebf2c2a081ce
1 /*
2 * include/asm-v850/pci.h -- PCI support
4 * Copyright (C) 2001,02 NEC Corporation
5 * Copyright (C) 2001,02 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 /* Generic declarations. */
22 struct scatterlist;
24 extern void pcibios_set_master (struct pci_dev *dev);
26 /* `Grant' to PDEV the memory block at CPU_ADDR, for doing DMA. The
27 32-bit PCI bus mastering address to use is returned. the device owns
28 this memory until either pci_unmap_single or pci_dma_sync_single is
29 performed. */
30 extern dma_addr_t
31 pci_map_single (struct pci_dev *pdev, void *cpu_addr, size_t size, int dir);
33 /* Return to the CPU the PCI DMA memory block previously `granted' to
34 PDEV, at DMA_ADDR. */
35 extern void
36 pci_unmap_single (struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
37 int dir);
39 /* Make physical memory consistent for a single streaming mode DMA
40 translation after a transfer.
42 If you perform a pci_map_single() but wish to interrogate the
43 buffer using the cpu, yet do not wish to teardown the PCI dma
44 mapping, you must call this function before doing so. At the next
45 point you give the PCI dma address back to the card, the device
46 again owns the buffer. */
47 extern void
48 pci_dma_sync_single (struct pci_dev *dev, dma_addr_t dma_addr, size_t size,
49 int dir);
52 /* Do multiple DMA mappings at once. */
53 extern int
54 pci_map_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len, int dir);
56 /* Unmap multiple DMA mappings at once. */
57 extern void
58 pci_unmap_sg (struct pci_dev *pdev, struct scatterlist *sg, int sg_len,
59 int dir);
61 /* Allocate and map kernel buffer using consistent mode DMA for PCI
62 device. Returns non-NULL cpu-view pointer to the buffer if
63 successful and sets *DMA_ADDR to the pci side dma address as well,
64 else DMA_ADDR is undefined. */
65 extern void *
66 pci_alloc_consistent (struct pci_dev *pdev, size_t size, dma_addr_t *dma_addr);
68 /* Free and unmap a consistent DMA buffer. CPU_ADDR and DMA_ADDR must
69 be values that were returned from pci_alloc_consistent. SIZE must be
70 the same as what as passed into pci_alloc_consistent. References to
71 the memory and mappings assosciated with CPU_ADDR or DMA_ADDR past
72 this call are illegal. */
73 extern void
74 pci_free_consistent (struct pci_dev *pdev, size_t size, void *cpu_addr,
75 dma_addr_t dma_addr);
77 #endif /* __V850_PCI_H__ */