Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
bf32eb85
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看板
提交
bf32eb85
编写于
12月 14, 2009
作者:
R
Russell King
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'pending-l2x0' into cache
上级
f74f7e57
3d107434
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
72 addition
and
21 deletion
+72
-21
arch/arm/mm/cache-l2x0.c
arch/arm/mm/cache-l2x0.c
+72
-21
未找到文件。
arch/arm/mm/cache-l2x0.c
浏览文件 @
bf32eb85
...
...
@@ -28,69 +28,120 @@
static
void
__iomem
*
l2x0_base
;
static
DEFINE_SPINLOCK
(
l2x0_lock
);
static
inline
void
sync_writel
(
unsigned
long
val
,
unsigned
long
reg
,
unsigned
long
complete_mask
)
static
inline
void
cache_wait
(
void
__iomem
*
reg
,
unsigned
long
mask
)
{
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
writel
(
val
,
l2x0_base
+
reg
);
/* wait for the operation to complete */
while
(
readl
(
l2x0_base
+
reg
)
&
complete_
mask
)
while
(
readl
(
reg
)
&
mask
)
;
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
inline
void
cache_sync
(
void
)
{
sync_writel
(
0
,
L2X0_CACHE_SYNC
,
1
);
void
__iomem
*
base
=
l2x0_base
;
writel
(
0
,
base
+
L2X0_CACHE_SYNC
);
cache_wait
(
base
+
L2X0_CACHE_SYNC
,
1
);
}
static
inline
void
l2x0_inv_all
(
void
)
{
unsigned
long
flags
;
/* invalidate all ways */
sync_writel
(
0xff
,
L2X0_INV_WAY
,
0xff
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
writel
(
0xff
,
l2x0_base
+
L2X0_INV_WAY
);
cache_wait
(
l2x0_base
+
L2X0_INV_WAY
,
0xff
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
void
l2x0_inv_range
(
unsigned
long
start
,
unsigned
long
end
)
{
unsigned
long
addr
;
void
__iomem
*
base
=
l2x0_base
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
if
(
start
&
(
CACHE_LINE_SIZE
-
1
))
{
start
&=
~
(
CACHE_LINE_SIZE
-
1
);
sync_writel
(
start
,
L2X0_CLEAN_INV_LINE_PA
,
1
);
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_CLEAN_INV_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
end
&
(
CACHE_LINE_SIZE
-
1
))
{
end
&=
~
(
CACHE_LINE_SIZE
-
1
);
sync_writel
(
end
,
L2X0_CLEAN_INV_LINE_PA
,
1
);
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
writel
(
end
,
base
+
L2X0_CLEAN_INV_LINE_PA
);
}
for
(
addr
=
start
;
addr
<
end
;
addr
+=
CACHE_LINE_SIZE
)
sync_writel
(
addr
,
L2X0_INV_LINE_PA
,
1
);
while
(
start
<
end
)
{
unsigned
long
blk_end
=
start
+
min
(
end
-
start
,
4096UL
);
while
(
start
<
blk_end
)
{
cache_wait
(
base
+
L2X0_INV_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_INV_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
blk_end
<
end
)
{
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
}
}
cache_wait
(
base
+
L2X0_INV_LINE_PA
,
1
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
void
l2x0_clean_range
(
unsigned
long
start
,
unsigned
long
end
)
{
unsigned
long
addr
;
void
__iomem
*
base
=
l2x0_base
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
start
&=
~
(
CACHE_LINE_SIZE
-
1
);
for
(
addr
=
start
;
addr
<
end
;
addr
+=
CACHE_LINE_SIZE
)
sync_writel
(
addr
,
L2X0_CLEAN_LINE_PA
,
1
);
while
(
start
<
end
)
{
unsigned
long
blk_end
=
start
+
min
(
end
-
start
,
4096UL
);
while
(
start
<
blk_end
)
{
cache_wait
(
base
+
L2X0_CLEAN_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_CLEAN_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
blk_end
<
end
)
{
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
}
}
cache_wait
(
base
+
L2X0_CLEAN_LINE_PA
,
1
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
static
void
l2x0_flush_range
(
unsigned
long
start
,
unsigned
long
end
)
{
unsigned
long
addr
;
void
__iomem
*
base
=
l2x0_base
;
unsigned
long
flags
;
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
start
&=
~
(
CACHE_LINE_SIZE
-
1
);
for
(
addr
=
start
;
addr
<
end
;
addr
+=
CACHE_LINE_SIZE
)
sync_writel
(
addr
,
L2X0_CLEAN_INV_LINE_PA
,
1
);
while
(
start
<
end
)
{
unsigned
long
blk_end
=
start
+
min
(
end
-
start
,
4096UL
);
while
(
start
<
blk_end
)
{
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
writel
(
start
,
base
+
L2X0_CLEAN_INV_LINE_PA
);
start
+=
CACHE_LINE_SIZE
;
}
if
(
blk_end
<
end
)
{
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
spin_lock_irqsave
(
&
l2x0_lock
,
flags
);
}
}
cache_wait
(
base
+
L2X0_CLEAN_INV_LINE_PA
,
1
);
cache_sync
();
spin_unlock_irqrestore
(
&
l2x0_lock
,
flags
);
}
void
__init
l2x0_init
(
void
__iomem
*
base
,
__u32
aux_val
,
__u32
aux_mask
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录