Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
dbfd49fe
Commit
dbfd49fe
authored
May 11, 2007
by
Jens Axboe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swiotlb: sg chaining support
Signed-off-by:
Jens Axboe
<
jens.axboe@oracle.com
>
parent
38d37556
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
lib/swiotlb.c
lib/swiotlb.c
+12
-7
No files found.
lib/swiotlb.c
View file @
dbfd49fe
...
...
@@ -677,16 +677,17 @@ swiotlb_sync_single_range_for_device(struct device *hwdev, dma_addr_t dev_addr,
* same here.
*/
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
)
{
struct
scatterlist
*
sg
;
void
*
addr
;
dma_addr_t
dev_addr
;
int
i
;
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
);
dev_addr
=
virt_to_bus
(
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,
to do proper error handling. */
swiotlb_full
(
hwdev
,
sg
->
length
,
dir
,
0
);
swiotlb_unmap_sg
(
hwdev
,
sg
-
i
,
i
,
dir
);
sg
[
0
].
dma_length
=
0
;
sg
l
[
0
].
dma_length
=
0
;
return
0
;
}
sg
->
dma_address
=
virt_to_bus
(
map
);
...
...
@@ -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.
*/
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
)
{
struct
scatterlist
*
sg
;
int
i
;
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
))
unmap_single
(
hwdev
,
bus_to_virt
(
sg
->
dma_address
),
sg
->
dma_length
,
dir
);
else
if
(
dir
==
DMA_FROM_DEVICE
)
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,
* and usage.
*/
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
)
{
struct
scatterlist
*
sg
;
int
i
;
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
))
sync_single
(
hwdev
,
bus_to_virt
(
sg
->
dma_address
),
sg
->
dma_length
,
dir
,
target
);
else
if
(
dir
==
DMA_FROM_DEVICE
)
dma_mark_clean
(
SG_ENT_VIRT_ADDRESS
(
sg
),
sg
->
dma_length
);
}
}
void
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment