Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
raspberrypi-kernel
提交
801c0be8
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看板
提交
801c0be8
编写于
2月 26, 2009
作者:
I
Ingo Molnar
浏览文件
操作
浏览文件
下载
差异文件
Merge branches 'x86/urgent' and 'x86/pat' into x86/core
Conflicts: arch/x86/include/asm/pat.h
上级
13b2eda6
13093cb0
变更
5
显示空白变更内容
内联
并排
Showing
5 changed file
with
82 addition
and
22 deletion
+82
-22
arch/x86/include/asm/iomap.h
arch/x86/include/asm/iomap.h
+4
-1
arch/x86/include/asm/pat.h
arch/x86/include/asm/pat.h
+3
-0
arch/x86/mm/iomap_32.c
arch/x86/mm/iomap_32.c
+42
-2
arch/x86/mm/pat.c
arch/x86/mm/pat.c
+29
-17
include/linux/io-mapping.h
include/linux/io-mapping.h
+4
-2
未找到文件。
arch/x86/include/asm/iomap.h
浏览文件 @
801c0be8
...
...
@@ -24,7 +24,10 @@
#include <asm/tlbflush.h>
int
is_io_mapping_possible
(
resource_size_t
base
,
unsigned
long
size
);
reserve_io_memtype_wc
(
u64
base
,
unsigned
long
size
,
pgprot_t
*
prot
);
void
free_io_memtype
(
u64
base
,
unsigned
long
size
);
void
*
iomap_atomic_prot_pfn
(
unsigned
long
pfn
,
enum
km_type
type
,
pgprot_t
prot
);
...
...
arch/x86/include/asm/pat.h
浏览文件 @
801c0be8
...
...
@@ -15,4 +15,7 @@ extern int reserve_memtype(u64 start, u64 end,
unsigned
long
req_type
,
unsigned
long
*
ret_type
);
extern
int
free_memtype
(
u64
start
,
u64
end
);
extern
int
kernel_map_sync_memtype
(
u64
base
,
unsigned
long
size
,
unsigned
long
flag
);
#endif
/* _ASM_X86_PAT_H */
arch/x86/mm/iomap_32.c
浏览文件 @
801c0be8
...
...
@@ -21,13 +21,13 @@
#include <linux/module.h>
#ifdef CONFIG_X86_PAE
int
static
int
is_io_mapping_possible
(
resource_size_t
base
,
unsigned
long
size
)
{
return
1
;
}
#else
int
static
int
is_io_mapping_possible
(
resource_size_t
base
,
unsigned
long
size
)
{
/* There is no way to map greater than 1 << 32 address without PAE */
...
...
@@ -38,6 +38,46 @@ is_io_mapping_possible(resource_size_t base, unsigned long size)
}
#endif
int
reserve_io_memtype_wc
(
u64
base
,
unsigned
long
size
,
pgprot_t
*
prot
)
{
unsigned
long
ret_flag
;
if
(
!
is_io_mapping_possible
(
base
,
size
))
goto
out_err
;
if
(
!
pat_enabled
)
{
*
prot
=
pgprot_noncached
(
PAGE_KERNEL
);
return
0
;
}
if
(
reserve_memtype
(
base
,
base
+
size
,
_PAGE_CACHE_WC
,
&
ret_flag
))
goto
out_err
;
if
(
ret_flag
==
_PAGE_CACHE_WB
)
goto
out_free
;
if
(
kernel_map_sync_memtype
(
base
,
size
,
ret_flag
))
goto
out_free
;
*
prot
=
__pgprot
(
__PAGE_KERNEL
|
ret_flag
);
return
0
;
out_free:
free_memtype
(
base
,
base
+
size
);
out_err:
return
-
EINVAL
;
}
EXPORT_SYMBOL_GPL
(
reserve_io_memtype_wc
);
void
free_io_memtype
(
u64
base
,
unsigned
long
size
)
{
if
(
pat_enabled
)
free_memtype
(
base
,
base
+
size
);
}
EXPORT_SYMBOL_GPL
(
free_io_memtype
);
/* Map 'pfn' using fixed map 'type' and protections 'prot'
*/
void
*
...
...
arch/x86/mm/pat.c
浏览文件 @
801c0be8
...
...
@@ -633,6 +633,33 @@ void unmap_devmem(unsigned long pfn, unsigned long size, pgprot_t vma_prot)
free_memtype
(
addr
,
addr
+
size
);
}
/*
* Change the memory type for the physial address range in kernel identity
* mapping space if that range is a part of identity map.
*/
int
kernel_map_sync_memtype
(
u64
base
,
unsigned
long
size
,
unsigned
long
flags
)
{
unsigned
long
id_sz
;
if
(
!
pat_enabled
||
base
>=
__pa
(
high_memory
))
return
0
;
id_sz
=
(
__pa
(
high_memory
)
<
base
+
size
)
?
__pa
(
high_memory
)
-
base
:
size
;
if
(
ioremap_change_attr
((
unsigned
long
)
__va
(
base
),
id_sz
,
flags
)
<
0
)
{
printk
(
KERN_INFO
"%s:%d ioremap_change_attr failed %s "
"for %Lx-%Lx
\n
"
,
current
->
comm
,
current
->
pid
,
cattr_name
(
flags
),
base
,
(
unsigned
long
long
)(
base
+
size
));
return
-
EINVAL
;
}
return
0
;
}
/*
* Internal interface to reserve a range of physical memory with prot.
* Reserved non RAM regions only and after successful reserve_memtype,
...
...
@@ -642,7 +669,7 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
int
strict_prot
)
{
int
is_ram
=
0
;
int
id_sz
,
ret
;
int
ret
;
unsigned
long
flags
;
unsigned
long
want_flags
=
(
pgprot_val
(
*
vma_prot
)
&
_PAGE_CACHE_MASK
);
...
...
@@ -679,23 +706,8 @@ static int reserve_pfn_range(u64 paddr, unsigned long size, pgprot_t *vma_prot,
flags
);
}
/* Need to keep identity mapping in sync */
if
(
paddr
>=
__pa
(
high_memory
))
return
0
;
id_sz
=
(
__pa
(
high_memory
)
<
paddr
+
size
)
?
__pa
(
high_memory
)
-
paddr
:
size
;
if
(
ioremap_change_attr
((
unsigned
long
)
__va
(
paddr
),
id_sz
,
flags
)
<
0
)
{
if
(
kernel_map_sync_memtype
(
paddr
,
size
,
flags
)
<
0
)
{
free_memtype
(
paddr
,
paddr
+
size
);
printk
(
KERN_ERR
"%s:%d reserve_pfn_range ioremap_change_attr failed %s "
"for %Lx-%Lx
\n
"
,
current
->
comm
,
current
->
pid
,
cattr_name
(
flags
),
(
unsigned
long
long
)
paddr
,
(
unsigned
long
long
)(
paddr
+
size
));
return
-
EINVAL
;
}
return
0
;
...
...
include/linux/io-mapping.h
浏览文件 @
801c0be8
...
...
@@ -49,8 +49,9 @@ static inline struct io_mapping *
io_mapping_create_wc
(
resource_size_t
base
,
unsigned
long
size
)
{
struct
io_mapping
*
iomap
;
pgprot_t
prot
;
if
(
!
is_io_mapping_possible
(
base
,
size
))
if
(
!
reserve_io_memtype_wc
(
base
,
size
,
&
prot
))
return
NULL
;
iomap
=
kmalloc
(
sizeof
(
*
iomap
),
GFP_KERNEL
);
...
...
@@ -59,13 +60,14 @@ io_mapping_create_wc(resource_size_t base, unsigned long size)
iomap
->
base
=
base
;
iomap
->
size
=
size
;
iomap
->
prot
=
p
gprot_writecombine
(
__pgprot
(
__PAGE_KERNEL
))
;
iomap
->
prot
=
p
rot
;
return
iomap
;
}
static
inline
void
io_mapping_free
(
struct
io_mapping
*
mapping
)
{
free_io_memtype
(
mapping
->
base
,
mapping
->
size
);
kfree
(
mapping
);
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录