Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 158062
b: refs/heads/master
c: 451d740
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and Ingo Molnar committed Aug 10, 2009
1 parent 5e829d3 commit d07421d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ee664a9252d24ef10317d1bba8fc8f4c6495b36c
refs/heads/master: 451d7400a34cb679369e337d67f0238ed410f484
1 change: 1 addition & 0 deletions trunk/arch/sparc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ config SPARC
select RTC_CLASS
select RTC_DRV_M48T59
select HAVE_DMA_ATTRS
select HAVE_DMA_API_DEBUG

config SPARC32
def_bool !64BIT
Expand Down
6 changes: 5 additions & 1 deletion trunk/arch/sparc/include/asm/dma-mapping.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,19 @@ static inline void *dma_alloc_coherent(struct device *dev, size_t size,
dma_addr_t *dma_handle, gfp_t flag)
{
struct dma_map_ops *ops = get_dma_ops(dev);
void *cpu_addr;

return ops->alloc_coherent(dev, size, dma_handle, flag);
cpu_addr = ops->alloc_coherent(dev, size, dma_handle, flag);
debug_dma_alloc_coherent(dev, size, *dma_handle, cpu_addr);
return cpu_addr;
}

static inline void dma_free_coherent(struct device *dev, size_t size,
void *cpu_addr, dma_addr_t dma_handle)
{
struct dma_map_ops *ops = get_dma_ops(dev);

debug_dma_free_coherent(dev, size, cpu_addr, dma_handle);
ops->free_coherent(dev, size, cpu_addr, dma_handle);
}

Expand Down
2 changes: 1 addition & 1 deletion trunk/arch/sparc/kernel/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ obj-$(CONFIG_SPARC64_SMP) += cpumap.o
obj-$(CONFIG_SPARC32) += devres.o
devres-y := ../../../kernel/irq/devres.o

obj-$(CONFIG_SPARC32) += dma.o
obj-y += dma.o

obj-$(CONFIG_SPARC32_PCI) += pcic.o

Expand Down
37 changes: 5 additions & 32 deletions trunk/arch/sparc/kernel/dma.c
Original file line number Diff line number Diff line change
@@ -1,40 +1,13 @@
/* dma.c: PCI and SBUS DMA accessors for 32-bit sparc.
*
* Copyright (C) 2008 David S. Miller <davem@davemloft.net>
*/

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <linux/scatterlist.h>
#include <linux/mm.h>
#include <linux/dma-debug.h>

#ifdef CONFIG_PCI
#include <linux/pci.h>
#endif
#define PREALLOC_DMA_DEBUG_ENTRIES (1 << 15)

/*
* 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)
static int __init dma_init(void)
{
#ifdef CONFIG_PCI
if (dev->bus == &pci_bus_type)
return 1;
#endif
dma_debug_init(PREALLOC_DMA_DEBUG_ENTRIES);
return 0;
}
EXPORT_SYMBOL(dma_supported);

int dma_set_mask(struct device *dev, u64 dma_mask)
{
#ifdef CONFIG_PCI
if (dev->bus == &pci_bus_type)
return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
#endif
return -EOPNOTSUPP;
}
EXPORT_SYMBOL(dma_set_mask);
fs_initcall(dma_init);
27 changes: 27 additions & 0 deletions trunk/arch/sparc/kernel/ioport.c
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,33 @@ EXPORT_SYMBOL(pci32_dma_ops);

#endif /* CONFIG_PCI */

/*
* 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)
{
#ifdef CONFIG_PCI
if (dev->bus == &pci_bus_type)
return 1;
#endif
return 0;
}
EXPORT_SYMBOL(dma_supported);

int dma_set_mask(struct device *dev, u64 dma_mask)
{
#ifdef CONFIG_PCI
if (dev->bus == &pci_bus_type)
return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
#endif
return -EOPNOTSUPP;
}
EXPORT_SYMBOL(dma_set_mask);


#ifdef CONFIG_PROC_FS

static int
Expand Down

0 comments on commit d07421d

Please sign in to comment.