~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Linux Cross Reference
Linux/include/asm-sh/pci.h

Version: ~ [ 2.4.0 ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 #ifndef __ASM_SH_PCI_H
  2 #define __ASM_SH_PCI_H
  3 
  4 #ifdef __KERNEL__
  5 
  6 /* Can be used to override the logic in pci_scan_bus for skipping
  7    already-configured bus numbers - to be used for buggy BIOSes
  8    or architectures with incomplete PCI setup by the loader */
  9 
 10 #define pcibios_assign_all_busses()     0
 11 
 12 /* These are currently the correct values for the STM overdrive board. 
 13  * We need some way of setting this on a board specific way, it will 
 14  * not be the same on other boards I think
 15  */
 16 #if 1 /* def CONFIG_SH_OVERDRIVE */
 17 #define PCIBIOS_MIN_IO          0x2000
 18 #define PCIBIOS_MIN_MEM         0x10000000
 19 #endif
 20 
 21 static inline void pcibios_set_master(struct pci_dev *dev)
 22 {
 23         /* No special bus mastering setup handling */
 24 }
 25 
 26 static inline void pcibios_penalize_isa_irq(int irq)
 27 {
 28         /* We don't do dynamic PCI IRQ allocation */
 29 }
 30 
 31 /* Dynamic DMA mapping stuff.
 32  * SuperH has everything mapped statically like x86.
 33  */
 34 
 35 #include <linux/types.h>
 36 #include <linux/slab.h>
 37 #include <asm/scatterlist.h>
 38 #include <linux/string.h>
 39 #include <asm/io.h>
 40 
 41 struct pci_dev;
 42 
 43 /* Allocate and map kernel buffer using consistent mode DMA for a device.
 44  * hwdev should be valid struct pci_dev pointer for PCI devices,
 45  * NULL for PCI-like buses (ISA, EISA).
 46  * Returns non-NULL cpu-view pointer to the buffer if successful and
 47  * sets *dma_addrp to the pci side dma address as well, else *dma_addrp
 48  * is undefined.
 49  */
 50 extern void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
 51                                   dma_addr_t *dma_handle);
 52 
 53 /* Free and unmap a consistent DMA buffer.
 54  * cpu_addr is what was returned from pci_alloc_consistent,
 55  * size must be the same as what as passed into pci_alloc_consistent,
 56  * and likewise dma_addr must be the same as what *dma_addrp was set to.
 57  *
 58  * References to the memory and mappings associated with cpu_addr/dma_addr
 59  * past this call are illegal.
 60  */
 61 extern void pci_free_consistent(struct pci_dev *hwdev, size_t size,
 62                                 void *vaddr, dma_addr_t dma_handle);
 63 
 64 /* Map a single buffer of the indicated size for DMA in streaming mode.
 65  * The 32-bit bus address to use is returned.
 66  *
 67  * Once the device is given the dma address, the device owns this memory
 68  * until either pci_unmap_single or pci_dma_sync_single is performed.
 69  */
 70 static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
 71                                         size_t size,int directoin)
 72 {
 73         return virt_to_bus(ptr);
 74 }
 75 
 76 /* Unmap a single streaming mode DMA translation.  The dma_addr and size
 77  * must match what was provided for in a previous pci_map_single call.  All
 78  * other usages are undefined.
 79  *
 80  * After this call, reads by the cpu to the buffer are guarenteed to see
 81  * whatever the device wrote there.
 82  */
 83 static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
 84                                     size_t size,int direction)
 85 {
 86         /* Nothing to do */
 87 }
 88 
 89 /* Map a set of buffers described by scatterlist in streaming
 90  * mode for DMA.  This is the scather-gather version of the
 91  * above pci_map_single interface.  Here the scatter gather list
 92  * elements are each tagged with the appropriate dma address
 93  * and length.  They are obtained via sg_dma_{address,length}(SG).
 94  *
 95  * NOTE: An implementation may be able to use a smaller number of
 96  *       DMA address/length pairs than there are SG table elements.
 97  *       (for example via virtual mapping capabilities)
 98  *       The routine returns the number of addr/length pairs actually
 99  *       used, at most nents.
100  *
101  * Device ownership issues as mentioned above for pci_map_single are
102  * the same here.
103  */
104 static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
105                              int nents,int direction)
106 {
107         return nents;
108 }
109 
110 /* Unmap a set of streaming mode DMA translations.
111  * Again, cpu read rules concerning calls here are the same as for
112  * pci_unmap_single() above.
113  */
114 static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
115                                 int nents,int direction)
116 {
117         /* Nothing to do */
118 }
119 
120 /* Make physical memory consistent for a single
121  * streaming mode DMA translation after a transfer.
122  *
123  * If you perform a pci_map_single() but wish to interrogate the
124  * buffer using the cpu, yet do not wish to teardown the PCI dma
125  * mapping, you must call this function before doing so.  At the
126  * next point you give the PCI dma address back to the card, the
127  * device again owns the buffer.
128  */
129 static inline void pci_dma_sync_single(struct pci_dev *hwdev,
130                                        dma_addr_t dma_handle,
131                                        size_t size,int direction)
132 {
133         /* Nothing to do */
134 }
135 
136 /* Make physical memory consistent for a set of streaming
137  * mode DMA translations after a transfer.
138  *
139  * The same as pci_dma_sync_single but for a scatter-gather list,
140  * same rules and usage.
141  */
142 static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
143                                    struct scatterlist *sg,
144                                    int nelems,int direction)
145 {
146         /* Nothing to do */
147 }
148 
149 /* These macros should be used after a pci_map_sg call has been done
150  * to get bus addresses of each of the SG entries and their lengths.
151  * You should only work with the number of sg entries pci_map_sg
152  * returns, or alternatively stop on the first sg_dma_len(sg) which
153  * is 0.
154  */
155 #define sg_dma_address(sg)      (virt_to_bus((sg)->address))
156 #define sg_dma_len(sg)          ((sg)->length)
157 
158 #endif /* __KERNEL__ */
159 
160 
161 #endif /* __ASM_SH_PCI_H */
162 
163 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.