cregit-Linux how code gets into the kernel

Release 4.7 arch/sparc/kernel/ioport.c

/*
 * ioport.c:  Simple io mapping allocator.
 *
 * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
 * Copyright (C) 1995 Miguel de Icaza (miguel@nuclecu.unam.mx)
 *
 * 1996: sparc_free_io, 1999: ioremap()/iounmap() by Pete Zaitcev.
 *
 * 2000/01/29
 * <rth> zait: as long as pci_alloc_consistent produces something addressable, 
 *      things are ok.
 * <zaitcev> rth: no, it is relevant, because get_free_pages returns you a
 *      pointer into the big page mapping
 * <rth> zait: so what?
 * <rth> zait: remap_it_my_way(virt_to_phys(get_free_page()))
 * <zaitcev> Hmm
 * <zaitcev> Suppose I did this remap_it_my_way(virt_to_phys(get_free_page())).
 *      So far so good.
 * <zaitcev> Now, driver calls pci_free_consistent(with result of
 *      remap_it_my_way()).
 * <zaitcev> How do you find the address to pass to free_pages()?
 * <rth> zait: walk the page tables?  It's only two or three level after all.
 * <rth> zait: you have to walk them anyway to remove the mapping.
 * <zaitcev> Hmm
 * <zaitcev> Sounds reasonable
 */

#include <linux/module.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/ioport.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/pci.h>		/* struct pci_dev */
#include <linux/proc_fs.h>
#include <linux/seq_file.h>
#include <linux/scatterlist.h>
#include <linux/of_device.h>

#include <asm/io.h>
#include <asm/vaddrs.h>
#include <asm/oplib.h>
#include <asm/prom.h>
#include <asm/page.h>
#include <asm/pgalloc.h>
#include <asm/dma.h>
#include <asm/iommu.h>
#include <asm/io-unit.h>
#include <asm/leon.h>


const struct sparc32_dma_ops *sparc32_dma_ops;

/* This function must make sure that caches and memory are coherent after DMA
 * On LEON systems without cache snooping it flushes the entire D-CACHE.
 */

static inline void dma_make_coherent(unsigned long pa, unsigned long len) { if (sparc_cpu_model == sparc_leon) { if (!sparc_leon3_snooping_enabled()) leon_flush_dcache_all(); } }

Contributors

PersonTokensPropCommitsCommitProp
kristoffer glembokristoffer glembo2165.62%250.00%
sam ravnborgsam ravnborg825.00%125.00%
pre-gitpre-git39.38%125.00%
Total32100.00%4100.00%

