Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
cloud-kernel
提交
dbfd49fe
cloud-kernel
项目概览
openanolis
/
cloud-kernel
1 年多 前同步成功
通知
160
Star
36
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
10
列表
看板
标记
里程碑
合并请求
2
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
cloud-kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
10
Issue
10
列表
看板
标记
里程碑
合并请求
2
合并请求
2
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
dbfd49fe
编写于
5月 11, 2007
作者:
J
Jens Axboe
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
swiotlb: sg chaining support
Signed-off-by:
N
Jens Axboe
<
jens.axboe@oracle.com
>
上级
38d37556
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
12 addition
and
7 deletion
+12
-7
lib/swiotlb.c
lib/swiotlb.c
+12
-7
未找到文件。
lib/swiotlb.c
浏览文件 @
dbfd49fe
...
@@ -677,16 +677,17 @@ swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
...
@@ -677,16 +677,17 @@ swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
* same here.
* same here.
*/
*/
int
int
swiotlb_map_sg
(
struct
device
*
hwdev
,
struct
scatterlist
*
sg
,
int
nelems
,
swiotlb_map_sg
(
struct
device
*
hwdev
,
struct
scatterlist
*
sg
l
,
int
nelems
,
int
dir
)
int
dir
)
{
{
struct
scatterlist
*
sg
;
void
*
addr
;
void
*
addr
;
dma_addr_t
dev_addr
;
dma_addr_t
dev_addr
;
int
i
;
int
i
;
BUG_ON
(
dir
==
DMA_NONE
);
BUG_ON
(
dir
==
DMA_NONE
);
for
(
i
=
0
;
i
<
nelems
;
i
++
,
sg
++
)
{
for
_each_sg
(
sgl
,
sg
,
nelems
,
i
)
{
addr
=
SG_ENT_VIRT_ADDRESS
(
sg
);
addr
=
SG_ENT_VIRT_ADDRESS
(
sg
);
dev_addr
=
virt_to_bus
(
addr
);
dev_addr
=
virt_to_bus
(
addr
);
if
(
swiotlb_force
||
address_needs_mapping
(
hwdev
,
dev_addr
))
{
if
(
swiotlb_force
||
address_needs_mapping
(
hwdev
,
dev_addr
))
{
...
@@ -696,7 +697,7 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
...
@@ -696,7 +697,7 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
to do proper error handling. */
to do proper error handling. */
swiotlb_full
(
hwdev
,
sg
->
length
,
dir
,
0
);
swiotlb_full
(
hwdev
,
sg
->
length
,
dir
,
0
);
swiotlb_unmap_sg
(
hwdev
,
sg
-
i
,
i
,
dir
);
swiotlb_unmap_sg
(
hwdev
,
sg
-
i
,
i
,
dir
);
sg
[
0
].
dma_length
=
0
;
sg
l
[
0
].
dma_length
=
0
;
return
0
;
return
0
;
}
}
sg
->
dma_address
=
virt_to_bus
(
map
);
sg
->
dma_address
=
virt_to_bus
(
map
);
...
@@ -712,19 +713,21 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
...
@@ -712,19 +713,21 @@ swiotlb_map_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
* concerning calls here are the same as for swiotlb_unmap_single() above.
* concerning calls here are the same as for swiotlb_unmap_single() above.
*/
*/
void
void
swiotlb_unmap_sg
(
struct
device
*
hwdev
,
struct
scatterlist
*
sg
,
int
nelems
,
swiotlb_unmap_sg
(
struct
device
*
hwdev
,
struct
scatterlist
*
sg
l
,
int
nelems
,
int
dir
)
int
dir
)
{
{
struct
scatterlist
*
sg
;
int
i
;
int
i
;
BUG_ON
(
dir
==
DMA_NONE
);
BUG_ON
(
dir
==
DMA_NONE
);
for
(
i
=
0
;
i
<
nelems
;
i
++
,
sg
++
)
for
_each_sg
(
sgl
,
sg
,
nelems
,
i
)
{
if
(
sg
->
dma_address
!=
SG_ENT_PHYS_ADDRESS
(
sg
))
if
(
sg
->
dma_address
!=
SG_ENT_PHYS_ADDRESS
(
sg
))
unmap_single
(
hwdev
,
bus_to_virt
(
sg
->
dma_address
),
unmap_single
(
hwdev
,
bus_to_virt
(
sg
->
dma_address
),
sg
->
dma_length
,
dir
);
sg
->
dma_length
,
dir
);
else
if
(
dir
==
DMA_FROM_DEVICE
)
else
if
(
dir
==
DMA_FROM_DEVICE
)
dma_mark_clean
(
SG_ENT_VIRT_ADDRESS
(
sg
),
sg
->
dma_length
);
dma_mark_clean
(
SG_ENT_VIRT_ADDRESS
(
sg
),
sg
->
dma_length
);
}
}
}
/*
/*
...
@@ -735,19 +738,21 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
...
@@ -735,19 +738,21 @@ swiotlb_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nelems,
* and usage.
* and usage.
*/
*/
static
void
static
void
swiotlb_sync_sg
(
struct
device
*
hwdev
,
struct
scatterlist
*
sg
,
swiotlb_sync_sg
(
struct
device
*
hwdev
,
struct
scatterlist
*
sg
l
,
int
nelems
,
int
dir
,
int
target
)
int
nelems
,
int
dir
,
int
target
)
{
{
struct
scatterlist
*
sg
;
int
i
;
int
i
;
BUG_ON
(
dir
==
DMA_NONE
);
BUG_ON
(
dir
==
DMA_NONE
);
for
(
i
=
0
;
i
<
nelems
;
i
++
,
sg
++
)
for
_each_sg
(
sgl
,
sg
,
nelems
,
i
)
{
if
(
sg
->
dma_address
!=
SG_ENT_PHYS_ADDRESS
(
sg
))
if
(
sg
->
dma_address
!=
SG_ENT_PHYS_ADDRESS
(
sg
))
sync_single
(
hwdev
,
bus_to_virt
(
sg
->
dma_address
),
sync_single
(
hwdev
,
bus_to_virt
(
sg
->
dma_address
),
sg
->
dma_length
,
dir
,
target
);
sg
->
dma_length
,
dir
,
target
);
else
if
(
dir
==
DMA_FROM_DEVICE
)
else
if
(
dir
==
DMA_FROM_DEVICE
)
dma_mark_clean
(
SG_ENT_VIRT_ADDRESS
(
sg
),
sg
->
dma_length
);
dma_mark_clean
(
SG_ENT_VIRT_ADDRESS
(
sg
),
sg
->
dma_length
);
}
}
}
void
void
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录