Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
35e87820
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
35e87820
编写于
10月 02, 2011
作者:
A
Avi Kivity
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
realview: convert to memory API
Signed-off-by:
N
Avi Kivity
<
avi@redhat.com
>
上级
5dea2efb
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
26 addition
and
28 deletion
+26
-28
hw/realview.c
hw/realview.c
+26
-28
未找到文件。
hw/realview.c
浏览文件 @
35e87820
...
...
@@ -18,17 +18,20 @@
#include "boards.h"
#include "bitbang_i2c.h"
#include "blockdev.h"
#include "exec-memory.h"
#define SMP_BOOT_ADDR 0xe0000000
typedef
struct
{
SysBusDevice
busdev
;
MemoryRegion
iomem
;
bitbang_i2c_interface
*
bitbang
;
int
out
;
int
in
;
}
RealViewI2CState
;
static
uint32_t
realview_i2c_read
(
void
*
opaque
,
target_phys_addr_t
offset
)
static
uint64_t
realview_i2c_read
(
void
*
opaque
,
target_phys_addr_t
offset
,
unsigned
size
)
{
RealViewI2CState
*
s
=
(
RealViewI2CState
*
)
opaque
;
...
...
@@ -41,7 +44,7 @@ static uint32_t realview_i2c_read(void *opaque, target_phys_addr_t offset)
}
static
void
realview_i2c_write
(
void
*
opaque
,
target_phys_addr_t
offset
,
uint
32_t
valu
e
)
uint
64_t
value
,
unsigned
siz
e
)
{
RealViewI2CState
*
s
=
(
RealViewI2CState
*
)
opaque
;
...
...
@@ -59,30 +62,22 @@ static void realview_i2c_write(void *opaque, target_phys_addr_t offset,
s
->
in
=
bitbang_i2c_set
(
s
->
bitbang
,
BITBANG_I2C_SDA
,
(
s
->
out
&
2
)
!=
0
);
}
static
CPUReadMemoryFunc
*
const
realview_i2c_readfn
[]
=
{
realview_i2c_read
,
realview_i2c_read
,
realview_i2c_read
};
static
CPUWriteMemoryFunc
*
const
realview_i2c_writefn
[]
=
{
realview_i2c_write
,
realview_i2c_write
,
realview_i2c_write
static
const
MemoryRegionOps
realview_i2c_ops
=
{
.
read
=
realview_i2c_read
,
.
write
=
realview_i2c_write
,
.
endianness
=
DEVICE_NATIVE_ENDIAN
,
};
static
int
realview_i2c_init
(
SysBusDevice
*
dev
)
{
RealViewI2CState
*
s
=
FROM_SYSBUS
(
RealViewI2CState
,
dev
);
i2c_bus
*
bus
;
int
iomemtype
;
bus
=
i2c_init_bus
(
&
dev
->
qdev
,
"i2c"
);
s
->
bitbang
=
bitbang_i2c_init
(
bus
);
iomemtype
=
cpu_register_io_memory
(
realview_i2c_readfn
,
realview_i2c_writefn
,
s
,
DEVICE_NATIVE_ENDIAN
);
sysbus_init_mmio
(
dev
,
0x1000
,
iomemtype
);
memory_region_init_io
(
&
s
->
iomem
,
&
realview_i2c_ops
,
s
,
"realview-i2c"
,
0x1000
);
sysbus_init_mmio_region
(
dev
,
&
s
->
iomem
);
return
0
;
}
...
...
@@ -125,7 +120,11 @@ static void realview_init(ram_addr_t ram_size,
enum
realview_board_type
board_type
)
{
CPUState
*
env
=
NULL
;
ram_addr_t
ram_offset
;
MemoryRegion
*
sysmem
=
get_system_memory
();
MemoryRegion
*
ram_lo
=
g_new
(
MemoryRegion
,
1
);
MemoryRegion
*
ram_hi
=
g_new
(
MemoryRegion
,
1
);
MemoryRegion
*
ram_alias
=
g_new
(
MemoryRegion
,
1
);
MemoryRegion
*
ram_hack
=
g_new
(
MemoryRegion
,
1
);
DeviceState
*
dev
,
*
sysctl
,
*
gpio2
;
SysBusDevice
*
busdev
;
qemu_irq
*
irqp
;
...
...
@@ -184,21 +183,21 @@ static void realview_init(ram_addr_t ram_size,
/* Core tile RAM. */
low_ram_size
=
ram_size
-
0x20000000
;
ram_size
=
0x20000000
;
ram_offset
=
qemu_ram_alloc
(
NULL
,
"realview.lowmem"
,
low_ram_size
);
cpu_register_physical_memory
(
0x20000000
,
low_ram_size
,
ram_offset
|
IO_MEM_RAM
);
memory_region_init_ram
(
ram_lo
,
NULL
,
"realview.lowmem"
,
low_ram_size
);
memory_region_add_subregion
(
sysmem
,
0x20000000
,
ram_lo
);
}
ram_offset
=
qemu_ram_alloc
(
NULL
,
"realview.highmem"
,
ram_size
);
memory_region_init_ram
(
ram_hi
,
NULL
,
"realview.highmem"
,
ram_size
);
low_ram_size
=
ram_size
;
if
(
low_ram_size
>
0x10000000
)
low_ram_size
=
0x10000000
;
/* SDRAM at address zero. */
cpu_register_physical_memory
(
0
,
low_ram_size
,
ram_offset
|
IO_MEM_RAM
);
memory_region_init_alias
(
ram_alias
,
"realview.alias"
,
ram_hi
,
0
,
low_ram_size
);
memory_region_add_subregion
(
sysmem
,
0
,
ram_alias
);
if
(
is_pb
)
{
/* And again at a high address. */
cpu_register_physical_memory
(
0x70000000
,
ram_size
,
ram_offset
|
IO_MEM_RAM
);
memory_region_add_subregion
(
sysmem
,
0x70000000
,
ram_hi
);
}
else
{
ram_size
=
low_ram_size
;
}
...
...
@@ -372,9 +371,8 @@ static void realview_init(ram_addr_t ram_size,
startup code. I guess this works on real hardware because the
BootROM happens to be in ROM/flash or in memory that isn't clobbered
until after Linux boots the secondary CPUs. */
ram_offset
=
qemu_ram_alloc
(
NULL
,
"realview.hack"
,
0x1000
);
cpu_register_physical_memory
(
SMP_BOOT_ADDR
,
0x1000
,
ram_offset
|
IO_MEM_RAM
);
memory_region_init_ram
(
ram_hack
,
NULL
,
"realview.hack"
,
0x1000
);
memory_region_add_subregion
(
sysmem
,
SMP_BOOT_ADDR
,
ram_hack
);
realview_binfo
.
ram_size
=
ram_size
;
realview_binfo
.
kernel_filename
=
kernel_filename
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录