static void __iomem *_sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz); static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, unsigned long size, char *name); static void _sparc_free_io(struct resource *res); static void register_proc_sparc_ioport(void); /* This points to the next to use virtual memory for DVMA mappings */ static struct resource _sparc_dvma = { .name = "sparc_dvma", .start = DVMA_VADDR, .end = DVMA_END - 1 }; /* This points to the start of I/O mappings, cluable from outside. */ /*ext*/ struct resource sparc_iomap = { .name = "sparc_iomap", .start = IOBASE_VADDR, .end = IOBASE_END - 1 }; /* * Our mini-allocator... * Boy this is gross! We need it because we must map I/O for * timers and interrupt controller before the kmalloc is available. */ #define XNMLN 15 #define XNRES 10 /* SS-10 uses 8 */ struct xresource { struct resource xres; /* Must be first */ int xflag; /* 1 == used */ char xname[XNMLN+1]; }; static struct xresource xresv[XNRES];
static struct xresource *xres_alloc(void) { struct xresource *xrp; int n; xrp = xresv; for (n = 0; n < XNRES; n++) { if (xrp->xflag == 0) { xrp->xflag = 1; return xrp; } xrp++; } return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git62100.00%2100.00%
Total62100.00%2100.00%


static void xres_free(struct xresource *xrp) { xrp->xflag = 0; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git17100.00%2100.00%
Total17100.00%2100.00%

/* * These are typically used in PCI drivers * which are trying to be cross-platform. * * Bus type is always zero on IIep. */
void __iomem *ioremap(unsigned long offset, unsigned long size) { char name[14]; sprintf(name, "phys_%08x", (u32)offset); return _sparc_alloc_io(0, offset, size, name); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git4497.78%375.00%
al viroal viro12.22%125.00%
Total45100.00%4100.00%

EXPORT_SYMBOL(ioremap); /* * Complementary to ioremap(). */
void iounmap(volatile void __iomem *virtual) { unsigned long vaddr = (unsigned long) virtual & PAGE_MASK; struct resource *res; /* * XXX Too slow. Can have 8192 DVMA pages on sun4m in the worst case. * This probably warrants some sort of hashing. */ if ((res = lookup_resource(&sparc_iomap, vaddr)) == NULL) { printk("free_io/iounmap: cannot free %lx\n", vaddr); return; } _sparc_free_io(res); if ((char *)res >= (char*)xresv && (char *)res < (char *)&xresv[XNRES]) { xres_free((struct xresource *)res); } else { kfree(res); } }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git10696.36%250.00%
al viroal viro21.82%125.00%
geert uytterhoevengeert uytterhoeven21.82%125.00%
Total110100.00%4100.00%

EXPORT_SYMBOL(iounmap);
void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name) { return _sparc_alloc_io(res->flags & 0xF, res->start + offset, size, name); }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller44100.00%1100.00%
Total44100.00%1100.00%

EXPORT_SYMBOL(of_ioremap);
void of_iounmap(struct resource *res, void __iomem *base, unsigned long size) { iounmap(base); }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller24100.00%2100.00%
Total24100.00%2100.00%

EXPORT_SYMBOL(of_iounmap); /* * Meat of mapping */
static void __iomem *_sparc_alloc_io(unsigned int busno, unsigned long phys, unsigned long size, char *name) { static int printed_full; struct xresource *xres; struct resource *res; char *tack; int tlen; void __iomem *va; /* P3 diag */ if (name == NULL) name = "???"; if ((xres = xres_alloc()) != NULL) { tack = xres->xname; res = &xres->xres; } else { if (!printed_full) { printk("ioremap: done with statics, switching to malloc\n"); printed_full = 1; } tlen = strlen(name); tack = kmalloc(sizeof (struct resource) + tlen + 1, GFP_KERNEL); if (tack == NULL) return NULL; memset(tack, 0, sizeof(struct resource)); res = (struct resource *) tack; tack += sizeof (struct resource); } strlcpy(tack, name, XNMLN+1); res->name = tack; va = _sparc_ioremap(res, busno, phys, size); /* printk("ioremap(0x%x:%08lx[0x%lx])=%p\n", busno, phys, size, va); */ /* P3 diag */ return va; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git19897.06%562.50%
ben collinsben collins31.47%112.50%
al viroal viro20.98%112.50%
sam ravnborgsam ravnborg10.49%112.50%
Total204100.00%8100.00%

/* */
static void __iomem * _sparc_ioremap(struct resource *res, u32 bus, u32 pa, int sz) { unsigned long offset = ((unsigned long) pa) & (~PAGE_MASK); if (allocate_resource(&sparc_iomap, res, (offset + sz + PAGE_SIZE-1) & PAGE_MASK, sparc_iomap.start, sparc_iomap.end, PAGE_SIZE, NULL, NULL) != 0) { /* Usually we cannot see printks in this case. */ prom_printf("alloc_io_res(%s): cannot occupy\n", (res->name != NULL)? res->name: "???"); prom_halt(); } pa &= PAGE_MASK; srmmu_mapiorange(bus, pa, res->start, resource_size(res)); return (void __iomem *)(unsigned long)(res->start + offset); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git12387.86%337.50%
greg kroah-hartmangreg kroah-hartman64.29%112.50%
pete zaitcevpete zaitcev53.57%112.50%
joe perchesjoe perches32.14%112.50%
al viroal viro21.43%112.50%
sam ravnborgsam ravnborg10.71%112.50%
Total140100.00%8100.00%

/* * Complementary to _sparc_ioremap(). */
static void _sparc_free_io(struct resource *res) { unsigned long plen; plen = resource_size(res); BUG_ON((plen & (PAGE_SIZE-1)) != 0); srmmu_unmapiorange(res->start, plen); release_resource(res); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git4078.43%233.33%
pete zaitcevpete zaitcev47.84%116.67%
joe perchesjoe perches35.88%116.67%
eric sesterhenneric sesterhenn35.88%116.67%
sam ravnborgsam ravnborg11.96%116.67%
Total51100.00%6100.00%

#ifdef CONFIG_SBUS
void sbus_set_sbus64(struct device *dev, int x) { printk("sbus_set_sbus64: unsupported\n"); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1688.89%150.00%
david s. millerdavid s. miller211.11%150.00%
Total18100.00%2100.00%

EXPORT_SYMBOL(sbus_set_sbus64); /* * Allocate a chunk of memory suitable for DMA. * Typically devices use them for control blocks. * CPU may access them without any explicit flushing. */
static void *sbus_alloc_coherent(struct device *dev, size_t len, dma_addr_t *dma_addrp, gfp_t gfp, struct dma_attrs *attrs) { struct platform_device *op = to_platform_device(dev); unsigned long len_total = PAGE_ALIGN(len); unsigned long va; struct resource *res; int order; /* XXX why are some lengths signed, others unsigned? */ if (len <= 0) { return NULL; } /* XXX So what is maxphys for us and how do drivers know it? */ if (len > 256*1024) { /* __get_free_pages() limit */ return NULL; } order = get_order(len_total); va = __get_free_pages(gfp, order); if (va == 0) goto err_nopages; if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) goto err_nomem; if (allocate_resource(&_sparc_dvma, res, len_total, _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { printk("sbus_alloc_consistent: cannot occupy 0x%lx", len_total); goto err_nova; } // XXX The sbus_map_dma_area does this for us below, see comments. // srmmu_mapiorange(0, virt_to_phys(va), res->start, len_total); /* * XXX That's where sdev would be used. Currently we load * all iommu tables with the same translations. */ if (sbus_map_dma_area(dev, dma_addrp, va, res->start, len_total) != 0) goto err_noiommu; res->name = op->dev.of_node->name; return (void *)(unsigned long)res->start; err_noiommu: release_resource(res); err_nova: kfree(res); err_nomem: free_pages(va, order); err_nopages: return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git14658.40%627.27%
pete zaitcevpete zaitcev4317.20%14.55%
david s. millerdavid s. miller176.80%313.64%
kristoffer glembokristoffer glembo93.60%29.09%
fujita tomonorifujita tomonori72.80%14.55%
martin habetsmartin habets62.40%14.55%
grant likelygrant likely52.00%29.09%
daniel hellstromdaniel hellstrom52.00%14.55%
andrzej pietrasiewiczandrzej pietrasiewicz52.00%14.55%
greg kroah-hartmangreg kroah-hartman41.60%14.55%
yan burmanyan burman10.40%14.55%
sam ravnborgsam ravnborg10.40%14.55%
paulius zaleckaspaulius zaleckas10.40%14.55%
Total250100.00%22100.00%


static void sbus_free_coherent(struct device *dev, size_t n, void *p, dma_addr_t ba, struct dma_attrs *attrs) { struct resource *res; struct page *pgv; if ((res = lookup_resource(&_sparc_dvma, (unsigned long)p)) == NULL) { printk("sbus_free_consistent: cannot free %p\n", p); return; } if (((unsigned long)p & (PAGE_SIZE-1)) != 0) { printk("sbus_free_consistent: unaligned va %p\n", p); return; } n = PAGE_ALIGN(n); if (resource_size(res) != n) { printk("sbus_free_consistent: region 0x%lx asked 0x%zx\n", (long)resource_size(res), n); return; } release_resource(res); kfree(res); pgv = virt_to_page(p); sbus_unmap_dma_area(dev, ba, n); __free_pages(pgv, get_order(n)); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git13079.27%533.33%
pete zaitcevpete zaitcev74.27%16.67%
david s. millerdavid s. miller74.27%426.67%
joe perchesjoe perches63.66%16.67%
fujita tomonorifujita tomonori53.05%16.67%
andrzej pietrasiewiczandrzej pietrasiewicz53.05%16.67%
kristoffer glembokristoffer glembo31.83%16.67%
geert uytterhoevengeert uytterhoeven10.61%16.67%
Total164100.00%15100.00%

/* * Map a chunk of memory so that devices can see it. * CPU view of this memory may be inconsistent with * a device view and explicit flushing is necessary. */
static dma_addr_t sbus_map_page(struct device *dev, struct page *page, unsigned long offset, size_t len, enum dma_data_direction dir, struct dma_attrs *attrs) { void *va = page_address(page) + offset; /* XXX why are some lengths signed, others unsigned? */ if (len <= 0) { return 0; } /* XXX So what is maxphys for us and how do drivers know it? */ if (len > 256*1024) { /* __get_free_pages() limit */ return 0; } return mmu_get_scsi_one(dev, va, len); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git4556.25%225.00%
fujita tomonorifujita tomonori2835.00%225.00%
david s. millerdavid s. miller67.50%337.50%
paulius zaleckaspaulius zaleckas11.25%112.50%
Total80100.00%8100.00%


static void sbus_unmap_page(struct device *dev, dma_addr_t ba, size_t n, enum dma_data_direction dir, struct dma_attrs *attrs) { mmu_release_scsi_one(dev, ba, n); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git1954.29%228.57%
fujita tomonorifujita tomonori1028.57%228.57%
david s. millerdavid s. miller617.14%342.86%
Total35100.00%7100.00%


static int sbus_map_sg(struct device *dev, struct scatterlist *sg, int n, enum dma_data_direction dir, struct dma_attrs *attrs) { mmu_get_scsi_sgl(dev, sg, n); return n; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git2767.50%350.00%
fujita tomonorifujita tomonori922.50%116.67%
david s. millerdavid s. miller410.00%233.33%
Total40100.00%6100.00%


static void sbus_unmap_sg(struct device *dev, struct scatterlist *sg, int n, enum dma_data_direction dir, struct dma_attrs *attrs) { mmu_release_scsi_sgl(dev, sg, n); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git2464.86%240.00%
fujita tomonorifujita tomonori924.32%120.00%
david s. millerdavid s. miller410.81%240.00%
Total37100.00%5100.00%


static void sbus_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int n, enum dma_data_direction dir) { BUG(); }

Contributors

PersonTokensPropCommitsCommitProp
fujita tomonorifujita tomonori1661.54%125.00%
pre-gitpre-git830.77%250.00%
david s. millerdavid s. miller27.69%125.00%
Total26100.00%4100.00%


static void sbus_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int n, enum dma_data_direction dir) { BUG(); }

Contributors

PersonTokensPropCommitsCommitProp
fujita tomonorifujita tomonori1661.54%125.00%
andrew mortonandrew morton726.92%125.00%
david s. millerdavid s. miller27.69%125.00%
pre-gitpre-git13.85%125.00%
Total26100.00%4100.00%

static struct dma_map_ops sbus_dma_ops = { .alloc = sbus_alloc_coherent, .free = sbus_free_coherent, .map_page = sbus_map_page, .unmap_page = sbus_unmap_page, .map_sg = sbus_map_sg, .unmap_sg = sbus_unmap_sg, .sync_sg_for_cpu = sbus_sync_sg_for_cpu, .sync_sg_for_device = sbus_sync_sg_for_device, };
static int __init sparc_register_ioport(void) { register_proc_sparc_ioport(); return 0; }

Contributors

PersonTokensPropCommitsCommitProp
david s. millerdavid s. miller15100.00%2100.00%
Total15100.00%2100.00%

arch_initcall(sparc_register_ioport); #endif /* CONFIG_SBUS */ /* Allocate and map kernel buffer using consistent mode DMA for a device. * hwdev should be valid struct pci_dev pointer for PCI devices. */
static void *pci32_alloc_coherent(struct device *dev, size_t len, dma_addr_t *pba, gfp_t gfp, struct dma_attrs *attrs) { unsigned long len_total = PAGE_ALIGN(len); void *va; struct resource *res; int order; if (len == 0) { return NULL; } if (len > 256*1024) { /* __get_free_pages() limit */ return NULL; } order = get_order(len_total); va = (void *) __get_free_pages(gfp, order); if (va == NULL) { printk("pci_alloc_consistent: no %ld pages\n", len_total>>PAGE_SHIFT); goto err_nopages; } if ((res = kzalloc(sizeof(struct resource), GFP_KERNEL)) == NULL) { printk("pci_alloc_consistent: no core\n"); goto err_nomem; } if (allocate_resource(&_sparc_dvma, res, len_total, _sparc_dvma.start, _sparc_dvma.end, PAGE_SIZE, NULL, NULL) != 0) { printk("pci_alloc_consistent: cannot occupy 0x%lx", len_total); goto err_nova; } srmmu_mapiorange(0, virt_to_phys(va), res->start, len_total); *pba = virt_to_phys(va); /* equals virt_to_bus (R.I.P.) for us. */ return (void *) res->start; err_nova: kfree(res); err_nomem: free_pages((unsigned long)va, order); err_nopages: return NULL; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git17371.78%430.77%
kristoffer glembokristoffer glembo4418.26%215.38%
pete zaitcevpete zaitcev93.73%215.38%
fujita tomonorifujita tomonori72.90%17.69%
andrzej pietrasiewiczandrzej pietrasiewicz52.07%17.69%
sam ravnborgsam ravnborg10.41%17.69%
yan burmanyan burman10.41%17.69%
daniel hellstromdaniel hellstrom10.41%17.69%
Total241100.00%13100.00%

/* Free and unmap a consistent DMA buffer. * cpu_addr is what was returned from pci_alloc_consistent, * size must be the same as what as passed into pci_alloc_consistent, * and likewise dma_addr must be the same as what *dma_addrp was set to. * * References to the memory and mappings associated with cpu_addr/dma_addr * past this call are illegal. */
static void pci32_free_coherent(struct device *dev, size_t n, void *p, dma_addr_t ba, struct dma_attrs *attrs) { struct resource *res; if ((res = lookup_resource(&_sparc_dvma, (unsigned long)p)) == NULL) { printk("pci_free_consistent: cannot free %p\n", p); return; } if (((unsigned long)p & (PAGE_SIZE-1)) != 0) { printk("pci_free_consistent: unaligned va %p\n", p); return; } n = PAGE_ALIGN(n); if (resource_size(res) != n) { printk("pci_free_consistent: region 0x%lx asked 0x%lx\n", (long)resource_size(res), (long)n); return; } dma_make_coherent(ba, n); srmmu_unmapiorange((unsigned long)p, n); release_resource(res); kfree(res); free_pages((unsigned long)phys_to_virt(ba), get_order(n)); }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git14182.46%430.77%
kristoffer glembokristoffer glembo127.02%323.08%
joe perchesjoe perches63.51%17.69%
andrzej pietrasiewiczandrzej pietrasiewicz52.92%17.69%
fujita tomonorifujita tomonori42.34%17.69%
geert uytterhoevengeert uytterhoeven10.58%17.69%
sam ravnborgsam ravnborg10.58%17.69%
pete zaitcevpete zaitcev10.58%17.69%
Total171100.00%13100.00%

/* * Same as pci_map_single, but with pages. */
static dma_addr_t pci32_map_page(struct device *dev, struct page *page, unsigned long offset, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { /* IIep is write-through, not flushing. */ return page_to_phys(page) + offset; }

Contributors

PersonTokensPropCommitsCommitProp
pete zaitcevpete zaitcev2970.73%150.00%
fujita tomonorifujita tomonori1229.27%150.00%
Total41100.00%2100.00%


static void pci32_unmap_page(struct device *dev, dma_addr_t ba, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { if (dir != PCI_DMA_TODEVICE) dma_make_coherent(ba, PAGE_ALIGN(size)); }

Contributors

PersonTokensPropCommitsCommitProp
kristoffer glembokristoffer glembo42100.00%2100.00%
Total42100.00%2100.00%

/* Map a set of buffers described by scatterlist in streaming * mode for DMA. This is the scatter-gather version of the * above pci_map_single interface. Here the scatter gather list * elements are each tagged with the appropriate dma address * and length. They are obtained via sg_dma_{address,length}(SG). * * NOTE: An implementation may be able to use a smaller number of * DMA address/length pairs than there are SG table elements. * (for example via virtual mapping capabilities) * The routine returns the number of addr/length pairs actually * used, at most nents. * * Device ownership issues as mentioned above for pci_map_single are * the same here. */
static int pci32_map_sg(struct device *device, struct scatterlist *sgl, int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { struct scatterlist *sg; int n; /* IIep is write-through, not flushing. */ for_each_sg(sgl, sg, nents, n) { sg->dma_address = sg_phys(sg); sg->dma_length = sg->length; } return nents; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git3753.62%337.50%
jens axboejens axboe1623.19%112.50%
fujita tomonorifujita tomonori1217.39%112.50%
robert reifrobert reif22.90%112.50%
pete zaitcevpete zaitcev11.45%112.50%
kristoffer glembokristoffer glembo11.45%112.50%
Total69100.00%8100.00%

/* Unmap a set of streaming mode DMA translations. * Again, cpu read rules concerning calls here are the same as for * pci_unmap_single() above. */
static void pci32_unmap_sg(struct device *dev, struct scatterlist *sgl, int nents, enum dma_data_direction dir, struct dma_attrs *attrs) { struct scatterlist *sg; int n; if (dir != PCI_DMA_TODEVICE) { for_each_sg(sgl, sg, nents, n) { dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length)); } } }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git3346.48%333.33%
jens axboejens axboe1825.35%222.22%
fujita tomonorifujita tomonori1318.31%111.11%
kristoffer glembokristoffer glembo57.04%222.22%
pete zaitcevpete zaitcev22.82%111.11%
Total71100.00%9100.00%

/* Make physical memory consistent for a single * streaming mode DMA translation before or after a transfer. * * If you perform a pci_map_single() but wish to interrogate the * buffer using the cpu, yet do not wish to teardown the PCI dma * mapping, you must call this function before doing so. At the * next point you give the PCI dma address back to the card, you * must first perform a pci_dma_sync_for_device, and then the * device again owns the buffer. */
static void pci32_sync_single_for_cpu(struct device *dev, dma_addr_t ba, size_t size, enum dma_data_direction dir) { if (dir != PCI_DMA_TODEVICE) { dma_make_coherent(ba, PAGE_ALIGN(size)); } }

Contributors

PersonTokensPropCommitsCommitProp
andrew mortonandrew morton2769.23%125.00%
fujita tomonorifujita tomonori820.51%125.00%
kristoffer glembokristoffer glembo410.26%250.00%
Total39100.00%4100.00%


static void pci32_sync_single_for_device(struct device *dev, dma_addr_t ba, size_t size, enum dma_data_direction dir) { if (dir != PCI_DMA_TODEVICE) { dma_make_coherent(ba, PAGE_ALIGN(size)); } }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git2769.23%350.00%
fujita tomonorifujita tomonori820.51%116.67%
kristoffer glembokristoffer glembo410.26%233.33%
Total39100.00%6100.00%

/* Make physical memory consistent for a set of streaming * mode DMA translations after a transfer. * * The same as pci_dma_sync_single_* but for a scatter-gather list, * same rules and usage. */
static void pci32_sync_sg_for_cpu(struct device *dev, struct scatterlist *sgl, int nents, enum dma_data_direction dir) { struct scatterlist *sg; int n; if (dir != PCI_DMA_TODEVICE) { for_each_sg(sgl, sg, nents, n) { dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length)); } } }

Contributors

PersonTokensPropCommitsCommitProp
andrew mortonandrew morton3553.03%116.67%
jens axboejens axboe1827.27%233.33%
fujita tomonorifujita tomonori812.12%116.67%
kristoffer glembokristoffer glembo57.58%233.33%
Total66100.00%6100.00%


static void pci32_sync_sg_for_device(struct device *device, struct scatterlist *sgl, int nents, enum dma_data_direction dir) { struct scatterlist *sg; int n; if (dir != PCI_DMA_TODEVICE) { for_each_sg(sgl, sg, nents, n) { dma_make_coherent(sg_phys(sg), PAGE_ALIGN(sg->length)); } } }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git3350.00%333.33%
jens axboejens axboe1827.27%222.22%
fujita tomonorifujita tomonori812.12%111.11%
kristoffer glembokristoffer glembo57.58%222.22%
pete zaitcevpete zaitcev23.03%111.11%
Total66100.00%9100.00%

struct dma_map_ops pci32_dma_ops = { .alloc = pci32_alloc_coherent, .free = pci32_free_coherent, .map_page = pci32_map_page, .unmap_page = pci32_unmap_page, .map_sg = pci32_map_sg, .unmap_sg = pci32_unmap_sg, .sync_single_for_cpu = pci32_sync_single_for_cpu, .sync_single_for_device = pci32_sync_single_for_device, .sync_sg_for_cpu = pci32_sync_sg_for_cpu, .sync_sg_for_device = pci32_sync_sg_for_device, }; EXPORT_SYMBOL(pci32_dma_ops); /* leon re-uses pci32_dma_ops */ struct dma_map_ops *leon_dma_ops = &pci32_dma_ops; EXPORT_SYMBOL(leon_dma_ops); struct dma_map_ops *dma_ops = &sbus_dma_ops; EXPORT_SYMBOL(dma_ops); /* * Return whether the given PCI device DMA address mask can be * supported properly. For example, if your device can only drive the * low 24-bits during PCI bus mastering, then you would pass * 0x00ffffff as the mask to this function. */
int dma_supported(struct device *dev, u64 mask) { if (dev_is_pci(dev)) return 1; return 0; }

Contributors

PersonTokensPropCommitsCommitProp
fujita tomonorifujita tomonori2388.46%150.00%
wang yijingwang yijing311.54%150.00%
Total26100.00%2100.00%

EXPORT_SYMBOL(dma_supported); #ifdef CONFIG_PROC_FS
static int sparc_io_proc_show(struct seq_file *m, void *v) { struct resource *root = m->private, *r; const char *nm; for (r = root->child; r != NULL; r = r->sibling) { if ((nm = r->name) == NULL) nm = "???"; seq_printf(m, "%016llx-%016llx: %s\n", (unsigned long long)r->start, (unsigned long long)r->end, nm); } return 0; }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git6970.41%125.00%
alexey dobriyanalexey dobriyan1717.35%125.00%
greg kroah-hartmangreg kroah-hartman1111.22%125.00%
sam ravnborgsam ravnborg11.02%125.00%
Total98100.00%4100.00%


static int sparc_io_proc_open(struct inode *inode, struct file *file) { return single_open(file, sparc_io_proc_show, PDE_DATA(inode)); }

Contributors

PersonTokensPropCommitsCommitProp
alexey dobriyanalexey dobriyan2689.66%133.33%
pre-gitpre-git26.90%133.33%
al viroal viro13.45%133.33%
Total29100.00%3100.00%

static const struct file_operations sparc_io_proc_fops = { .owner = THIS_MODULE, .open = sparc_io_proc_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; #endif /* CONFIG_PROC_FS */
static void register_proc_sparc_ioport(void) { #ifdef CONFIG_PROC_FS proc_create_data("io_map", 0, NULL, &sparc_io_proc_fops, &sparc_iomap); proc_create_data("dvma_map", 0, NULL, &sparc_io_proc_fops, &_sparc_dvma); #endif }

Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git3479.07%350.00%
alexey dobriyanalexey dobriyan613.95%116.67%
al viroal viro24.65%116.67%
adrian bunkadrian bunk12.33%116.67%
Total43100.00%6100.00%


Overall Contributors

PersonTokensPropCommitsCommitProp
pre-gitpre-git173959.55%1822.22%
fujita tomonorifujita tomonori30310.38%33.70%
kristoffer glembokristoffer glembo1816.20%78.64%
david s. millerdavid s. miller1735.92%1316.05%
pete zaitcevpete zaitcev1043.56%33.70%
alexey dobriyanalexey dobriyan1033.53%22.47%
jens axboejens axboe732.50%22.47%
andrew mortonandrew morton712.43%11.23%
sam ravnborgsam ravnborg371.27%56.17%
andrzej pietrasiewiczandrzej pietrasiewicz240.82%11.23%
greg kroah-hartmangreg kroah-hartman210.72%22.47%
joe perchesjoe perches180.62%11.23%
al viroal viro120.41%33.70%
adrian bunkadrian bunk100.34%22.47%
daniel hellstromdaniel hellstrom60.21%11.23%
martin habetsmartin habets60.21%11.23%
stephen rothwellstephen rothwell50.17%11.23%
grant likelygrant likely50.17%22.47%
geert uytterhoevengeert uytterhoeven40.14%11.23%
konrad eiselekonrad eisele30.10%11.23%
eric sesterhenneric sesterhenn30.10%11.23%
adam buchbinderadam buchbinder30.10%11.23%
ben collinsben collins30.10%11.23%
wang yijingwang yijing30.10%11.23%
robert reifrobert reif20.07%11.23%
linus torvaldslinus torvalds20.07%22.47%
yan burmanyan burman20.07%11.23%
paulius zaleckaspaulius zaleckas20.07%11.23%
keith m. wesolowskikeith m. wesolowski10.03%11.23%
simon arlottsimon arlott10.03%11.23%
Total2920100.00%81100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}