Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
260489fa
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
260489fa
编写于
8月 26, 2008
作者:
D
David S. Miller
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sparc32: Make mmu_{get,release}_*() take a struct device pointer.
Signed-off-by:
N
David S. Miller
<
davem@davemloft.net
>
上级
7a715f46
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
47 addition
and
53 deletion
+47
-53
arch/sparc/include/asm/dma.h
arch/sparc/include/asm/dma.h
+13
-9
arch/sparc/kernel/ioport.c
arch/sparc/kernel/ioport.c
+4
-13
arch/sparc/mm/io-unit.c
arch/sparc/mm/io-unit.c
+8
-8
arch/sparc/mm/iommu.c
arch/sparc/mm/iommu.c
+22
-23
未找到文件。
arch/sparc/include/asm/dma.h
浏览文件 @
260489fa
...
...
@@ -100,16 +100,20 @@ BTFIXUPDEF_CALL(void, mmu_unlockarea, char *, unsigned long)
#define mmu_lockarea(vaddr,len) BTFIXUP_CALL(mmu_lockarea)(vaddr,len)
#define mmu_unlockarea(vaddr,len) BTFIXUP_CALL(mmu_unlockarea)(vaddr,len)
struct
page
;
struct
device
;
struct
scatterlist
;
/* These are implementations for sbus_map_sg/sbus_unmap_sg... collapse later */
BTFIXUPDEF_CALL
(
__u32
,
mmu_get_scsi_one
,
char
*
,
unsigned
long
,
struct
sbus_bus
*
sbus
)
BTFIXUPDEF_CALL
(
void
,
mmu_get_scsi_sgl
,
struct
scatterlist
*
,
int
,
struct
sbus_bus
*
sbus
)
BTFIXUPDEF_CALL
(
void
,
mmu_release_scsi_one
,
__u32
,
unsigned
long
,
struct
sbus_bus
*
sbus
)
BTFIXUPDEF_CALL
(
void
,
mmu_release_scsi_sgl
,
struct
scatterlist
*
,
int
,
struct
sbus_bus
*
sbus
)
#define mmu_get_scsi_one(
vaddr,len,sbus) BTFIXUP_CALL(mmu_get_scsi_one)(vaddr,len,sbus
)
#define mmu_get_scsi_sgl(
sg,sz,sbus) BTFIXUP_CALL(mmu_get_scsi_sgl)(sg,sz,sbus
)
#define mmu_release_scsi_one(
vaddr,len,sbus) BTFIXUP_CALL(mmu_release_scsi_one)(vaddr,len,sbus
)
#define mmu_release_scsi_sgl(
sg,sz,sbus) BTFIXUP_CALL(mmu_release_scsi_sgl)(sg,sz,sbus
)
BTFIXUPDEF_CALL
(
__u32
,
mmu_get_scsi_one
,
struct
device
*
,
char
*
,
unsigned
long
)
BTFIXUPDEF_CALL
(
void
,
mmu_get_scsi_sgl
,
struct
device
*
,
struct
scatterlist
*
,
int
)
BTFIXUPDEF_CALL
(
void
,
mmu_release_scsi_one
,
struct
device
*
,
__u32
,
unsigned
long
)
BTFIXUPDEF_CALL
(
void
,
mmu_release_scsi_sgl
,
struct
device
*
,
struct
scatterlist
*
,
int
)
#define mmu_get_scsi_one(
dev,vaddr,len) BTFIXUP_CALL(mmu_get_scsi_one)(dev,vaddr,len
)
#define mmu_get_scsi_sgl(
dev,sg,sz) BTFIXUP_CALL(mmu_get_scsi_sgl)(dev,sg,sz
)
#define mmu_release_scsi_one(
dev,vaddr,len) BTFIXUP_CALL(mmu_release_scsi_one)(dev,vaddr,len
)
#define mmu_release_scsi_sgl(
dev,sg,sz) BTFIXUP_CALL(mmu_release_scsi_sgl)(dev,sg,sz
)
/*
* mmu_map/unmap are provided by iommu/iounit; Invalid to call on IIep.
...
...
arch/sparc/kernel/ioport.c
浏览文件 @
260489fa
...
...
@@ -394,8 +394,6 @@ void sbus_free_consistent(struct device *dev, long n, void *p, u32 ba)
*/
dma_addr_t
sbus_map_single
(
struct
device
*
dev
,
void
*
va
,
size_t
len
,
int
direction
)
{
struct
sbus_dev
*
sdev
=
to_sbus_device
(
dev
);
/* XXX why are some lengths signed, others unsigned? */
if
(
len
<=
0
)
{
return
0
;
...
...
@@ -404,20 +402,17 @@ dma_addr_t sbus_map_single(struct device *dev, void *va, size_t len, int directi
if
(
len
>
256
*
1024
)
{
/* __get_free_pages() limit */
return
0
;
}
return
mmu_get_scsi_one
(
va
,
len
,
sdev
->
bus
);
return
mmu_get_scsi_one
(
dev
,
va
,
len
);
}
void
sbus_unmap_single
(
struct
device
*
dev
,
dma_addr_t
ba
,
size_t
n
,
int
direction
)
{
struct
sbus_dev
*
sdev
=
to_sbus_device
(
dev
);
mmu_release_scsi_one
(
ba
,
n
,
sdev
->
bus
);
mmu_release_scsi_one
(
dev
,
ba
,
n
);
}
int
sbus_map_sg
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
n
,
int
direction
)
{
struct
sbus_dev
*
sdev
=
to_sbus_device
(
dev
);
mmu_get_scsi_sgl
(
sg
,
n
,
sdev
->
bus
);
mmu_get_scsi_sgl
(
dev
,
sg
,
n
);
/*
* XXX sparc64 can return a partial length here. sun4c should do this
...
...
@@ -428,9 +423,7 @@ int sbus_map_sg(struct device *dev, struct scatterlist *sg, int n, int direction
void
sbus_unmap_sg
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
n
,
int
direction
)
{
struct
sbus_dev
*
sdev
=
to_sbus_device
(
dev
);
mmu_release_scsi_sgl
(
sg
,
n
,
sdev
->
bus
);
mmu_release_scsi_sgl
(
dev
,
sg
,
n
);
}
/*
...
...
@@ -438,7 +431,6 @@ void sbus_unmap_sg(struct device *dev, struct scatterlist *sg, int n, int direct
void
sbus_dma_sync_single_for_cpu
(
struct
device
*
dev
,
dma_addr_t
ba
,
size_t
size
,
int
direction
)
{
#if 0
struct sbus_dev *sdev = to_sbus_device(dev);
unsigned long va;
struct resource *res;
...
...
@@ -459,7 +451,6 @@ void sbus_dma_sync_single_for_cpu(struct device *dev, dma_addr_t ba, size_t size
void
sbus_dma_sync_single_for_device
(
struct
device
*
dev
,
dma_addr_t
ba
,
size_t
size
,
int
direction
)
{
#if 0
struct sbus_dev *sdev = to_sbus_device(dev);
unsigned long va;
struct resource *res;
...
...
arch/sparc/mm/io-unit.c
浏览文件 @
260489fa
...
...
@@ -125,10 +125,10 @@ nexti: scan = find_next_zero_bit(iounit->bmap, limit, scan);
return
vaddr
;
}
static
__u32
iounit_get_scsi_one
(
char
*
vaddr
,
unsigned
long
len
,
struct
sbus_bus
*
sbus
)
static
__u32
iounit_get_scsi_one
(
struct
device
*
dev
,
char
*
vaddr
,
unsigned
long
len
)
{
struct
iounit_struct
*
iounit
=
dev
->
archdata
.
iommu
;
unsigned
long
ret
,
flags
;
struct
iounit_struct
*
iounit
=
sbus
->
ofdev
.
dev
.
archdata
.
iommu
;
spin_lock_irqsave
(
&
iounit
->
lock
,
flags
);
ret
=
iounit_get_area
(
iounit
,
(
unsigned
long
)
vaddr
,
len
);
...
...
@@ -136,10 +136,10 @@ static __u32 iounit_get_scsi_one(char *vaddr, unsigned long len, struct sbus_bus
return
ret
;
}
static
void
iounit_get_scsi_sgl
(
struct
scatterlist
*
sg
,
int
sz
,
struct
sbus_bus
*
sbus
)
static
void
iounit_get_scsi_sgl
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
sz
)
{
struct
iounit_struct
*
iounit
=
dev
->
archdata
.
iommu
;
unsigned
long
flags
;
struct
iounit_struct
*
iounit
=
sbus
->
ofdev
.
dev
.
archdata
.
iommu
;
/* FIXME: Cache some resolved pages - often several sg entries are to the same page */
spin_lock_irqsave
(
&
iounit
->
lock
,
flags
);
...
...
@@ -152,10 +152,10 @@ static void iounit_get_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_bus
spin_unlock_irqrestore
(
&
iounit
->
lock
,
flags
);
}
static
void
iounit_release_scsi_one
(
__u32
vaddr
,
unsigned
long
len
,
struct
sbus_bus
*
sbus
)
static
void
iounit_release_scsi_one
(
struct
device
*
dev
,
__u32
vaddr
,
unsigned
long
len
)
{
struct
iounit_struct
*
iounit
=
dev
->
archdata
.
iommu
;
unsigned
long
flags
;
struct
iounit_struct
*
iounit
=
sbus
->
ofdev
.
dev
.
archdata
.
iommu
;
spin_lock_irqsave
(
&
iounit
->
lock
,
flags
);
len
=
((
vaddr
&
~
PAGE_MASK
)
+
len
+
(
PAGE_SIZE
-
1
))
>>
PAGE_SHIFT
;
...
...
@@ -166,11 +166,11 @@ static void iounit_release_scsi_one(__u32 vaddr, unsigned long len, struct sbus_
spin_unlock_irqrestore
(
&
iounit
->
lock
,
flags
);
}
static
void
iounit_release_scsi_sgl
(
struct
scatterlist
*
sg
,
int
sz
,
struct
sbus_bus
*
sbus
)
static
void
iounit_release_scsi_sgl
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
sz
)
{
struct
iounit_struct
*
iounit
=
dev
->
archdata
.
iommu
;
unsigned
long
flags
;
unsigned
long
vaddr
,
len
;
struct
iounit_struct
*
iounit
=
sbus
->
ofdev
.
dev
.
archdata
.
iommu
;
spin_lock_irqsave
(
&
iounit
->
lock
,
flags
);
while
(
sz
!=
0
)
{
...
...
arch/sparc/mm/iommu.c
浏览文件 @
260489fa
...
...
@@ -169,9 +169,9 @@ static void iommu_flush_iotlb(iopte_t *iopte, unsigned int niopte)
}
}
static
u32
iommu_get_one
(
struct
page
*
page
,
int
npages
,
struct
sbus_bus
*
sbu
s
)
static
u32
iommu_get_one
(
struct
device
*
dev
,
struct
page
*
page
,
int
npage
s
)
{
struct
iommu_struct
*
iommu
=
sbus
->
ofdev
.
dev
.
archdata
.
iommu
;
struct
iommu_struct
*
iommu
=
dev
->
archdata
.
iommu
;
int
ioptex
;
iopte_t
*
iopte
,
*
iopte0
;
unsigned
int
busa
,
busa0
;
...
...
@@ -199,8 +199,7 @@ static u32 iommu_get_one(struct page *page, int npages, struct sbus_bus *sbus)
return
busa0
;
}
static
u32
iommu_get_scsi_one
(
char
*
vaddr
,
unsigned
int
len
,
struct
sbus_bus
*
sbus
)
static
u32
iommu_get_scsi_one
(
struct
device
*
dev
,
char
*
vaddr
,
unsigned
int
len
)
{
unsigned
long
off
;
int
npages
;
...
...
@@ -210,22 +209,22 @@ static u32 iommu_get_scsi_one(char *vaddr, unsigned int len,
off
=
(
unsigned
long
)
vaddr
&
~
PAGE_MASK
;
npages
=
(
off
+
len
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
;
page
=
virt_to_page
((
unsigned
long
)
vaddr
&
PAGE_MASK
);
busa
=
iommu_get_one
(
page
,
npages
,
sbu
s
);
busa
=
iommu_get_one
(
dev
,
page
,
npage
s
);
return
busa
+
off
;
}
static
__u32
iommu_get_scsi_one_noflush
(
char
*
vaddr
,
unsigned
long
len
,
struct
sbus_bus
*
sbus
)
static
__u32
iommu_get_scsi_one_noflush
(
struct
device
*
dev
,
char
*
vaddr
,
unsigned
long
len
)
{
return
iommu_get_scsi_one
(
vaddr
,
len
,
sbus
);
return
iommu_get_scsi_one
(
dev
,
vaddr
,
len
);
}
static
__u32
iommu_get_scsi_one_gflush
(
char
*
vaddr
,
unsigned
long
len
,
struct
sbus_bus
*
sbus
)
static
__u32
iommu_get_scsi_one_gflush
(
struct
device
*
dev
,
char
*
vaddr
,
unsigned
long
len
)
{
flush_page_for_dma
(
0
);
return
iommu_get_scsi_one
(
vaddr
,
len
,
sbus
);
return
iommu_get_scsi_one
(
dev
,
vaddr
,
len
);
}
static
__u32
iommu_get_scsi_one_pflush
(
char
*
vaddr
,
unsigned
long
len
,
struct
sbus_bus
*
sbus
)
static
__u32
iommu_get_scsi_one_pflush
(
struct
device
*
dev
,
char
*
vaddr
,
unsigned
long
len
)
{
unsigned
long
page
=
((
unsigned
long
)
vaddr
)
&
PAGE_MASK
;
...
...
@@ -233,23 +232,23 @@ static __u32 iommu_get_scsi_one_pflush(char *vaddr, unsigned long len, struct sb
flush_page_for_dma
(
page
);
page
+=
PAGE_SIZE
;
}
return
iommu_get_scsi_one
(
vaddr
,
len
,
sbus
);
return
iommu_get_scsi_one
(
dev
,
vaddr
,
len
);
}
static
void
iommu_get_scsi_sgl_noflush
(
struct
scatterlist
*
sg
,
int
sz
,
struct
sbus_bus
*
sbus
)
static
void
iommu_get_scsi_sgl_noflush
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
sz
)
{
int
n
;
while
(
sz
!=
0
)
{
--
sz
;
n
=
(
sg
->
length
+
sg
->
offset
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
;
sg
->
dvma_address
=
iommu_get_one
(
sg_page
(
sg
),
n
,
sbus
)
+
sg
->
offset
;
sg
->
dvma_address
=
iommu_get_one
(
dev
,
sg_page
(
sg
),
n
)
+
sg
->
offset
;
sg
->
dvma_length
=
(
__u32
)
sg
->
length
;
sg
=
sg_next
(
sg
);
}
}
static
void
iommu_get_scsi_sgl_gflush
(
struct
scatterlist
*
sg
,
int
sz
,
struct
sbus_bus
*
sbus
)
static
void
iommu_get_scsi_sgl_gflush
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
sz
)
{
int
n
;
...
...
@@ -257,13 +256,13 @@ static void iommu_get_scsi_sgl_gflush(struct scatterlist *sg, int sz, struct sbu
while
(
sz
!=
0
)
{
--
sz
;
n
=
(
sg
->
length
+
sg
->
offset
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
;
sg
->
dvma_address
=
iommu_get_one
(
sg_page
(
sg
),
n
,
sbus
)
+
sg
->
offset
;
sg
->
dvma_address
=
iommu_get_one
(
dev
,
sg_page
(
sg
),
n
)
+
sg
->
offset
;
sg
->
dvma_length
=
(
__u32
)
sg
->
length
;
sg
=
sg_next
(
sg
);
}
}
static
void
iommu_get_scsi_sgl_pflush
(
struct
scatterlist
*
sg
,
int
sz
,
struct
sbus_bus
*
sbus
)
static
void
iommu_get_scsi_sgl_pflush
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
sz
)
{
unsigned
long
page
,
oldpage
=
0
;
int
n
,
i
;
...
...
@@ -288,15 +287,15 @@ static void iommu_get_scsi_sgl_pflush(struct scatterlist *sg, int sz, struct sbu
}
}
sg
->
dvma_address
=
iommu_get_one
(
sg_page
(
sg
),
n
,
sbus
)
+
sg
->
offset
;
sg
->
dvma_address
=
iommu_get_one
(
dev
,
sg_page
(
sg
),
n
)
+
sg
->
offset
;
sg
->
dvma_length
=
(
__u32
)
sg
->
length
;
sg
=
sg_next
(
sg
);
}
}
static
void
iommu_release_one
(
u32
busa
,
int
npages
,
struct
sbus_bus
*
sbu
s
)
static
void
iommu_release_one
(
struct
device
*
dev
,
u32
busa
,
int
npage
s
)
{
struct
iommu_struct
*
iommu
=
sbus
->
ofdev
.
dev
.
archdata
.
iommu
;
struct
iommu_struct
*
iommu
=
dev
->
archdata
.
iommu
;
int
ioptex
;
int
i
;
...
...
@@ -310,17 +309,17 @@ static void iommu_release_one(u32 busa, int npages, struct sbus_bus *sbus)
bit_map_clear
(
&
iommu
->
usemap
,
ioptex
,
npages
);
}
static
void
iommu_release_scsi_one
(
__u32
vaddr
,
unsigned
long
len
,
struct
sbus_bus
*
sbus
)
static
void
iommu_release_scsi_one
(
struct
device
*
dev
,
__u32
vaddr
,
unsigned
long
len
)
{
unsigned
long
off
;
int
npages
;
off
=
vaddr
&
~
PAGE_MASK
;
npages
=
(
off
+
len
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
;
iommu_release_one
(
vaddr
&
PAGE_MASK
,
npages
,
sbu
s
);
iommu_release_one
(
dev
,
vaddr
&
PAGE_MASK
,
npage
s
);
}
static
void
iommu_release_scsi_sgl
(
struct
scatterlist
*
sg
,
int
sz
,
struct
sbus_bus
*
sbus
)
static
void
iommu_release_scsi_sgl
(
struct
device
*
dev
,
struct
scatterlist
*
sg
,
int
sz
)
{
int
n
;
...
...
@@ -328,7 +327,7 @@ static void iommu_release_scsi_sgl(struct scatterlist *sg, int sz, struct sbus_b
--
sz
;
n
=
(
sg
->
length
+
sg
->
offset
+
PAGE_SIZE
-
1
)
>>
PAGE_SHIFT
;
iommu_release_one
(
sg
->
dvma_address
&
PAGE_MASK
,
n
,
sbus
);
iommu_release_one
(
dev
,
sg
->
dvma_address
&
PAGE_MASK
,
n
);
sg
->
dvma_address
=
0x21212121
;
sg
=
sg_next
(
sg
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录