Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
60581b37
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
60581b37
编写于
8月 08, 2011
作者:
A
Avi Kivity
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mips_jazz: convert to memory API
Signed-off-by:
N
Avi Kivity
<
avi@redhat.com
>
上级
530889ff
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
45 addition
and
45 deletion
+45
-45
hw/mips_jazz.c
hw/mips_jazz.c
+45
-45
未找到文件。
hw/mips_jazz.c
浏览文件 @
60581b37
...
...
@@ -52,44 +52,42 @@ static void main_cpu_reset(void *opaque)
cpu_reset
(
env
);
}
static
uint
32_t
rtc_readb
(
void
*
opaque
,
target_phys_addr_t
addr
)
static
uint
64_t
rtc_read
(
void
*
opaque
,
target_phys_addr_t
addr
,
unsigned
size
)
{
return
cpu_inw
(
0x71
);
}
static
void
rtc_writeb
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
static
void
rtc_write
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint64_t
val
,
unsigned
size
)
{
cpu_outw
(
0x71
,
val
&
0xff
);
}
static
CPUReadMemoryFunc
*
const
rtc_read
[
3
]
=
{
rtc_readb
,
rtc_readb
,
rtc_readb
,
static
const
MemoryRegionOps
rtc_ops
=
{
.
read
=
rtc_read
,
.
write
=
rtc_write
,
.
endianness
=
DEVICE_NATIVE_ENDIAN
,
};
static
CPUWriteMemoryFunc
*
const
rtc_write
[
3
]
=
{
rtc_writeb
,
rtc_writeb
,
rtc_writeb
,
};
static
void
dma_dummy_writeb
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint32_t
val
)
static
uint64_t
dma_dummy_read
(
void
*
opaque
,
target_phys_addr_t
addr
,
unsigned
size
)
{
/* Nothing to do. That is only to ensure that
* the current DMA acknowledge cycle is completed. */
return
0xff
;
}
static
CPUReadMemoryFunc
*
const
dma_dummy_read
[
3
]
=
{
NULL
,
NULL
,
NULL
,
};
static
void
dma_dummy_write
(
void
*
opaque
,
target_phys_addr_t
addr
,
uint64_t
val
,
unsigned
size
)
{
/* Nothing to do. That is only to ensure that
* the current DMA acknowledge cycle is completed. */
}
static
CPUWriteMemoryFunc
*
const
dma_dummy_write
[
3
]
=
{
dma_dummy_writeb
,
dma_dummy_writeb
,
dma_dummy_writeb
,
static
const
MemoryRegionOps
dma_dummy_ops
=
{
.
read
=
dma_dummy_read
,
.
write
=
dma_dummy_write
,
.
endianness
=
DEVICE_NATIVE_ENDIAN
,
};
#define MAGNUM_BIOS_SIZE_MAX 0x7e000
...
...
@@ -105,7 +103,7 @@ static void cpu_request_exit(void *opaque, int irq, int level)
}
static
void
mips_jazz_init
(
ram_addr_t
ram_size
,
void
mips_jazz_init
(
MemoryRegion
*
address_space
,
ram_addr_t
ram_size
,
const
char
*
cpu_model
,
enum
jazz_model_e
jazz_model
)
{
...
...
@@ -115,7 +113,8 @@ void mips_jazz_init (ram_addr_t ram_size,
qemu_irq
*
rc4030
,
*
i8259
;
rc4030_dma
*
dmas
;
void
*
rc4030_opaque
;
int
s_rtc
,
s_dma_dummy
;
MemoryRegion
*
rtc
=
g_new
(
MemoryRegion
,
1
);
MemoryRegion
*
dma_dummy
=
g_new
(
MemoryRegion
,
1
);
NICInfo
*
nd
;
DeviceState
*
dev
;
SysBusDevice
*
sysbus
;
...
...
@@ -123,8 +122,9 @@ void mips_jazz_init (ram_addr_t ram_size,
DriveInfo
*
fds
[
MAX_FD
];
qemu_irq
esp_reset
,
dma_enable
;
qemu_irq
*
cpu_exit_irq
;
ram_addr_t
ram_offset
;
ram_addr_t
bios_offset
;
MemoryRegion
*
ram
=
g_new
(
MemoryRegion
,
1
);
MemoryRegion
*
bios
=
g_new
(
MemoryRegion
,
1
);
MemoryRegion
*
bios2
=
g_new
(
MemoryRegion
,
1
);
/* init CPUs */
if
(
cpu_model
==
NULL
)
{
...
...
@@ -143,14 +143,15 @@ void mips_jazz_init (ram_addr_t ram_size,
qemu_register_reset
(
main_cpu_reset
,
env
);
/* allocate RAM */
ram_offset
=
qemu_ram_alloc
(
NULL
,
"mips_jazz.ram"
,
ram_size
);
cpu_register_physical_memory
(
0
,
ram_size
,
ram_offset
|
IO_MEM_RAM
);
memory_region_init_ram
(
ram
,
NULL
,
"mips_jazz.ram"
,
ram_size
);
memory_region_add_subregion
(
address_space
,
0
,
ram
);
bios_offset
=
qemu_ram_alloc
(
NULL
,
"mips_jazz.bios"
,
MAGNUM_BIOS_SIZE
);
cpu_register_physical_memory
(
0x1fc00000LL
,
MAGNUM_BIOS_SIZE
,
bios_offset
|
IO_MEM_ROM
);
cpu_register_physical_memory
(
0xfff00000LL
,
MAGNUM_BIOS_SIZE
,
bios_offset
|
IO_MEM_ROM
);
memory_region_init_ram
(
bios
,
NULL
,
"mips_jazz.bios"
,
MAGNUM_BIOS_SIZE
);
memory_region_set_readonly
(
bios
,
true
);
memory_region_init_alias
(
bios2
,
"mips_jazz.bios"
,
bios
,
0
,
MAGNUM_BIOS_SIZE
);
memory_region_add_subregion
(
address_space
,
0x1fc00000LL
,
bios
);
memory_region_add_subregion
(
address_space
,
0xfff00000LL
,
bios2
);
/* load the BIOS image. */
if
(
bios_name
==
NULL
)
...
...
@@ -175,9 +176,8 @@ void mips_jazz_init (ram_addr_t ram_size,
/* Chipset */
rc4030_opaque
=
rc4030_init
(
env
->
irq
[
6
],
env
->
irq
[
3
],
&
rc4030
,
&
dmas
);
s_dma_dummy
=
cpu_register_io_memory
(
dma_dummy_read
,
dma_dummy_write
,
NULL
,
DEVICE_NATIVE_ENDIAN
);
cpu_register_physical_memory
(
0x8000d000
,
0x00001000
,
s_dma_dummy
);
memory_region_init_io
(
dma_dummy
,
&
dma_dummy_ops
,
NULL
,
"dummy_dma"
,
0x1000
);
memory_region_add_subregion
(
address_space
,
0x8000d000
,
dma_dummy
);
/* ISA devices */
i8259
=
i8259_init
(
env
->
irq
[
4
]);
...
...
@@ -203,10 +203,11 @@ void mips_jazz_init (ram_addr_t ram_size,
sysbus_connect_irq
(
sysbus
,
0
,
rc4030
[
3
]);
{
/* Simple ROM, so user doesn't have to provide one */
ram_addr_t
rom_offset
=
qemu_ram_alloc
(
NULL
,
"g364fb.rom"
,
0x80000
);
uint8_t
*
rom
=
qemu_get_ram_ptr
(
rom_offset
);
cpu_register_physical_memory
(
0x60000000
,
0x80000
,
rom_offset
|
IO_MEM_ROM
);
MemoryRegion
*
rom_mr
=
g_new
(
MemoryRegion
,
1
);
memory_region_init_ram
(
rom_mr
,
NULL
,
"g364fb.rom"
,
0x80000
);
memory_region_set_readonly
(
rom_mr
,
true
);
uint8_t
*
rom
=
memory_region_get_ram_ptr
(
rom_mr
);
memory_region_add_subregion
(
address_space
,
0x60000000
,
rom_mr
);
rom
[
0
]
=
0x10
;
/* Mips G364 */
}
break
;
...
...
@@ -252,9 +253,8 @@ void mips_jazz_init (ram_addr_t ram_size,
/* Real time clock */
rtc_init
(
1980
,
NULL
);
s_rtc
=
cpu_register_io_memory
(
rtc_read
,
rtc_write
,
NULL
,
DEVICE_NATIVE_ENDIAN
);
cpu_register_physical_memory
(
0x80004000
,
0x00001000
,
s_rtc
);
memory_region_init_io
(
rtc
,
&
rtc_ops
,
NULL
,
"rtc"
,
0x1000
);
memory_region_add_subregion
(
address_space
,
0x80004000
,
rtc
);
/* Keyboard (i8042) */
i8042_mm_init
(
rc4030
[
6
],
rc4030
[
7
],
0x80005000
,
0x1000
,
0x1
);
...
...
@@ -299,7 +299,7 @@ void mips_magnum_init (ram_addr_t ram_size,
const
char
*
kernel_filename
,
const
char
*
kernel_cmdline
,
const
char
*
initrd_filename
,
const
char
*
cpu_model
)
{
mips_jazz_init
(
ram_size
,
cpu_model
,
JAZZ_MAGNUM
);
mips_jazz_init
(
get_system_memory
(),
ram_size
,
cpu_model
,
JAZZ_MAGNUM
);
}
static
...
...
@@ -308,7 +308,7 @@ void mips_pica61_init (ram_addr_t ram_size,
const
char
*
kernel_filename
,
const
char
*
kernel_cmdline
,
const
char
*
initrd_filename
,
const
char
*
cpu_model
)
{
mips_jazz_init
(
ram_size
,
cpu_model
,
JAZZ_PICA61
);
mips_jazz_init
(
get_system_memory
(),
ram_size
,
cpu_model
,
JAZZ_PICA61
);
}
static
QEMUMachine
mips_magnum_machine
=
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录