~ubuntu-branches/debian/wheezy/linux-2.6/wheezy

« back to all changes in this revision

Viewing changes to arch/powerpc/include/asm/dma-mapping.h

  • Committer: Bazaar Package Importer
  • Author(s): Ben Hutchings, Ben Hutchings, Aurelien Jarno, Martin Michlmayr
  • Date: 2011-04-06 13:53:30 UTC
  • mfrom: (43.1.5 sid)
  • Revision ID: james.westby@ubuntu.com-20110406135330-wjufxhd0tvn3zx4z
Tags: 2.6.38-3
[ Ben Hutchings ]
* [ppc64] Add to linux-tools package architectures (Closes: #620124)
* [amd64] Save cr4 to mmu_cr4_features at boot time (Closes: #620284)
* appletalk: Fix bugs introduced when removing use of BKL
* ALSA: Fix yet another race in disconnection
* cciss: Fix lost command issue
* ath9k: Fix kernel panic in AR2427
* ses: Avoid kernel panic when lun 0 is not mapped
* PCI/ACPI: Report ASPM support to BIOS if not disabled from command line

[ Aurelien Jarno ]
* rtlwifi: fix build when PCI is not enabled.

[ Martin Michlmayr ]
* rtlwifi: Eliminate udelay calls with too large values (Closes: #620204)

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
        return dma_ops->dma_supported(dev, mask);
128
128
}
129
129
 
130
 
/* We have our own implementation of pci_set_dma_mask() */
131
 
#define HAVE_ARCH_PCI_SET_DMA_MASK
132
 
 
133
 
static inline int dma_set_mask(struct device *dev, u64 dma_mask)
134
 
{
135
 
        struct dma_map_ops *dma_ops = get_dma_ops(dev);
136
 
 
137
 
        if (unlikely(dma_ops == NULL))
138
 
                return -EIO;
139
 
        if (dma_ops->set_dma_mask != NULL)
140
 
                return dma_ops->set_dma_mask(dev, dma_mask);
141
 
        if (!dev->dma_mask || !dma_supported(dev, dma_mask))
142
 
                return -EIO;
143
 
        *dev->dma_mask = dma_mask;
144
 
        return 0;
145
 
}
 
130
extern int dma_set_mask(struct device *dev, u64 dma_mask);
146
131
 
147
132
static inline void *dma_alloc_coherent(struct device *dev, size_t size,
148
133
                                       dma_addr_t *dma_handle, gfp_t flag)
197
182
        if (!dev->dma_mask)
198
183
                return 0;
199
184
 
200
 
        return addr + size <= *dev->dma_mask;
 
185
        return addr + size - 1 <= *dev->dma_mask;
201
186
}
202
187
 
203
188
static inline dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
212
197
 
213
198
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
214
199
#define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
215
 
#ifdef CONFIG_NOT_COHERENT_CACHE
216
 
#define dma_is_consistent(d, h) (0)
217
 
#else
218
 
#define dma_is_consistent(d, h) (1)
219
 
#endif
220
 
 
221
 
static inline int dma_get_cache_alignment(void)
222
 
{
223
 
#ifdef CONFIG_PPC64
224
 
        /* no easy way to get cache size on all processors, so return
225
 
         * the maximum possible, to be safe */
226
 
        return (1 << INTERNODE_CACHE_SHIFT);
227
 
#else
228
 
        /*
229
 
         * Each processor family will define its own L1_CACHE_SHIFT,
230
 
         * L1_CACHE_BYTES wraps to this, so this is always safe.
231
 
         */
232
 
        return L1_CACHE_BYTES;
233
 
#endif
234
 
}
235
200
 
236
201
static inline void dma_cache_sync(struct device *dev, void *vaddr, size_t size,
237
202
                enum dma_data_direction direction)