Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
8a7bcf0d
R
raspberrypi-kernel
项目概览
openeuler
/
raspberrypi-kernel
通知
13
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
raspberrypi-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
8a7bcf0d
编写于
11月 11, 2007
作者:
P
Paul Mundt
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sh: Add SH-5 support to the consistent DMA impl.
Signed-off-by:
N
Paul Mundt
<
lethal@linux-sh.org
>
上级
b613881e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
30 addition
and
20 deletion
+30
-20
arch/sh/mm/consistent.c
arch/sh/mm/consistent.c
+28
-18
include/asm-sh/dma-mapping.h
include/asm-sh/dma-mapping.h
+2
-2
未找到文件。
arch/sh/mm/consistent.c
浏览文件 @
8a7bcf0d
/*
* arch/sh/mm/consistent.c
*
* Copyright (C) 2004 Paul Mundt
* Copyright (C) 2004
- 2007
Paul Mundt
*
* This file is subject to the terms and conditions of the GNU General Public
* License. See the file "COPYING" in the main directory of this archive
...
...
@@ -16,7 +16,7 @@
void
*
consistent_alloc
(
gfp_t
gfp
,
size_t
size
,
dma_addr_t
*
handle
)
{
struct
page
*
page
,
*
end
,
*
free
;
void
*
ret
;
void
*
ret
,
*
vp
;
int
order
;
size
=
PAGE_ALIGN
(
size
);
...
...
@@ -28,13 +28,20 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *handle)
split_page
(
page
,
order
);
ret
=
page_address
(
page
);
memset
(
ret
,
0
,
size
);
*
handle
=
virt_to_phys
(
ret
);
vp
=
ioremap_nocache
(
*
handle
,
size
);
if
(
!
vp
)
{
free_pages
((
unsigned
long
)
ret
,
order
);
return
NULL
;
}
memset
(
vp
,
0
,
size
);
/*
* We must flush the cache before we pass it on to the device
*/
__flush_purge_region
(
ret
,
size
);
dma_cache_sync
(
NULL
,
ret
,
size
,
DMA_BIDIRECTIONAL
);
page
=
virt_to_page
(
ret
);
free
=
page
+
(
size
>>
PAGE_SHIFT
);
...
...
@@ -47,24 +54,31 @@ void *consistent_alloc(gfp_t gfp, size_t size, dma_addr_t *handle)
}
}
return
P2SEGADDR
(
ret
)
;
return
vp
;
}
EXPORT_SYMBOL
(
consistent_alloc
);
void
consistent_free
(
void
*
vaddr
,
size_t
size
)
void
consistent_free
(
void
*
vaddr
,
size_t
size
,
dma_addr_t
dma_handle
)
{
unsigned
long
addr
=
P1SEGADDR
((
unsigned
long
)
vaddr
);
struct
page
*
page
=
virt_to_page
(
addr
);
int
num_pages
=
(
size
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
;
int
i
;
struct
page
*
page
;
unsigned
long
addr
;
for
(
i
=
0
;
i
<
num_pages
;
i
++
)
{
__free_page
((
page
+
i
));
}
addr
=
(
unsigned
long
)
phys_to_virt
((
unsigned
long
)
dma_handle
);
page
=
virt_to_page
(
addr
);
free_pages
(
addr
,
get_order
(
size
));
iounmap
(
vaddr
);
}
EXPORT_SYMBOL
(
consistent_free
);
void
consistent_sync
(
void
*
vaddr
,
size_t
size
,
int
direction
)
{
void
*
p1addr
=
(
void
*
)
P1SEGADDR
((
unsigned
long
)
vaddr
);
#ifdef CONFIG_CPU_SH5
void
*
p1addr
=
vaddr
;
#else
void
*
p1addr
=
(
void
*
)
P1SEGADDR
((
unsigned
long
)
vaddr
);
#endif
switch
(
direction
)
{
case
DMA_FROM_DEVICE
:
/* invalidate only */
...
...
@@ -80,8 +94,4 @@ void consistent_sync(void *vaddr, size_t size, int direction)
BUG
();
}
}
EXPORT_SYMBOL
(
consistent_alloc
);
EXPORT_SYMBOL
(
consistent_free
);
EXPORT_SYMBOL
(
consistent_sync
);
include/asm-sh/dma-mapping.h
浏览文件 @
8a7bcf0d
...
...
@@ -10,7 +10,7 @@ extern struct bus_type pci_bus_type;
/* arch/sh/mm/consistent.c */
extern
void
*
consistent_alloc
(
gfp_t
gfp
,
size_t
size
,
dma_addr_t
*
handle
);
extern
void
consistent_free
(
void
*
vaddr
,
size_t
size
);
extern
void
consistent_free
(
void
*
vaddr
,
size_t
size
,
dma_addr_t
handle
);
extern
void
consistent_sync
(
void
*
vaddr
,
size_t
size
,
int
direction
);
#define dma_supported(dev, mask) (1)
...
...
@@ -50,7 +50,7 @@ static inline void dma_free_coherent(struct device *dev, size_t size,
return
;
}
consistent_free
(
vaddr
,
size
);
consistent_free
(
vaddr
,
size
,
dma_handle
);
}
#define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录