Release 4.14 arch/frv/mb93090-mb00/pci-dma.c
/* pci-dma.c: Dynamic DMA mapping support for the FRV CPUs that have MMUs
*
* Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
* Written by David Howells (dhowells@redhat.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
*/
#include <linux/types.h>
#include <linux/dma-mapping.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/export.h>
#include <linux/highmem.h>
#include <linux/scatterlist.h>
#include <asm/io.h>
static void *frv_dma_alloc(struct device *hwdev, size_t size,
dma_addr_t *dma_handle, gfp_t gfp, unsigned long attrs)
{
void *ret;
ret = consistent_alloc(gfp, size, dma_handle);
if (ret)
memset(ret, 0, size);
return ret;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Howells | 50 | 87.72% | 1 | 25.00% |
Christoph Hellwig | 4 | 7.02% | 1 | 25.00% |
Krzysztof Kozlowski | 2 | 3.51% | 1 | 25.00% |
Al Viro | 1 | 1.75% | 1 | 25.00% |
Total | 57 | 100.00% | 4 | 100.00% |
static void frv_dma_free(struct device *hwdev, size_t size, void *vaddr,
dma_addr_t dma_handle, unsigned long attrs)
{
consistent_free(vaddr);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Howells | 23 | 76.67% | 2 | 50.00% |
Christoph Hellwig | 5 | 16.67% | 1 | 25.00% |
Krzysztof Kozlowski | 2 | 6.67% | 1 | 25.00% |
Total | 30 | 100.00% | 4 | 100.00% |
static int frv_dma_map_sg(struct device *dev, struct scatterlist *sglist,
int nents, enum dma_data_direction direction,
unsigned long attrs)
{
struct scatterlist *sg;
unsigned long dampr2;
void *vaddr;
int i;
BUG_ON(direction == DMA_NONE);
if (attrs & DMA_ATTR_SKIP_CPU_SYNC)
return nents;
dampr2 = __get_DAMPR(2);
for_each_sg(sglist, sg, nents, i) {
vaddr = kmap_atomic_primary(sg_page(sg));
frv_dcache_writeback((unsigned long) vaddr,
(unsigned long) vaddr + PAGE_SIZE);
}
kunmap_atomic_primary(vaddr);
if (dampr2) {
__set_DAMPR(2, dampr2);
__set_IAMPR(2, dampr2);
}
return nents;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Howells | 94 | 70.68% | 2 | 22.22% |
Alexander Duyck | 14 | 10.53% | 1 | 11.11% |
Akinobu Mita | 11 | 8.27% | 1 | 11.11% |
Christoph Hellwig | 4 | 3.01% | 1 | 11.11% |
Stoyan Gaydarov | 3 | 2.26% | 1 | 11.11% |
Al Viro | 3 | 2.26% | 1 | 11.11% |
Krzysztof Kozlowski | 2 | 1.50% | 1 | 11.11% |
Peter Zijlstra | 2 | 1.50% | 1 | 11.11% |
Total | 133 | 100.00% | 9 | 100.00% |
static dma_addr_t frv_dma_map_page(struct device *dev, struct page *page,
unsigned long offset, size_t size,
enum dma_data_direction direction, unsigned long attrs)
{
if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC))
flush_dcache_page(page);
return (dma_addr_t) page_to_phys(page) + offset;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Howells | 41 | 73.21% | 2 | 40.00% |
Alexander Duyck | 9 | 16.07% | 1 | 20.00% |
Christoph Hellwig | 4 | 7.14% | 1 | 20.00% |
Krzysztof Kozlowski | 2 | 3.57% | 1 | 20.00% |
Total | 56 | 100.00% | 5 | 100.00% |
static void frv_dma_sync_single_for_device(struct device *dev,
dma_addr_t dma_handle, size_t size,
enum dma_data_direction direction)
{
flush_write_buffers();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Christoph Hellwig | 24 | 100.00% | 1 | 100.00% |
Total | 24 | 100.00% | 1 | 100.00% |
static void frv_dma_sync_sg_for_device(struct device *dev,
struct scatterlist *sg, int nelems,
enum dma_data_direction direction)
{
flush_write_buffers();
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Christoph Hellwig | 26 | 100.00% | 1 | 100.00% |
Total | 26 | 100.00% | 1 | 100.00% |
static int frv_dma_supported(struct device *dev, u64 mask)
{
/*
* we fall back to GFP_DMA when the mask isn't all 1s,
* so we can't guarantee allocations that must be
* within a tighter range than GFP_DMA..
*/
if (mask < 0x00ffffff)
return 0;
return 1;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Christoph Hellwig | 27 | 100.00% | 1 | 100.00% |
Total | 27 | 100.00% | 1 | 100.00% |
const struct dma_map_ops frv_dma_ops = {
.alloc = frv_dma_alloc,
.free = frv_dma_free,
.map_page = frv_dma_map_page,
.map_sg = frv_dma_map_sg,
.sync_single_for_device = frv_dma_sync_single_for_device,
.sync_sg_for_device = frv_dma_sync_sg_for_device,
.dma_supported = frv_dma_supported,
};
EXPORT_SYMBOL(frv_dma_ops);
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
David Howells | 231 | 54.35% | 3 | 23.08% |
Christoph Hellwig | 136 | 32.00% | 1 | 7.69% |
Alexander Duyck | 23 | 5.41% | 1 | 7.69% |
Akinobu Mita | 11 | 2.59% | 1 | 7.69% |
Krzysztof Kozlowski | 8 | 1.88% | 1 | 7.69% |
Al Viro | 7 | 1.65% | 2 | 15.38% |
Paul Gortmaker | 3 | 0.71% | 1 | 7.69% |
Stoyan Gaydarov | 3 | 0.71% | 1 | 7.69% |
Peter Zijlstra | 2 | 0.47% | 1 | 7.69% |
Bart Van Assche | 1 | 0.24% | 1 | 7.69% |
Total | 425 | 100.00% | 13 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.