Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
7b9a3d86
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看板
提交
7b9a3d86
编写于
12月 03, 2010
作者:
J
Juan Quintela
提交者:
Anthony Liguori
4月 22, 2011
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vmstate: port nand
Signed-off-by:
N
Juan Quintela
<
quintela@redhat.com
>
上级
51db57f7
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
39 addition
and
34 deletion
+39
-34
hw/nand.c
hw/nand.c
+39
-34
未找到文件。
hw/nand.c
浏览文件 @
7b9a3d86
...
...
@@ -66,6 +66,8 @@ struct NANDFlashState {
void
(
*
blk_write
)(
NANDFlashState
*
s
);
void
(
*
blk_erase
)(
NANDFlashState
*
s
);
void
(
*
blk_load
)(
NANDFlashState
*
s
,
uint32_t
addr
,
int
offset
);
uint32_t
ioaddr_vmstate
;
};
# define NAND_NO_AUTOINCR 0x00000001
...
...
@@ -281,48 +283,51 @@ static void nand_command(NANDFlashState *s)
}
}
static
void
nand_
save
(
QEMUFile
*
f
,
void
*
opaque
)
static
void
nand_
pre_save
(
void
*
opaque
)
{
NANDFlashState
*
s
=
(
NANDFlashState
*
)
opaque
;
qemu_put_byte
(
f
,
s
->
cle
);
qemu_put_byte
(
f
,
s
->
ale
);
qemu_put_byte
(
f
,
s
->
ce
);
qemu_put_byte
(
f
,
s
->
wp
);
qemu_put_byte
(
f
,
s
->
gnd
);
qemu_put_buffer
(
f
,
s
->
io
,
sizeof
(
s
->
io
));
qemu_put_be32
(
f
,
s
->
ioaddr
-
s
->
io
);
qemu_put_be32
(
f
,
s
->
iolen
);
qemu_put_be32s
(
f
,
&
s
->
cmd
);
qemu_put_be32s
(
f
,
&
s
->
addr
);
qemu_put_be32
(
f
,
s
->
addrlen
);
qemu_put_be32
(
f
,
s
->
status
);
qemu_put_be32
(
f
,
s
->
offset
);
/* XXX: do we want to save s->storage too? */
NANDFlashState
*
s
=
opaque
;
s
->
ioaddr_vmstate
=
s
->
ioaddr
-
s
->
io
;
}
static
int
nand_
load
(
QEMUFile
*
f
,
void
*
opaque
,
int
version_id
)
static
int
nand_
post_load
(
void
*
opaque
,
int
version_id
)
{
NANDFlashState
*
s
=
(
NANDFlashState
*
)
opaque
;
s
->
cle
=
qemu_get_byte
(
f
);
s
->
ale
=
qemu_get_byte
(
f
);
s
->
ce
=
qemu_get_byte
(
f
);
s
->
wp
=
qemu_get_byte
(
f
);
s
->
gnd
=
qemu_get_byte
(
f
);
qemu_get_buffer
(
f
,
s
->
io
,
sizeof
(
s
->
io
));
s
->
ioaddr
=
s
->
io
+
qemu_get_be32
(
f
);
s
->
iolen
=
qemu_get_be32
(
f
);
if
(
s
->
ioaddr
>=
s
->
io
+
sizeof
(
s
->
io
)
||
s
->
ioaddr
<
s
->
io
)
NANDFlashState
*
s
=
opaque
;
if
(
s
->
ioaddr_vmstate
>
sizeof
(
s
->
io
))
{
return
-
EINVAL
;
}
s
->
ioaddr
=
s
->
io
+
s
->
ioaddr_vmstate
;
qemu_get_be32s
(
f
,
&
s
->
cmd
);
qemu_get_be32s
(
f
,
&
s
->
addr
);
s
->
addrlen
=
qemu_get_be32
(
f
);
s
->
status
=
qemu_get_be32
(
f
);
s
->
offset
=
qemu_get_be32
(
f
);
return
0
;
}
static
const
VMStateDescription
vmstate_nand
=
{
.
name
=
"nand"
,
.
version_id
=
0
,
.
minimum_version_id
=
0
,
.
minimum_version_id_old
=
0
,
.
pre_save
=
nand_pre_save
,
.
post_load
=
nand_post_load
,
.
fields
=
(
VMStateField
[])
{
VMSTATE_UINT8
(
cle
,
NANDFlashState
),
VMSTATE_UINT8
(
ale
,
NANDFlashState
),
VMSTATE_UINT8
(
ce
,
NANDFlashState
),
VMSTATE_UINT8
(
wp
,
NANDFlashState
),
VMSTATE_UINT8
(
gnd
,
NANDFlashState
),
VMSTATE_BUFFER
(
io
,
NANDFlashState
),
VMSTATE_UINT32
(
ioaddr_vmstate
,
NANDFlashState
),
VMSTATE_INT32
(
iolen
,
NANDFlashState
),
VMSTATE_UINT32
(
cmd
,
NANDFlashState
),
VMSTATE_UINT32
(
addr
,
NANDFlashState
),
VMSTATE_INT32
(
addrlen
,
NANDFlashState
),
VMSTATE_INT32
(
status
,
NANDFlashState
),
VMSTATE_INT32
(
offset
,
NANDFlashState
),
/* XXX: do we want to save s->storage too? */
VMSTATE_END_OF_LIST
()
}
};
/*
* Chip inputs are CLE, ALE, CE, WP, GND and eight I/O pins. Chip
* outputs are R/B and eight I/O pins.
...
...
@@ -502,7 +507,7 @@ NANDFlashState *nand_init(int manf_id, int chip_id)
is used. */
s
->
ioaddr
=
s
->
io
;
register_savevm
(
NULL
,
"nand"
,
-
1
,
0
,
nand_save
,
nand_loa
d
,
s
);
vmstate_register
(
NULL
,
-
1
,
&
vmstate_nan
d
,
s
);
return
s
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录