mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-19 19:14:01 +08:00
Alpha: adapt for dma_map_ops changes
Adapt core Alpha architecture code for dma_map_ops changes: replace alloc/free_coherent with generic alloc/free methods. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@samsung.com> Acked-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Matt Turner <mattst88@gmail.com>
This commit is contained in:
parent
c416258a6e
commit
4ce9a91f34
@ -12,16 +12,22 @@ static inline struct dma_map_ops *get_dma_ops(struct device *dev)
|
|||||||
|
|
||||||
#include <asm-generic/dma-mapping-common.h>
|
#include <asm-generic/dma-mapping-common.h>
|
||||||
|
|
||||||
static inline void *dma_alloc_coherent(struct device *dev, size_t size,
|
#define dma_alloc_coherent(d,s,h,f) dma_alloc_attrs(d,s,h,f,NULL)
|
||||||
dma_addr_t *dma_handle, gfp_t gfp)
|
|
||||||
|
static inline void *dma_alloc_attrs(struct device *dev, size_t size,
|
||||||
|
dma_addr_t *dma_handle, gfp_t gfp,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
return get_dma_ops(dev)->alloc_coherent(dev, size, dma_handle, gfp);
|
return get_dma_ops(dev)->alloc(dev, size, dma_handle, gfp, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void dma_free_coherent(struct device *dev, size_t size,
|
#define dma_free_coherent(d,s,c,h) dma_free_attrs(d,s,c,h,NULL)
|
||||||
void *vaddr, dma_addr_t dma_handle)
|
|
||||||
|
static inline void dma_free_attrs(struct device *dev, size_t size,
|
||||||
|
void *vaddr, dma_addr_t dma_handle,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
get_dma_ops(dev)->free_coherent(dev, size, vaddr, dma_handle);
|
get_dma_ops(dev)->free(dev, size, vaddr, dma_handle, attrs);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
static inline int dma_mapping_error(struct device *dev, dma_addr_t dma_addr)
|
||||||
|
@ -108,7 +108,8 @@ sys_pciconfig_write(unsigned long bus, unsigned long dfn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
|
static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
|
||||||
dma_addr_t *dma_handle, gfp_t gfp)
|
dma_addr_t *dma_handle, gfp_t gfp,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
void *ret;
|
void *ret;
|
||||||
|
|
||||||
@ -123,7 +124,8 @@ static void *alpha_noop_alloc_coherent(struct device *dev, size_t size,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void alpha_noop_free_coherent(struct device *dev, size_t size,
|
static void alpha_noop_free_coherent(struct device *dev, size_t size,
|
||||||
void *cpu_addr, dma_addr_t dma_addr)
|
void *cpu_addr, dma_addr_t dma_addr,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
free_pages((unsigned long)cpu_addr, get_order(size));
|
free_pages((unsigned long)cpu_addr, get_order(size));
|
||||||
}
|
}
|
||||||
@ -174,8 +176,8 @@ static int alpha_noop_set_mask(struct device *dev, u64 mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct dma_map_ops alpha_noop_ops = {
|
struct dma_map_ops alpha_noop_ops = {
|
||||||
.alloc_coherent = alpha_noop_alloc_coherent,
|
.alloc = alpha_noop_alloc_coherent,
|
||||||
.free_coherent = alpha_noop_free_coherent,
|
.free = alpha_noop_free_coherent,
|
||||||
.map_page = alpha_noop_map_page,
|
.map_page = alpha_noop_map_page,
|
||||||
.map_sg = alpha_noop_map_sg,
|
.map_sg = alpha_noop_map_sg,
|
||||||
.mapping_error = alpha_noop_mapping_error,
|
.mapping_error = alpha_noop_mapping_error,
|
||||||
|
@ -434,7 +434,8 @@ static void alpha_pci_unmap_page(struct device *dev, dma_addr_t dma_addr,
|
|||||||
else DMA_ADDRP is undefined. */
|
else DMA_ADDRP is undefined. */
|
||||||
|
|
||||||
static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
|
static void *alpha_pci_alloc_coherent(struct device *dev, size_t size,
|
||||||
dma_addr_t *dma_addrp, gfp_t gfp)
|
dma_addr_t *dma_addrp, gfp_t gfp,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = alpha_gendev_to_pci(dev);
|
struct pci_dev *pdev = alpha_gendev_to_pci(dev);
|
||||||
void *cpu_addr;
|
void *cpu_addr;
|
||||||
@ -478,7 +479,8 @@ try_again:
|
|||||||
DMA_ADDR past this call are illegal. */
|
DMA_ADDR past this call are illegal. */
|
||||||
|
|
||||||
static void alpha_pci_free_coherent(struct device *dev, size_t size,
|
static void alpha_pci_free_coherent(struct device *dev, size_t size,
|
||||||
void *cpu_addr, dma_addr_t dma_addr)
|
void *cpu_addr, dma_addr_t dma_addr,
|
||||||
|
struct dma_attrs *attrs)
|
||||||
{
|
{
|
||||||
struct pci_dev *pdev = alpha_gendev_to_pci(dev);
|
struct pci_dev *pdev = alpha_gendev_to_pci(dev);
|
||||||
pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL);
|
pci_unmap_single(pdev, dma_addr, size, PCI_DMA_BIDIRECTIONAL);
|
||||||
@ -952,8 +954,8 @@ static int alpha_pci_set_mask(struct device *dev, u64 mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct dma_map_ops alpha_pci_ops = {
|
struct dma_map_ops alpha_pci_ops = {
|
||||||
.alloc_coherent = alpha_pci_alloc_coherent,
|
.alloc = alpha_pci_alloc_coherent,
|
||||||
.free_coherent = alpha_pci_free_coherent,
|
.free = alpha_pci_free_coherent,
|
||||||
.map_page = alpha_pci_map_page,
|
.map_page = alpha_pci_map_page,
|
||||||
.unmap_page = alpha_pci_unmap_page,
|
.unmap_page = alpha_pci_unmap_page,
|
||||||
.map_sg = alpha_pci_map_sg,
|
.map_sg = alpha_pci_map_sg,
|
||||||
|
Loading…
Reference in New Issue
Block a user