Compare commits
169 Commits
qemu-0888a
...
pull-audio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd6c88305f | ||
|
|
105a060188 | ||
|
|
3e890c77cf | ||
|
|
7a87a7b3e4 | ||
|
|
e607784fed | ||
|
|
9bd9d5e357 | ||
|
|
774d566cdb | ||
|
|
2ca92bb993 | ||
|
|
3d2bb5cc81 | ||
|
|
61e8a92364 | ||
|
|
4c0c9bbe78 | ||
|
|
2ea5a2ca1f | ||
|
|
60510aed69 | ||
|
|
e4b998d47d | ||
|
|
dfc15c7ceb | ||
|
|
70d7f984a0 | ||
|
|
13caf1fd2b | ||
|
|
d324b36ad9 | ||
|
|
7900e9f1f9 | ||
|
|
59a1c327d7 | ||
|
|
ea4571eb87 | ||
|
|
c4241c7d38 | ||
|
|
92611c0019 | ||
|
|
00108f2d4d | ||
|
|
fcd252062a | ||
|
|
f59df3f235 | ||
|
|
e508a92b62 | ||
|
|
626187d86b | ||
|
|
1456364ff0 | ||
|
|
99f678a679 | ||
|
|
76e3e1bcae | ||
|
|
83e9a4aec9 | ||
|
|
057d5f62f8 | ||
|
|
67d43538ae | ||
|
|
bc242f9bb6 | ||
|
|
8908f4d185 | ||
|
|
b033cd3d00 | ||
|
|
9f82e0ff4b | ||
|
|
c44ad1fddc | ||
|
|
f5e51e7f10 | ||
|
|
873169022a | ||
|
|
6d093a4f49 | ||
|
|
b15d422a23 | ||
|
|
cef60c925c | ||
|
|
98f9e35bef | ||
|
|
69d4c703a5 | ||
|
|
fff8c539bd | ||
|
|
94783de6fe | ||
|
|
5d59fd998f | ||
|
|
ef3ef4a040 | ||
|
|
e6bf23f82d | ||
|
|
9530570fa5 | ||
|
|
bf15f63cad | ||
|
|
501bb4b0cb | ||
|
|
3a5d30bf27 | ||
|
|
6afafa86f3 | ||
|
|
4fc4732047 | ||
|
|
d6bb65fcd2 | ||
|
|
4f9cc73422 | ||
|
|
cc03ff9d0a | ||
|
|
786ad214c7 | ||
|
|
c348e48175 | ||
|
|
f6969b9fef | ||
|
|
bd93976a1a | ||
|
|
91f32b0c92 | ||
|
|
1094fd3a62 | ||
|
|
b48fa074b5 | ||
|
|
992d3e64c8 | ||
|
|
fca72d9b49 | ||
|
|
77d1c3c63f | ||
|
|
84d18f065f | ||
|
|
ff9ec34de8 | ||
|
|
dde3a21840 | ||
|
|
6399ab3325 | ||
|
|
9d2eec202f | ||
|
|
ecc7e84327 | ||
|
|
a1b29c9ae0 | ||
|
|
189f792dc5 | ||
|
|
464a1441c1 | ||
|
|
e64e958e20 | ||
|
|
e201b56418 | ||
|
|
23ec69ed37 | ||
|
|
c8d7027253 | ||
|
|
f096dc9618 | ||
|
|
3031244b01 | ||
|
|
e46b225a31 | ||
|
|
7a3a00979d | ||
|
|
46eef33b89 | ||
|
|
f6aa2f7dee | ||
|
|
0dbcf95a1e | ||
|
|
078a1c37ca | ||
|
|
44e3a39f30 | ||
|
|
90ce3d76eb | ||
|
|
a50f98b066 | ||
|
|
88c1ee73d3 | ||
|
|
5556332aba | ||
|
|
b33276a7a8 | ||
|
|
24c84e687e | ||
|
|
262471794d | ||
|
|
62dc90c668 | ||
|
|
21684af023 | ||
|
|
3f281822b2 | ||
|
|
c1570e2a1f | ||
|
|
a63e5e0c0d | ||
|
|
e41b509d68 | ||
|
|
85ca1202d1 | ||
|
|
104059da54 | ||
|
|
f31c41ff5e | ||
|
|
c7bcc85d66 | ||
|
|
515f23462b | ||
|
|
dae3bda422 | ||
|
|
0b7593e085 | ||
|
|
98a6528461 | ||
|
|
7ce7ffe027 | ||
|
|
03ff777048 | ||
|
|
9e4d9620c4 | ||
|
|
7d9268647c | ||
|
|
a5829ccfc3 | ||
|
|
23802b4fe0 | ||
|
|
1f9c4cfda4 | ||
|
|
08c9cacf0e | ||
|
|
227d327252 | ||
|
|
a21ac343d1 | ||
|
|
5c57090255 | ||
|
|
371468297c | ||
|
|
76491071b3 | ||
|
|
b815ec5eea | ||
|
|
5297ea6fb8 | ||
|
|
0c5e94ee83 | ||
|
|
dd67fa5052 | ||
|
|
57b6bdf37c | ||
|
|
cc67f4d1f9 | ||
|
|
2aa4a86f59 | ||
|
|
18968ca1a3 | ||
|
|
e001807847 | ||
|
|
39a611a3e0 | ||
|
|
92838a19c1 | ||
|
|
85f68d552b | ||
|
|
74769fe7c8 | ||
|
|
4a053e7f71 | ||
|
|
a21baf7999 | ||
|
|
9fe451a08e | ||
|
|
dd37dfa9e7 | ||
|
|
59ab56b9ad | ||
|
|
933069eb53 | ||
|
|
b8bcf811bf | ||
|
|
b1be45153e | ||
|
|
bc229b0f90 | ||
|
|
a5f96db7e8 | ||
|
|
70b5169032 | ||
|
|
96dca6b9a9 | ||
|
|
a5c828525e | ||
|
|
6749695eaa | ||
|
|
3687d53259 | ||
|
|
bb6c5e3c3a | ||
|
|
5c1904f103 | ||
|
|
5ec889b4b1 | ||
|
|
28f106afb3 | ||
|
|
ee13ed1cbc | ||
|
|
1a838745b8 | ||
|
|
933b19ea97 | ||
|
|
292363e15c | ||
|
|
aaab89a68e | ||
|
|
b3be57c358 | ||
|
|
5631e69c26 | ||
|
|
736d120af4 | ||
|
|
b4dd99a363 | ||
|
|
b4160af160 | ||
|
|
e527526d35 |
152
.gitignore
vendored
152
.gitignore
vendored
@@ -1,64 +1,66 @@
|
||||
config-devices.*
|
||||
config-all-devices.*
|
||||
config-all-disas.*
|
||||
config-host.*
|
||||
config-target.*
|
||||
config.status
|
||||
trace/generated-tracers.h
|
||||
trace/generated-tracers.c
|
||||
trace/generated-tracers-dtrace.h
|
||||
trace/generated-tracers.dtrace
|
||||
trace/generated-events.h
|
||||
trace/generated-events.c
|
||||
libcacard/trace/generated-tracers.c
|
||||
/config-devices.*
|
||||
/config-all-devices.*
|
||||
/config-all-disas.*
|
||||
/config-host.*
|
||||
/config-target.*
|
||||
/config.status
|
||||
/trace/generated-tracers.h
|
||||
/trace/generated-tracers.c
|
||||
/trace/generated-tracers-dtrace.h
|
||||
/trace/generated-tracers.dtrace
|
||||
/trace/generated-events.h
|
||||
/trace/generated-events.c
|
||||
/trace/generated-ust-provider.h
|
||||
/trace/generated-ust.c
|
||||
/libcacard/trace/generated-tracers.c
|
||||
*-timestamp
|
||||
*-softmmu
|
||||
*-darwin-user
|
||||
*-linux-user
|
||||
*-bsd-user
|
||||
/*-softmmu
|
||||
/*-darwin-user
|
||||
/*-linux-user
|
||||
/*-bsd-user
|
||||
libdis*
|
||||
libuser
|
||||
linux-headers/asm
|
||||
qapi-generated
|
||||
qapi-types.[ch]
|
||||
qapi-visit.[ch]
|
||||
qmp-commands.h
|
||||
qmp-marshal.c
|
||||
qemu-doc.html
|
||||
qemu-tech.html
|
||||
qemu-doc.info
|
||||
qemu-tech.info
|
||||
qemu.1
|
||||
qemu.pod
|
||||
qemu-img.1
|
||||
qemu-img.pod
|
||||
qemu-img
|
||||
qemu-nbd
|
||||
qemu-nbd.8
|
||||
qemu-nbd.pod
|
||||
qemu-options.def
|
||||
qemu-options.texi
|
||||
qemu-img-cmds.texi
|
||||
qemu-img-cmds.h
|
||||
qemu-io
|
||||
qemu-ga
|
||||
qemu-bridge-helper
|
||||
qemu-monitor.texi
|
||||
vscclient
|
||||
qmp-commands.txt
|
||||
test-bitops
|
||||
test-coroutine
|
||||
test-int128
|
||||
test-opts-visitor
|
||||
test-qmp-input-visitor
|
||||
test-qmp-output-visitor
|
||||
test-string-input-visitor
|
||||
test-string-output-visitor
|
||||
test-visitor-serialization
|
||||
fsdev/virtfs-proxy-helper
|
||||
fsdev/virtfs-proxy-helper.1
|
||||
fsdev/virtfs-proxy-helper.pod
|
||||
.gdbinit
|
||||
/linux-headers/asm
|
||||
/qapi-generated
|
||||
/qapi-types.[ch]
|
||||
/qapi-visit.[ch]
|
||||
/qmp-commands.h
|
||||
/qmp-marshal.c
|
||||
/qemu-doc.html
|
||||
/qemu-tech.html
|
||||
/qemu-doc.info
|
||||
/qemu-tech.info
|
||||
/qemu.1
|
||||
/qemu.pod
|
||||
/qemu-img.1
|
||||
/qemu-img.pod
|
||||
/qemu-img
|
||||
/qemu-nbd
|
||||
/qemu-nbd.8
|
||||
/qemu-nbd.pod
|
||||
/qemu-options.def
|
||||
/qemu-options.texi
|
||||
/qemu-img-cmds.texi
|
||||
/qemu-img-cmds.h
|
||||
/qemu-io
|
||||
/qemu-ga
|
||||
/qemu-bridge-helper
|
||||
/qemu-monitor.texi
|
||||
/qmp-commands.txt
|
||||
/vscclient
|
||||
/test-bitops
|
||||
/test-coroutine
|
||||
/test-int128
|
||||
/test-opts-visitor
|
||||
/test-qmp-input-visitor
|
||||
/test-qmp-output-visitor
|
||||
/test-string-input-visitor
|
||||
/test-string-output-visitor
|
||||
/test-visitor-serialization
|
||||
/fsdev/virtfs-proxy-helper
|
||||
/fsdev/virtfs-proxy-helper.1
|
||||
/fsdev/virtfs-proxy-helper.pod
|
||||
/.gdbinit
|
||||
*.a
|
||||
*.aux
|
||||
*.cp
|
||||
@@ -77,7 +79,7 @@ fsdev/virtfs-proxy-helper.pod
|
||||
*.tp
|
||||
*.vr
|
||||
*.d
|
||||
!scripts/qemu-guest-agent/fsfreeze-hook.d
|
||||
!/scripts/qemu-guest-agent/fsfreeze-hook.d
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
@@ -90,22 +92,22 @@ fsdev/virtfs-proxy-helper.pod
|
||||
*.gcda
|
||||
*.gcno
|
||||
patches
|
||||
pc-bios/bios-pq/status
|
||||
pc-bios/vgabios-pq/status
|
||||
pc-bios/optionrom/linuxboot.asm
|
||||
pc-bios/optionrom/linuxboot.bin
|
||||
pc-bios/optionrom/linuxboot.raw
|
||||
pc-bios/optionrom/linuxboot.img
|
||||
pc-bios/optionrom/multiboot.asm
|
||||
pc-bios/optionrom/multiboot.bin
|
||||
pc-bios/optionrom/multiboot.raw
|
||||
pc-bios/optionrom/multiboot.img
|
||||
pc-bios/optionrom/kvmvapic.asm
|
||||
pc-bios/optionrom/kvmvapic.bin
|
||||
pc-bios/optionrom/kvmvapic.raw
|
||||
pc-bios/optionrom/kvmvapic.img
|
||||
pc-bios/s390-ccw/s390-ccw.elf
|
||||
pc-bios/s390-ccw/s390-ccw.img
|
||||
/pc-bios/bios-pq/status
|
||||
/pc-bios/vgabios-pq/status
|
||||
/pc-bios/optionrom/linuxboot.asm
|
||||
/pc-bios/optionrom/linuxboot.bin
|
||||
/pc-bios/optionrom/linuxboot.raw
|
||||
/pc-bios/optionrom/linuxboot.img
|
||||
/pc-bios/optionrom/multiboot.asm
|
||||
/pc-bios/optionrom/multiboot.bin
|
||||
/pc-bios/optionrom/multiboot.raw
|
||||
/pc-bios/optionrom/multiboot.img
|
||||
/pc-bios/optionrom/kvmvapic.asm
|
||||
/pc-bios/optionrom/kvmvapic.bin
|
||||
/pc-bios/optionrom/kvmvapic.raw
|
||||
/pc-bios/optionrom/kvmvapic.img
|
||||
/pc-bios/s390-ccw/s390-ccw.elf
|
||||
/pc-bios/s390-ccw/s390-ccw.img
|
||||
.stgit-*
|
||||
cscope.*
|
||||
tags
|
||||
|
||||
5
Makefile
5
Makefile
@@ -57,6 +57,11 @@ GENERATED_HEADERS += trace/generated-tracers-dtrace.h
|
||||
endif
|
||||
GENERATED_SOURCES += trace/generated-tracers.c
|
||||
|
||||
ifeq ($(TRACE_BACKEND),ust)
|
||||
GENERATED_HEADERS += trace/generated-ust-provider.h
|
||||
GENERATED_SOURCES += trace/generated-ust.c
|
||||
endif
|
||||
|
||||
# Don't try to regenerate Makefile or configure
|
||||
# We don't generate any of them
|
||||
Makefile: ;
|
||||
|
||||
52
block.c
52
block.c
@@ -421,7 +421,7 @@ static void coroutine_fn bdrv_create_co_entry(void *opaque)
|
||||
assert(cco->drv);
|
||||
|
||||
ret = cco->drv->bdrv_create(cco->filename, cco->options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(&cco->err, local_err);
|
||||
}
|
||||
cco->ret = ret;
|
||||
@@ -460,7 +460,7 @@ int bdrv_create(BlockDriver *drv, const char* filename,
|
||||
|
||||
ret = cco.ret;
|
||||
if (ret < 0) {
|
||||
if (error_is_set(&cco.err)) {
|
||||
if (cco.err) {
|
||||
error_propagate(errp, cco.err);
|
||||
} else {
|
||||
error_setg_errno(errp, -ret, "Could not create image");
|
||||
@@ -486,7 +486,7 @@ int bdrv_create_file(const char* filename, QEMUOptionParameter *options,
|
||||
}
|
||||
|
||||
ret = bdrv_create(drv, filename, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
@@ -796,6 +796,13 @@ static int bdrv_assign_node_name(BlockDriverState *bs,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* takes care of avoiding namespaces collisions */
|
||||
if (bdrv_find(node_name)) {
|
||||
error_setg(errp, "node-name=%s is conflicting with a device id",
|
||||
node_name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* takes care of avoiding duplicates node names */
|
||||
if (bdrv_find_node(node_name)) {
|
||||
error_setg(errp, "Duplicate node name");
|
||||
@@ -909,7 +916,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
||||
}
|
||||
|
||||
if (ret < 0) {
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
} else if (bs->filename[0]) {
|
||||
error_setg_errno(errp, -ret, "Could not open '%s'", bs->filename);
|
||||
@@ -977,9 +984,8 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
|
||||
}
|
||||
QDECREF(options);
|
||||
|
||||
bs = bdrv_find(reference);
|
||||
bs = bdrv_lookup_bs(reference, reference, errp);
|
||||
if (!bs) {
|
||||
error_setg(errp, "Cannot find block device '%s'", reference);
|
||||
return -ENODEV;
|
||||
}
|
||||
bdrv_ref(bs);
|
||||
@@ -1031,7 +1037,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
|
||||
/* Parse the filename and open it */
|
||||
if (drv->bdrv_parse_filename && filename) {
|
||||
drv->bdrv_parse_filename(filename, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
@@ -1400,7 +1406,7 @@ fail:
|
||||
QDECREF(bs->options);
|
||||
QDECREF(options);
|
||||
bs->options = NULL;
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
@@ -1408,7 +1414,7 @@ fail:
|
||||
close_and_fail:
|
||||
bdrv_close(bs);
|
||||
QDECREF(options);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
@@ -3574,30 +3580,26 @@ BlockDriverState *bdrv_lookup_bs(const char *device,
|
||||
{
|
||||
BlockDriverState *bs = NULL;
|
||||
|
||||
if ((!device && !node_name) || (device && node_name)) {
|
||||
error_setg(errp, "Use either device or node-name but not both");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (device) {
|
||||
bs = bdrv_find(device);
|
||||
|
||||
if (!bs) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
return NULL;
|
||||
if (bs) {
|
||||
return bs;
|
||||
}
|
||||
|
||||
return bs;
|
||||
}
|
||||
|
||||
bs = bdrv_find_node(node_name);
|
||||
if (node_name) {
|
||||
bs = bdrv_find_node(node_name);
|
||||
|
||||
if (!bs) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, node_name);
|
||||
return NULL;
|
||||
if (bs) {
|
||||
return bs;
|
||||
}
|
||||
}
|
||||
|
||||
return bs;
|
||||
error_setg(errp, "Cannot find device=%s nor node_name=%s",
|
||||
device ? device : "",
|
||||
node_name ? node_name : "");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BlockDriverState *bdrv_next(BlockDriverState *bs)
|
||||
@@ -5338,7 +5340,7 @@ out:
|
||||
free_option_parameters(create_options);
|
||||
free_option_parameters(param);
|
||||
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ static int read_config(BDRVBlkdebugState *s, const char *filename,
|
||||
}
|
||||
|
||||
qemu_config_parse_qdict(options, config_groups, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
@@ -393,7 +393,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto out;
|
||||
|
||||
@@ -128,7 +128,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
|
||||
@@ -463,7 +463,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
goto out_noclean;
|
||||
|
||||
@@ -282,7 +282,7 @@ static int qemu_gluster_open(BlockDriverState *bs, QDict *options,
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
ret = -EINVAL;
|
||||
|
||||
@@ -1099,6 +1099,10 @@ fail:
|
||||
/*
|
||||
* We support iscsi url's on the form
|
||||
* iscsi://[<username>%<password>@]<host>[:<port>]/<targetname>/<lun>
|
||||
*
|
||||
* Note: flags are currently not used by iscsi_open. If this function
|
||||
* is changed such that flags are used, please examine iscsi_reopen_prepare()
|
||||
* to see if needs to be changed as well.
|
||||
*/
|
||||
static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
@@ -1123,7 +1127,7 @@ static int iscsi_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
ret = -EINVAL;
|
||||
@@ -1336,11 +1340,13 @@ static int iscsi_refresh_limits(BlockDriverState *bs)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We have nothing to do for iSCSI reopen, stub just returns
|
||||
* success */
|
||||
/* Since iscsi_open() ignores bdrv_flags, there is nothing to do here in
|
||||
* prepare. Note that this will not re-establish a connection with an iSCSI
|
||||
* target - it is effectively a NOP. */
|
||||
static int iscsi_reopen_prepare(BDRVReopenState *state,
|
||||
BlockReopenQueue *queue, Error **errp)
|
||||
{
|
||||
/* NOP */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -633,6 +633,8 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
{
|
||||
int64_t length, base_length;
|
||||
int orig_base_flags;
|
||||
int ret;
|
||||
Error *local_err = NULL;
|
||||
|
||||
orig_base_flags = bdrv_get_flags(base);
|
||||
|
||||
@@ -642,19 +644,23 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
|
||||
length = bdrv_getlength(bs);
|
||||
if (length < 0) {
|
||||
error_setg(errp, "Unable to determine length of %s", bs->filename);
|
||||
error_setg_errno(errp, -length,
|
||||
"Unable to determine length of %s", bs->filename);
|
||||
goto error_restore_flags;
|
||||
}
|
||||
|
||||
base_length = bdrv_getlength(base);
|
||||
if (base_length < 0) {
|
||||
error_setg(errp, "Unable to determine length of %s", base->filename);
|
||||
error_setg_errno(errp, -base_length,
|
||||
"Unable to determine length of %s", base->filename);
|
||||
goto error_restore_flags;
|
||||
}
|
||||
|
||||
if (length > base_length) {
|
||||
if (bdrv_truncate(base, length) < 0) {
|
||||
error_setg(errp, "Top image %s is larger than base image %s, and "
|
||||
ret = bdrv_truncate(base, length);
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret,
|
||||
"Top image %s is larger than base image %s, and "
|
||||
"resize of base image failed",
|
||||
bs->filename, base->filename);
|
||||
goto error_restore_flags;
|
||||
@@ -663,9 +669,10 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
|
||||
|
||||
bdrv_ref(base);
|
||||
mirror_start_job(bs, base, speed, 0, 0,
|
||||
on_error, on_error, cb, opaque, errp,
|
||||
on_error, on_error, cb, opaque, &local_err,
|
||||
&commit_active_job_driver, false, base);
|
||||
if (error_is_set(errp)) {
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
goto error_restore_flags;
|
||||
}
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ static int nbd_config(BDRVNBDState *s, QDict *options, char **export)
|
||||
&error_abort);
|
||||
|
||||
qemu_opts_absorb_qdict(s->socket_opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
return -EINVAL;
|
||||
|
||||
@@ -271,7 +271,7 @@ void bdrv_query_info(BlockDriverState *bs,
|
||||
p_image_info = &info->inserted->image;
|
||||
while (1) {
|
||||
bdrv_query_image_info(bs0, p_image_info, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto err;
|
||||
}
|
||||
@@ -336,7 +336,7 @@ BlockInfoList *qmp_query_block(Error **errp)
|
||||
while ((bs = bdrv_next(bs))) {
|
||||
BlockInfoList *info = g_malloc0(sizeof(*info));
|
||||
bdrv_query_info(bs, &info->value, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -606,7 +606,8 @@ int qcow2_snapshot_delete(BlockDriverState *bs,
|
||||
s->nb_snapshots--;
|
||||
ret = qcow2_write_snapshots(bs);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to remove snapshot from snapshot list");
|
||||
error_setg_errno(errp, -ret,
|
||||
"Failed to remove snapshot from snapshot list");
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -624,7 +625,7 @@ int qcow2_snapshot_delete(BlockDriverState *bs,
|
||||
ret = qcow2_update_snapshot_refcount(bs, sn.l1_table_offset,
|
||||
sn.l1_size, -1);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to free the cluster and L1 table");
|
||||
error_setg_errno(errp, -ret, "Failed to free the cluster and L1 table");
|
||||
return ret;
|
||||
}
|
||||
qcow2_free_clusters(bs, sn.l1_table_offset, sn.l1_size * sizeof(uint64_t),
|
||||
@@ -633,7 +634,8 @@ int qcow2_snapshot_delete(BlockDriverState *bs,
|
||||
/* must update the copied flag on the current cluster offsets */
|
||||
ret = qcow2_update_snapshot_refcount(bs, s->l1_table_offset, s->l1_size, 0);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Failed to update snapshot status in disk");
|
||||
error_setg_errno(errp, -ret,
|
||||
"Failed to update snapshot status in disk");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -671,7 +671,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
/* Enable lazy_refcounts according to image and command line options */
|
||||
opts = qemu_opts_create(&qcow2_runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
@@ -1605,7 +1605,7 @@ static int qcow2_create2(const char *filename, int64_t total_size,
|
||||
ret = bdrv_open(bs, filename, NULL,
|
||||
BDRV_O_RDWR | BDRV_O_CACHE_WB | BDRV_O_NO_BACKING,
|
||||
drv, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto out;
|
||||
}
|
||||
@@ -1685,7 +1685,7 @@ static int qcow2_create(const char *filename, QEMUOptionParameter *options,
|
||||
|
||||
ret = qcow2_create2(filename, sectors, backing_file, backing_fmt, flags,
|
||||
cluster_size, prealloc, options, version, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -361,7 +361,7 @@ static int raw_open_common(BlockDriverState *bs, QDict *options,
|
||||
|
||||
opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
@@ -448,7 +448,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
s->type = FTYPE_FILE;
|
||||
ret = raw_open_common(bs, options, flags, 0, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
@@ -1597,7 +1597,7 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
ret = raw_open_common(bs, options, flags, 0, &local_err);
|
||||
if (ret < 0) {
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
@@ -1832,7 +1832,7 @@ static int floppy_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
/* open will not fail even if no floppy is inserted, so add O_NONBLOCK */
|
||||
ret = raw_open_common(bs, options, flags, O_NONBLOCK, &local_err);
|
||||
if (ret) {
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
@@ -1961,7 +1961,7 @@ static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
/* open will not fail even if no CD is inserted, so add O_NONBLOCK */
|
||||
ret = raw_open_common(bs, options, flags, O_NONBLOCK, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
@@ -2078,7 +2078,7 @@ static int cdrom_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
ret = raw_open_common(bs, options, flags, 0, &local_err);
|
||||
if (ret) {
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -279,7 +279,7 @@ static int raw_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
opts = qemu_opts_create(&raw_runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
@@ -594,7 +594,7 @@ static int hdev_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
QemuOpts *opts = qemu_opts_create(&raw_runtime_opts, NULL, 0,
|
||||
&error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
|
||||
@@ -146,7 +146,7 @@ static int raw_create(const char *filename, QEMUOptionParameter *options,
|
||||
int ret;
|
||||
|
||||
ret = bdrv_create_file(filename, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
return ret;
|
||||
|
||||
@@ -440,7 +440,7 @@ static int qemu_rbd_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
qemu_opts_del(opts);
|
||||
|
||||
@@ -1385,7 +1385,7 @@ static int sd_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
ret = -EINVAL;
|
||||
|
||||
@@ -345,7 +345,7 @@ int bdrv_snapshot_load_tmp_by_id_or_name(BlockDriverState *bs,
|
||||
ret = bdrv_snapshot_load_tmp(bs, NULL, id_or_name, &local_err);
|
||||
}
|
||||
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
||||
|
||||
@@ -1502,7 +1502,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
if (flat) {
|
||||
ret = bdrv_truncate(bs, filesize);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Could not truncate file");
|
||||
error_setg_errno(errp, -ret, "Could not truncate file");
|
||||
}
|
||||
goto exit;
|
||||
}
|
||||
@@ -1562,7 +1562,7 @@ static int vmdk_create_extent(const char *filename, int64_t filesize,
|
||||
|
||||
ret = bdrv_truncate(bs, le64_to_cpu(header.grain_offset) << 9);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Could not truncate file");
|
||||
error_setg_errno(errp, -ret, "Could not truncate file");
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@@ -1846,7 +1846,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
|
||||
if (desc_offset == 0) {
|
||||
ret = bdrv_truncate(new_bs, desc_len);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "Could not truncate file");
|
||||
error_setg_errno(errp, -ret, "Could not truncate file");
|
||||
}
|
||||
}
|
||||
exit:
|
||||
|
||||
@@ -1085,7 +1085,7 @@ DLOG(if (stderr == NULL) {
|
||||
|
||||
opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort);
|
||||
qemu_opts_absorb_qdict(opts, options, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
ret = -EINVAL;
|
||||
|
||||
101
blockdev.c
101
blockdev.c
@@ -308,7 +308,6 @@ typedef enum { MEDIA_DISK, MEDIA_CDROM } DriveMediaType;
|
||||
|
||||
/* Takes the ownership of bs_opts */
|
||||
static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
BlockInterfaceType type,
|
||||
Error **errp)
|
||||
{
|
||||
const char *buf;
|
||||
@@ -331,13 +330,13 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
* stay in bs_opts for processing by bdrv_open(). */
|
||||
id = qdict_get_try_str(bs_opts, "id");
|
||||
opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error);
|
||||
if (error_is_set(&error)) {
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qemu_opts_absorb_qdict(opts, bs_opts, &error);
|
||||
if (error_is_set(&error)) {
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
goto early_err;
|
||||
}
|
||||
@@ -437,13 +436,8 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
|
||||
on_write_error = BLOCKDEV_ON_ERROR_ENOSPC;
|
||||
if ((buf = qemu_opt_get(opts, "werror")) != NULL) {
|
||||
if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) {
|
||||
error_setg(errp, "werror is not supported by this bus type");
|
||||
goto early_err;
|
||||
}
|
||||
|
||||
on_write_error = parse_block_error_action(buf, 0, &error);
|
||||
if (error_is_set(&error)) {
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
goto early_err;
|
||||
}
|
||||
@@ -451,25 +445,25 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
|
||||
on_read_error = BLOCKDEV_ON_ERROR_REPORT;
|
||||
if ((buf = qemu_opt_get(opts, "rerror")) != NULL) {
|
||||
if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) {
|
||||
error_report("rerror is not supported by this bus type");
|
||||
goto early_err;
|
||||
}
|
||||
|
||||
on_read_error = parse_block_error_action(buf, 1, &error);
|
||||
if (error_is_set(&error)) {
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
goto early_err;
|
||||
}
|
||||
}
|
||||
|
||||
if (bdrv_find_node(qemu_opts_id(opts))) {
|
||||
error_setg(errp, "device id=%s is conflicting with a node-name",
|
||||
qemu_opts_id(opts));
|
||||
goto early_err;
|
||||
}
|
||||
|
||||
/* init */
|
||||
dinfo = g_malloc0(sizeof(*dinfo));
|
||||
dinfo->id = g_strdup(qemu_opts_id(opts));
|
||||
dinfo->bdrv = bdrv_new(dinfo->id);
|
||||
dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
|
||||
dinfo->bdrv->read_only = ro;
|
||||
dinfo->type = type;
|
||||
dinfo->refcount = 1;
|
||||
if (serial != NULL) {
|
||||
dinfo->serial = g_strdup(serial);
|
||||
@@ -608,6 +602,14 @@ QemuOptsList qemu_legacy_drive_opts = {
|
||||
.name = "read-only",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
.help = "open drive file as read-only",
|
||||
},{
|
||||
.name = "rerror",
|
||||
.type = QEMU_OPT_STRING,
|
||||
.help = "read error action",
|
||||
},{
|
||||
.name = "werror",
|
||||
.type = QEMU_OPT_STRING,
|
||||
.help = "write error action",
|
||||
},{
|
||||
.name = "copy-on-read",
|
||||
.type = QEMU_OPT_BOOL,
|
||||
@@ -629,6 +631,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
int cyls, heads, secs, translation;
|
||||
int max_devs, bus_id, unit_id, index;
|
||||
const char *devaddr;
|
||||
const char *werror, *rerror;
|
||||
bool read_only = false;
|
||||
bool copy_on_read;
|
||||
const char *filename;
|
||||
@@ -688,7 +691,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
legacy_opts = qemu_opts_create(&qemu_legacy_drive_opts, NULL, 0,
|
||||
&error_abort);
|
||||
qemu_opts_absorb_qdict(legacy_opts, bs_opts, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
goto fail;
|
||||
@@ -776,6 +779,10 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
translation = BIOS_ATA_TRANSLATION_NONE;
|
||||
} else if (!strcmp(value, "lba")) {
|
||||
translation = BIOS_ATA_TRANSLATION_LBA;
|
||||
} else if (!strcmp(value, "large")) {
|
||||
translation = BIOS_ATA_TRANSLATION_LARGE;
|
||||
} else if (!strcmp(value, "rechs")) {
|
||||
translation = BIOS_ATA_TRANSLATION_RECHS;
|
||||
} else if (!strcmp(value, "auto")) {
|
||||
translation = BIOS_ATA_TRANSLATION_AUTO;
|
||||
} else {
|
||||
@@ -872,16 +879,37 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
|
||||
filename = qemu_opt_get(legacy_opts, "file");
|
||||
|
||||
/* Check werror/rerror compatibility with if=... */
|
||||
werror = qemu_opt_get(legacy_opts, "werror");
|
||||
if (werror != NULL) {
|
||||
if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO &&
|
||||
type != IF_NONE) {
|
||||
error_report("werror is not supported by this bus type");
|
||||
goto fail;
|
||||
}
|
||||
qdict_put(bs_opts, "werror", qstring_from_str(werror));
|
||||
}
|
||||
|
||||
rerror = qemu_opt_get(legacy_opts, "rerror");
|
||||
if (rerror != NULL) {
|
||||
if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI &&
|
||||
type != IF_NONE) {
|
||||
error_report("rerror is not supported by this bus type");
|
||||
goto fail;
|
||||
}
|
||||
qdict_put(bs_opts, "rerror", qstring_from_str(rerror));
|
||||
}
|
||||
|
||||
/* Actual block device init: Functionality shared with blockdev-add */
|
||||
dinfo = blockdev_init(filename, bs_opts, type, &local_err);
|
||||
dinfo = blockdev_init(filename, bs_opts, &local_err);
|
||||
if (dinfo == NULL) {
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
}
|
||||
goto fail;
|
||||
} else {
|
||||
assert(!error_is_set(&local_err));
|
||||
assert(!local_err);
|
||||
}
|
||||
|
||||
/* Set legacy DriveInfo fields */
|
||||
@@ -893,6 +921,7 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
dinfo->secs = secs;
|
||||
dinfo->trans = translation;
|
||||
|
||||
dinfo->type = type;
|
||||
dinfo->bus = bus_id;
|
||||
dinfo->unit = unit_id;
|
||||
dinfo->devaddr = devaddr;
|
||||
@@ -1017,7 +1046,7 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device,
|
||||
}
|
||||
|
||||
ret = bdrv_snapshot_find_by_id_and_name(bs, id, name, &sn, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1030,7 +1059,7 @@ SnapshotInfo *qmp_blockdev_snapshot_delete_internal_sync(const char *device,
|
||||
}
|
||||
|
||||
bdrv_snapshot_delete(bs, id, name, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1244,7 +1273,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
state->old_bs = bdrv_lookup_bs(has_device ? device : NULL,
|
||||
has_node_name ? node_name : NULL,
|
||||
&local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
@@ -1289,7 +1318,7 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
state->old_bs->filename,
|
||||
state->old_bs->drv->format_name,
|
||||
NULL, -1, flags, &local_err, false);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
@@ -1310,8 +1339,6 @@ static void external_snapshot_prepare(BlkTransactionState *common,
|
||||
if (ret != 0) {
|
||||
error_propagate(errp, local_err);
|
||||
}
|
||||
|
||||
QDECREF(options);
|
||||
}
|
||||
|
||||
static void external_snapshot_commit(BlkTransactionState *common)
|
||||
@@ -1360,7 +1387,7 @@ static void drive_backup_prepare(BlkTransactionState *common, Error **errp)
|
||||
backup->has_on_source_error, backup->on_source_error,
|
||||
backup->has_on_target_error, backup->on_target_error,
|
||||
&local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
state->bs = NULL;
|
||||
state->job = NULL;
|
||||
@@ -1452,7 +1479,7 @@ void qmp_transaction(TransactionActionList *dev_list, Error **errp)
|
||||
QSIMPLEQ_INSERT_TAIL(&snap_bdrv_states, state, entry);
|
||||
|
||||
state->ops->prepare(state, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto delete_and_fail;
|
||||
}
|
||||
@@ -1533,7 +1560,7 @@ void qmp_block_passwd(bool has_device, const char *device,
|
||||
bs = bdrv_lookup_bs(has_device ? device : NULL,
|
||||
has_node_name ? node_name : NULL,
|
||||
&local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
@@ -1598,7 +1625,7 @@ void qmp_change_blockdev(const char *device, const char *filename,
|
||||
}
|
||||
|
||||
eject_device(bs, 0, &err);
|
||||
if (error_is_set(&err)) {
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
@@ -1735,7 +1762,7 @@ void qmp_block_resize(bool has_device, const char *device,
|
||||
bs = bdrv_lookup_bs(has_device ? device : NULL,
|
||||
has_node_name ? node_name : NULL,
|
||||
&local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
@@ -1828,7 +1855,7 @@ void qmp_block_stream(const char *device, bool has_base,
|
||||
|
||||
stream_start(bs, base_bs, base, has_speed ? speed : 0,
|
||||
on_error, block_job_cb, bs, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
@@ -1986,7 +2013,7 @@ void qmp_drive_backup(const char *device, const char *target,
|
||||
}
|
||||
}
|
||||
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
@@ -2127,7 +2154,7 @@ void qmp_drive_mirror(const char *device, const char *target,
|
||||
}
|
||||
}
|
||||
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
@@ -2266,7 +2293,7 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
||||
|
||||
visit_type_BlockdevOptions(qmp_output_get_visitor(ov),
|
||||
&options, NULL, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto fail;
|
||||
}
|
||||
@@ -2276,8 +2303,8 @@ void qmp_blockdev_add(BlockdevOptions *options, Error **errp)
|
||||
|
||||
qdict_flatten(qdict);
|
||||
|
||||
blockdev_init(NULL, qdict, IF_NONE, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
blockdev_init(NULL, qdict, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ void *block_job_create(const BlockJobDriver *driver, BlockDriverState *bs,
|
||||
Error *local_err = NULL;
|
||||
|
||||
block_job_set_speed(job, speed, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
bs->job = NULL;
|
||||
g_free(job);
|
||||
bdrv_set_in_use(bs, 0);
|
||||
@@ -92,7 +92,7 @@ void block_job_set_speed(BlockJob *job, int64_t speed, Error **errp)
|
||||
return;
|
||||
}
|
||||
job->driver->set_speed(job, speed, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
|
||||
112
configure
vendored
112
configure
vendored
@@ -1392,6 +1392,11 @@ EOF
|
||||
pie="no"
|
||||
fi
|
||||
fi
|
||||
|
||||
if compile_prog "-fno-pie" "-nopie"; then
|
||||
CFLAGS_NOPIE="-fno-pie"
|
||||
LDFLAGS_NOPIE="-nopie"
|
||||
fi
|
||||
fi
|
||||
|
||||
##########################################
|
||||
@@ -1474,9 +1479,11 @@ esac
|
||||
|
||||
feature_not_found() {
|
||||
feature=$1
|
||||
remedy=$2
|
||||
|
||||
error_exit "User requested feature $feature" \
|
||||
"configure was not able to find it"
|
||||
"configure was not able to find it." \
|
||||
"$remedy"
|
||||
}
|
||||
|
||||
# ---
|
||||
@@ -1524,7 +1531,7 @@ int main(void) {
|
||||
}
|
||||
EOF
|
||||
if ! compile_object ; then
|
||||
feature_not_found "nptl"
|
||||
feature_not_found "nptl" "Install glibc and linux kernel headers."
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1555,7 +1562,7 @@ if test "$seccomp" != "no" ; then
|
||||
seccomp="yes"
|
||||
else
|
||||
if test "$seccomp" = "yes"; then
|
||||
feature_not_found "libseccomp"
|
||||
feature_not_found "libseccomp" "Install libseccomp devel >= 2.1.0"
|
||||
fi
|
||||
seccomp="no"
|
||||
fi
|
||||
@@ -1580,7 +1587,7 @@ EOF
|
||||
if ! compile_prog "" "$xen_libs" ; then
|
||||
# Xen not found
|
||||
if test "$xen" = "yes" ; then
|
||||
feature_not_found "xen"
|
||||
feature_not_found "xen" "Install xen devel"
|
||||
fi
|
||||
xen=no
|
||||
|
||||
@@ -1703,7 +1710,7 @@ EOF
|
||||
# Xen version unsupported
|
||||
else
|
||||
if test "$xen" = "yes" ; then
|
||||
feature_not_found "xen (unsupported version)"
|
||||
feature_not_found "xen (unsupported version)" "Install supported xen (e.g. 4.0, 3.4, 3.3)"
|
||||
fi
|
||||
xen=no
|
||||
fi
|
||||
@@ -1752,7 +1759,7 @@ if test "$sparse" != "no" ; then
|
||||
sparse=yes
|
||||
else
|
||||
if test "$sparse" = "yes" ; then
|
||||
feature_not_found "sparse"
|
||||
feature_not_found "sparse" "Install sparse binary"
|
||||
fi
|
||||
sparse=no
|
||||
fi
|
||||
@@ -1774,7 +1781,7 @@ if test "$gtk" != "no"; then
|
||||
fi
|
||||
if ! $pkg_config --exists "$gtkpackage >= $gtkversion"; then
|
||||
if test "$gtk" = "yes" ; then
|
||||
feature_not_found "gtk"
|
||||
feature_not_found "gtk" "Install gtk2 or gtk3 (requires --with-gtkabi=3.0 option to configure) devel"
|
||||
fi
|
||||
gtk="no"
|
||||
elif ! $pkg_config --exists "$vtepackage >= $vteversion"; then
|
||||
@@ -1809,7 +1816,7 @@ elif has ${sdl_config}; then
|
||||
_sdlversion=`$sdlconfig --version | sed 's/[^0-9]//g'`
|
||||
else
|
||||
if test "$sdl" = "yes" ; then
|
||||
feature_not_found "sdl"
|
||||
feature_not_found "sdl" "Install SDL devel"
|
||||
fi
|
||||
sdl=no
|
||||
fi
|
||||
@@ -1853,7 +1860,7 @@ EOF
|
||||
fi # static link
|
||||
else # sdl not found
|
||||
if test "$sdl" = "yes" ; then
|
||||
feature_not_found "sdl"
|
||||
feature_not_found "sdl" "Install SDL devel"
|
||||
fi
|
||||
sdl=no
|
||||
fi # sdl compile test
|
||||
@@ -1919,10 +1926,10 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_tls_cflags"
|
||||
else
|
||||
if test "$vnc_tls" = "yes" ; then
|
||||
feature_not_found "vnc-tls"
|
||||
feature_not_found "vnc-tls" "Install gnutls devel"
|
||||
fi
|
||||
if test "$vnc_ws" = "yes" ; then
|
||||
feature_not_found "vnc-ws"
|
||||
feature_not_found "vnc-ws" "Install gnutls devel"
|
||||
fi
|
||||
vnc_tls=no
|
||||
vnc_ws=no
|
||||
@@ -1946,7 +1953,7 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_sasl_cflags"
|
||||
else
|
||||
if test "$vnc_sasl" = "yes" ; then
|
||||
feature_not_found "vnc-sasl"
|
||||
feature_not_found "vnc-sasl" "Install Cyrus SASL devel"
|
||||
fi
|
||||
vnc_sasl=no
|
||||
fi
|
||||
@@ -1968,7 +1975,7 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_jpeg_cflags"
|
||||
else
|
||||
if test "$vnc_jpeg" = "yes" ; then
|
||||
feature_not_found "vnc-jpeg"
|
||||
feature_not_found "vnc-jpeg" "Install libjpeg-turbo devel"
|
||||
fi
|
||||
vnc_jpeg=no
|
||||
fi
|
||||
@@ -2000,7 +2007,7 @@ EOF
|
||||
QEMU_CFLAGS="$QEMU_CFLAGS $vnc_png_cflags"
|
||||
else
|
||||
if test "$vnc_png" = "yes" ; then
|
||||
feature_not_found "vnc-png"
|
||||
feature_not_found "vnc-png" "Install libpng devel"
|
||||
fi
|
||||
vnc_png=no
|
||||
fi
|
||||
@@ -2044,7 +2051,7 @@ EOF
|
||||
libs_tools="$uuid_libs $libs_tools"
|
||||
else
|
||||
if test "$uuid" = "yes" ; then
|
||||
feature_not_found "uuid"
|
||||
feature_not_found "uuid" "Install libuuid devel"
|
||||
fi
|
||||
uuid=no
|
||||
fi
|
||||
@@ -2078,7 +2085,7 @@ EOF
|
||||
xfs="yes"
|
||||
else
|
||||
if test "$xfs" = "yes" ; then
|
||||
feature_not_found "xfs"
|
||||
feature_not_found "xfs" "Instal xfsprogs/xfslibs devel"
|
||||
fi
|
||||
xfs=no
|
||||
fi
|
||||
@@ -2104,7 +2111,7 @@ EOF
|
||||
libs_tools="$vde_libs $libs_tools"
|
||||
else
|
||||
if test "$vde" = "yes" ; then
|
||||
feature_not_found "vde"
|
||||
feature_not_found "vde" "Install vde (Virtual Distributed Ethernet) devel"
|
||||
fi
|
||||
vde=no
|
||||
fi
|
||||
@@ -2147,7 +2154,7 @@ EOF
|
||||
libs_tools="$cap_libs $libs_tools"
|
||||
else
|
||||
if test "$cap_ng" = "yes" ; then
|
||||
feature_not_found "cap_ng"
|
||||
feature_not_found "cap_ng" "Install libcap-ng devel"
|
||||
fi
|
||||
cap_ng=no
|
||||
fi
|
||||
@@ -2252,7 +2259,7 @@ EOF
|
||||
libs_softmmu="$brlapi_libs $libs_softmmu"
|
||||
else
|
||||
if test "$brlapi" = "yes" ; then
|
||||
feature_not_found "brlapi"
|
||||
feature_not_found "brlapi" "Install brlapi devel"
|
||||
fi
|
||||
brlapi=no
|
||||
fi
|
||||
@@ -2289,7 +2296,7 @@ EOF
|
||||
curses=yes
|
||||
else
|
||||
if test "$curses" = "yes" ; then
|
||||
feature_not_found "curses"
|
||||
feature_not_found "curses" "Install ncurses devel"
|
||||
fi
|
||||
curses=no
|
||||
fi
|
||||
@@ -2315,7 +2322,7 @@ EOF
|
||||
libs_softmmu="$curl_libs $libs_softmmu"
|
||||
else
|
||||
if test "$curl" = "yes" ; then
|
||||
feature_not_found "curl"
|
||||
feature_not_found "curl" "Install libcurl devel"
|
||||
fi
|
||||
curl=no
|
||||
fi
|
||||
@@ -2335,7 +2342,7 @@ EOF
|
||||
libs_softmmu="$bluez_libs $libs_softmmu"
|
||||
else
|
||||
if test "$bluez" = "yes" ; then
|
||||
feature_not_found "bluez"
|
||||
feature_not_found "bluez" "Install bluez-libs/libbluetooth devel"
|
||||
fi
|
||||
bluez="no"
|
||||
fi
|
||||
@@ -2471,7 +2478,7 @@ EOF
|
||||
libs_softmmu="$rbd_libs $libs_softmmu"
|
||||
else
|
||||
if test "$rbd" = "yes" ; then
|
||||
feature_not_found "rados block device"
|
||||
feature_not_found "rados block device" "Install librbd/ceph devel"
|
||||
fi
|
||||
rbd=no
|
||||
fi
|
||||
@@ -2537,7 +2544,7 @@ EOF
|
||||
libs_tools="$libs_tools -laio"
|
||||
else
|
||||
if test "$linux_aio" = "yes" ; then
|
||||
feature_not_found "linux AIO"
|
||||
feature_not_found "linux AIO" "Install libaio devel"
|
||||
fi
|
||||
linux_aio=no
|
||||
fi
|
||||
@@ -2585,7 +2592,7 @@ EOF
|
||||
libattr=yes
|
||||
else
|
||||
if test "$attr" = "yes" ; then
|
||||
feature_not_found "ATTR"
|
||||
feature_not_found "ATTR" "Install libc6 or libattr devel"
|
||||
fi
|
||||
attr=no
|
||||
fi
|
||||
@@ -2662,8 +2669,8 @@ EOF
|
||||
fdt_libs="-L\$(BUILD_DIR)/dtc/libfdt $fdt_libs"
|
||||
elif test "$fdt" = "yes" ; then
|
||||
# have neither and want - prompt for system/submodule install
|
||||
error_exit "DTC not present. Your options:" \
|
||||
" (1) Preferred: Install the DTC devel package" \
|
||||
error_exit "DTC (libfdt) not present. Your options:" \
|
||||
" (1) Preferred: Install the DTC (libfdt) devel package" \
|
||||
" (2) Fetch the DTC submodule, using:" \
|
||||
" git submodule update --init dtc"
|
||||
else
|
||||
@@ -2689,7 +2696,7 @@ EOF
|
||||
glx=yes
|
||||
else
|
||||
if test "$glx" = "yes" ; then
|
||||
feature_not_found "glx"
|
||||
feature_not_found "glx" "Install GL devel (e.g. MESA)"
|
||||
fi
|
||||
glx_libs=
|
||||
glx=no
|
||||
@@ -2714,7 +2721,7 @@ if test "$glusterfs" != "no" ; then
|
||||
fi
|
||||
else
|
||||
if test "$glusterfs" = "yes" ; then
|
||||
feature_not_found "GlusterFS backend support"
|
||||
feature_not_found "GlusterFS backend support" "Install glusterfs-api devel"
|
||||
fi
|
||||
glusterfs="no"
|
||||
fi
|
||||
@@ -3034,7 +3041,7 @@ if test "$docs" != "no" ; then
|
||||
docs=yes
|
||||
else
|
||||
if test "$docs" = "yes" ; then
|
||||
feature_not_found "docs"
|
||||
feature_not_found "docs" "Install texinfo and Perl/perl-podlators"
|
||||
fi
|
||||
docs=no
|
||||
fi
|
||||
@@ -3083,7 +3090,7 @@ EOF
|
||||
LIBS="$LIBS -liscsi"
|
||||
else
|
||||
if test "$libiscsi" = "yes" ; then
|
||||
feature_not_found "libiscsi"
|
||||
feature_not_found "libiscsi" "Install libiscsi devel"
|
||||
fi
|
||||
libiscsi="no"
|
||||
fi
|
||||
@@ -3167,7 +3174,7 @@ EOF
|
||||
spice_server_version=$($pkg_config --modversion spice-server)
|
||||
else
|
||||
if test "$spice" = "yes" ; then
|
||||
feature_not_found "spice"
|
||||
feature_not_found "spice" "Install spice-server and spice-protocol devel"
|
||||
fi
|
||||
spice="no"
|
||||
fi
|
||||
@@ -3217,7 +3224,7 @@ if test "$libusb" != "no" ; then
|
||||
libs_softmmu="$libs_softmmu $libusb_libs"
|
||||
else
|
||||
if test "$libusb" = "yes"; then
|
||||
feature_not_found "libusb"
|
||||
feature_not_found "libusb" "Install libusb devel"
|
||||
fi
|
||||
libusb="no"
|
||||
fi
|
||||
@@ -3233,7 +3240,7 @@ if test "$usb_redir" != "no" ; then
|
||||
libs_softmmu="$libs_softmmu $usb_redir_libs"
|
||||
else
|
||||
if test "$usb_redir" = "yes"; then
|
||||
feature_not_found "usb-redir"
|
||||
feature_not_found "usb-redir" "Install usbredir devel"
|
||||
fi
|
||||
usb_redir="no"
|
||||
fi
|
||||
@@ -3372,15 +3379,25 @@ fi
|
||||
# For 'ust' backend, test if ust headers are present
|
||||
if test "$trace_backend" = "ust"; then
|
||||
cat > $TMPC << EOF
|
||||
#include <ust/tracepoint.h>
|
||||
#include <ust/marker.h>
|
||||
#include <lttng/tracepoint.h>
|
||||
int main(void) { return 0; }
|
||||
EOF
|
||||
if compile_prog "" "" ; then
|
||||
LIBS="-lust -lurcu-bp $LIBS"
|
||||
libs_qga="-lust -lurcu-bp $libs_qga"
|
||||
if $pkg_config lttng-ust --exists; then
|
||||
lttng_ust_libs=`$pkg_config --libs lttng-ust`
|
||||
else
|
||||
lttng_ust_libs="-llttng-ust"
|
||||
fi
|
||||
if $pkg_config liburcu-bp --exists; then
|
||||
urcu_bp_libs=`$pkg_config --libs liburcu-bp`
|
||||
else
|
||||
urcu_bp_libs="-lurcu-bp"
|
||||
fi
|
||||
|
||||
LIBS="$lttng_ust_libs $urcu_bp_libs $LIBS"
|
||||
libs_qga="$lttng_ust_libs $urcu_bp_libs $libs_qga"
|
||||
else
|
||||
error_exit "Trace backend 'ust' missing libust header files"
|
||||
error_exit "Trace backend 'ust' missing lttng-ust header files"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -3557,7 +3574,18 @@ cpuid_h=no
|
||||
cat > $TMPC << EOF
|
||||
#include <cpuid.h>
|
||||
int main(void) {
|
||||
return 0;
|
||||
unsigned a, b, c, d;
|
||||
int max = __get_cpuid_max(0, 0);
|
||||
|
||||
if (max >= 1) {
|
||||
__cpuid(1, a, b, c, d);
|
||||
}
|
||||
|
||||
if (max >= 7) {
|
||||
__cpuid_count(7, 0, a, b, c, d);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
if compile_prog "" "" ; then
|
||||
@@ -4320,7 +4348,7 @@ if test "$trace_backend" = "ftrace"; then
|
||||
echo "CONFIG_TRACE_FTRACE=y" >> $config_host_mak
|
||||
trace_default=no
|
||||
else
|
||||
feature_not_found "ftrace(trace backend)"
|
||||
feature_not_found "ftrace(trace backend)" "ftrace requires Linux"
|
||||
fi
|
||||
fi
|
||||
echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
|
||||
@@ -4376,6 +4404,7 @@ echo "LD=$ld" >> $config_host_mak
|
||||
echo "WINDRES=$windres" >> $config_host_mak
|
||||
echo "LIBTOOL=$libtool" >> $config_host_mak
|
||||
echo "CFLAGS=$CFLAGS" >> $config_host_mak
|
||||
echo "CFLAGS_NOPIE=$CFLAGS_NOPIE" >> $config_host_mak
|
||||
echo "QEMU_CFLAGS=$QEMU_CFLAGS" >> $config_host_mak
|
||||
echo "QEMU_INCLUDES=$QEMU_INCLUDES" >> $config_host_mak
|
||||
if test "$sparse" = "yes" ; then
|
||||
@@ -4389,6 +4418,7 @@ else
|
||||
echo "AUTOCONF_HOST := " >> $config_host_mak
|
||||
fi
|
||||
echo "LDFLAGS=$LDFLAGS" >> $config_host_mak
|
||||
echo "LDFLAGS_NOPIE=$LDFLAGS_NOPIE" >> $config_host_mak
|
||||
echo "LIBTOOLFLAGS=$LIBTOOLFLAGS" >> $config_host_mak
|
||||
echo "LIBS+=$LIBS" >> $config_host_mak
|
||||
echo "LIBS_TOOLS+=$libs_tools" >> $config_host_mak
|
||||
|
||||
@@ -42,6 +42,7 @@ CONFIG_XILINX=y
|
||||
CONFIG_XILINX_ETHLITE=y
|
||||
CONFIG_OPENPIC=y
|
||||
CONFIG_PREP=y
|
||||
CONFIG_MAC=y
|
||||
CONFIG_E500=y
|
||||
CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
|
||||
# For PReP
|
||||
|
||||
@@ -43,6 +43,7 @@ CONFIG_XILINX_ETHLITE=y
|
||||
CONFIG_OPENPIC=y
|
||||
CONFIG_PSERIES=y
|
||||
CONFIG_PREP=y
|
||||
CONFIG_MAC=y
|
||||
CONFIG_E500=y
|
||||
CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
|
||||
# For pSeries
|
||||
|
||||
@@ -3,30 +3,12 @@
|
||||
include pci.mak
|
||||
include sound.mak
|
||||
include usb.mak
|
||||
CONFIG_ISA_MMIO=y
|
||||
CONFIG_ESCC=y
|
||||
CONFIG_M48T59=y
|
||||
CONFIG_VGA=y
|
||||
CONFIG_VGA_PCI=y
|
||||
CONFIG_SERIAL=y
|
||||
CONFIG_I8254=y
|
||||
CONFIG_FDC=y
|
||||
CONFIG_I8257=y
|
||||
CONFIG_OPENPIC=y
|
||||
CONFIG_MACIO=y
|
||||
CONFIG_CUDA=y
|
||||
CONFIG_ADB=y
|
||||
CONFIG_MAC_NVRAM=y
|
||||
CONFIG_MAC_DBDMA=y
|
||||
CONFIG_HEATHROW_PIC=y
|
||||
CONFIG_GRACKLE_PCI=y
|
||||
CONFIG_UNIN_PCI=y
|
||||
CONFIG_DEC_PCI=y
|
||||
CONFIG_PPCE500_PCI=y
|
||||
CONFIG_IDE_ISA=y
|
||||
CONFIG_IDE_CMD646=y
|
||||
CONFIG_IDE_MACIO=y
|
||||
CONFIG_NE2000_ISA=y
|
||||
CONFIG_PFLASH_CFI01=y
|
||||
CONFIG_PFLASH_CFI02=y
|
||||
CONFIG_PTIMER=y
|
||||
@@ -34,5 +16,3 @@ CONFIG_I8259=y
|
||||
CONFIG_XILINX=y
|
||||
CONFIG_XILINX_ETHLITE=y
|
||||
CONFIG_OPENPIC=y
|
||||
CONFIG_E500=y
|
||||
CONFIG_OPENPIC_KVM=$(and $(CONFIG_E500),$(CONFIG_KVM))
|
||||
|
||||
146
disas/i386.c
146
disas/i386.c
@@ -171,6 +171,7 @@ static void print_operand_value (char *buf, size_t bufsize, int hex, bfd_vma dis
|
||||
static void print_displacement (char *, bfd_vma);
|
||||
static void OP_E (int, int);
|
||||
static void OP_G (int, int);
|
||||
static void OP_vvvv (int, int);
|
||||
static bfd_vma get64 (void);
|
||||
static bfd_signed_vma get32 (void);
|
||||
static bfd_signed_vma get32s (void);
|
||||
@@ -264,6 +265,9 @@ static int rex_used;
|
||||
current instruction. */
|
||||
static int used_prefixes;
|
||||
|
||||
/* The VEX.vvvv register, unencoded. */
|
||||
static int vex_reg;
|
||||
|
||||
/* Flags stored in PREFIXES. */
|
||||
#define PREFIX_REPZ 1
|
||||
#define PREFIX_REPNZ 2
|
||||
@@ -278,6 +282,10 @@ static int used_prefixes;
|
||||
#define PREFIX_ADDR 0x400
|
||||
#define PREFIX_FWAIT 0x800
|
||||
|
||||
#define PREFIX_VEX_0F 0x1000
|
||||
#define PREFIX_VEX_0F38 0x2000
|
||||
#define PREFIX_VEX_0F3A 0x4000
|
||||
|
||||
/* Make sure that bytes from INFO->PRIVATE_DATA->BUFFER (inclusive)
|
||||
to ADDR (exclusive) are valid. Returns 1 for success, longjmps
|
||||
on error. */
|
||||
@@ -323,6 +331,7 @@ fetch_data(struct disassemble_info *info, bfd_byte *addr)
|
||||
|
||||
#define XX { NULL, 0 }
|
||||
|
||||
#define Bv { OP_vvvv, v_mode }
|
||||
#define Eb { OP_E, b_mode }
|
||||
#define Ev { OP_E, v_mode }
|
||||
#define Ed { OP_E, d_mode }
|
||||
@@ -671,7 +680,8 @@ fetch_data(struct disassemble_info *info, bfd_byte *addr)
|
||||
#define PREGRP102 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 102 } }
|
||||
#define PREGRP103 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 103 } }
|
||||
#define PREGRP104 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 104 } }
|
||||
|
||||
#define PREGRP105 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 105 } }
|
||||
#define PREGRP106 NULL, { { NULL, USE_PREFIX_USER_TABLE }, { NULL, 106 } }
|
||||
|
||||
#define X86_64_0 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 0 } }
|
||||
#define X86_64_1 NULL, { { NULL, X86_64_SPECIAL }, { NULL, 1 } }
|
||||
@@ -1449,7 +1459,7 @@ static const unsigned char threebyte_0x38_uses_DATA_prefix[256] = {
|
||||
/* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
|
||||
/* d0 */ 0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1, /* df */
|
||||
/* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
|
||||
/* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
|
||||
/* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, /* ff */
|
||||
/* ------------------------------- */
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
};
|
||||
@@ -1473,7 +1483,7 @@ static const unsigned char threebyte_0x38_uses_REPNZ_prefix[256] = {
|
||||
/* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
|
||||
/* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
|
||||
/* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
|
||||
/* f0 */ 1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
|
||||
/* f0 */ 1,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0, /* ff */
|
||||
/* ------------------------------- */
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
};
|
||||
@@ -1497,7 +1507,7 @@ static const unsigned char threebyte_0x38_uses_REPZ_prefix[256] = {
|
||||
/* c0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* cf */
|
||||
/* d0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* df */
|
||||
/* e0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ef */
|
||||
/* f0 */ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ff */
|
||||
/* f0 */ 0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0, /* ff */
|
||||
/* ------------------------------- */
|
||||
/* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
|
||||
};
|
||||
@@ -2774,6 +2784,22 @@ static const struct dis386 prefix_user_table[][4] = {
|
||||
{ "(bad)", { XX } },
|
||||
},
|
||||
|
||||
/* PREGRP105 */
|
||||
{
|
||||
{ "andnS", { Gv, Bv, Ev } },
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
},
|
||||
|
||||
/* PREGRP106 */
|
||||
{
|
||||
{ "bextrS", { Gv, Ev, Bv } },
|
||||
{ "sarxS", { Gv, Ev, Bv } },
|
||||
{ "shlxS", { Gv, Ev, Bv } },
|
||||
{ "shrxS", { Gv, Ev, Bv } },
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
static const struct dis386 x86_64_table[][2] = {
|
||||
@@ -3071,12 +3097,12 @@ static const struct dis386 three_byte_table[][256] = {
|
||||
/* f0 */
|
||||
{ PREGRP87 },
|
||||
{ PREGRP88 },
|
||||
{ PREGRP105 },
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
{ PREGRP106 },
|
||||
/* f8 */
|
||||
{ "(bad)", { XX } },
|
||||
{ "(bad)", { XX } },
|
||||
@@ -3477,6 +3503,74 @@ ckprefix (void)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ckvexprefix (void)
|
||||
{
|
||||
int op, vex2, vex3, newrex = 0, newpfx = prefixes;
|
||||
|
||||
if (address_mode == mode_16bit) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch_data(the_info, codep + 1);
|
||||
op = *codep;
|
||||
|
||||
if (op != 0xc4 && op != 0xc5) {
|
||||
return;
|
||||
}
|
||||
|
||||
fetch_data(the_info, codep + 2);
|
||||
vex2 = codep[1];
|
||||
|
||||
if (address_mode == mode_32bit && (vex2 & 0xc0) != 0xc0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (op == 0xc4) {
|
||||
/* Three byte VEX prefix. */
|
||||
fetch_data(the_info, codep + 3);
|
||||
vex3 = codep[2];
|
||||
|
||||
newrex |= (vex2 & 0x80 ? 0 : REX_R);
|
||||
newrex |= (vex2 & 0x40 ? 0 : REX_X);
|
||||
newrex |= (vex2 & 0x20 ? 0 : REX_B);
|
||||
newrex |= (vex3 & 0x80 ? REX_W : 0);
|
||||
switch (vex2 & 0x1f) { /* VEX.m-mmmm */
|
||||
case 1:
|
||||
newpfx |= PREFIX_VEX_0F;
|
||||
break;
|
||||
case 2:
|
||||
newpfx |= PREFIX_VEX_0F | PREFIX_VEX_0F38;
|
||||
break;
|
||||
case 3:
|
||||
newpfx |= PREFIX_VEX_0F | PREFIX_VEX_0F3A;
|
||||
break;
|
||||
}
|
||||
vex2 = vex3;
|
||||
codep += 3;
|
||||
} else {
|
||||
/* Two byte VEX prefix. */
|
||||
newrex |= (vex2 & 0x80 ? 0 : REX_R);
|
||||
codep += 2;
|
||||
}
|
||||
|
||||
vex_reg = (~vex2 >> 3) & 15; /* VEX.vvvv */
|
||||
switch (vex2 & 3) { /* VEX.pp */
|
||||
case 1:
|
||||
newpfx |= PREFIX_DATA; /* 0x66 */
|
||||
break;
|
||||
case 2:
|
||||
newpfx |= PREFIX_REPZ; /* 0xf3 */
|
||||
break;
|
||||
case 3:
|
||||
newpfx |= PREFIX_REPNZ; /* 0xf2 */
|
||||
break;
|
||||
}
|
||||
|
||||
rex = newrex;
|
||||
prefixes = newpfx;
|
||||
}
|
||||
|
||||
/* Return the name of the prefix byte PREF, or NULL if PREF is not a
|
||||
prefix byte. */
|
||||
|
||||
@@ -3598,6 +3692,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
|
||||
const char *p;
|
||||
struct dis_private priv;
|
||||
unsigned char op;
|
||||
unsigned char threebyte;
|
||||
|
||||
if (info->mach == bfd_mach_x86_64_intel_syntax
|
||||
|| info->mach == bfd_mach_x86_64)
|
||||
@@ -3752,6 +3847,7 @@ print_insn (bfd_vma pc, disassemble_info *info)
|
||||
|
||||
obufp = obuf;
|
||||
ckprefix ();
|
||||
ckvexprefix ();
|
||||
|
||||
insn_codep = codep;
|
||||
sizeflag = priv.orig_sizeflag;
|
||||
@@ -3775,18 +3871,29 @@ print_insn (bfd_vma pc, disassemble_info *info)
|
||||
}
|
||||
|
||||
op = 0;
|
||||
if (prefixes & PREFIX_VEX_0F)
|
||||
{
|
||||
used_prefixes |= PREFIX_VEX_0F | PREFIX_VEX_0F38 | PREFIX_VEX_0F3A;
|
||||
if (prefixes & PREFIX_VEX_0F38)
|
||||
threebyte = 0x38;
|
||||
else if (prefixes & PREFIX_VEX_0F3A)
|
||||
threebyte = 0x3a;
|
||||
else
|
||||
threebyte = *codep++;
|
||||
goto vex_opcode;
|
||||
}
|
||||
if (*codep == 0x0f)
|
||||
{
|
||||
unsigned char threebyte;
|
||||
fetch_data(info, codep + 2);
|
||||
threebyte = *++codep;
|
||||
threebyte = codep[1];
|
||||
codep += 2;
|
||||
vex_opcode:
|
||||
dp = &dis386_twobyte[threebyte];
|
||||
need_modrm = twobyte_has_modrm[*codep];
|
||||
uses_DATA_prefix = twobyte_uses_DATA_prefix[*codep];
|
||||
uses_REPNZ_prefix = twobyte_uses_REPNZ_prefix[*codep];
|
||||
uses_REPZ_prefix = twobyte_uses_REPZ_prefix[*codep];
|
||||
uses_LOCK_prefix = (*codep & ~0x02) == 0x20;
|
||||
codep++;
|
||||
need_modrm = twobyte_has_modrm[threebyte];
|
||||
uses_DATA_prefix = twobyte_uses_DATA_prefix[threebyte];
|
||||
uses_REPNZ_prefix = twobyte_uses_REPNZ_prefix[threebyte];
|
||||
uses_REPZ_prefix = twobyte_uses_REPZ_prefix[threebyte];
|
||||
uses_LOCK_prefix = (threebyte & ~0x02) == 0x20;
|
||||
if (dp->name == NULL && dp->op[0].bytemode == IS_3BYTE_OPCODE)
|
||||
{
|
||||
fetch_data(info, codep + 2);
|
||||
@@ -5291,6 +5398,17 @@ OP_G (int bytemode, int sizeflag)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
OP_vvvv (int bytemode, int sizeflags)
|
||||
{
|
||||
USED_REX (REX_W);
|
||||
if (rex & REX_W) {
|
||||
oappend(names64[vex_reg]);
|
||||
} else {
|
||||
oappend(names32[vex_reg]);
|
||||
}
|
||||
}
|
||||
|
||||
static bfd_vma
|
||||
get64 (void)
|
||||
{
|
||||
|
||||
@@ -269,19 +269,19 @@ bool Disassembler::IsMovzMovnImm(unsigned reg_size, uint64_t value) {
|
||||
((reg_size == kWRegSize) && (value <= 0xffffffff)));
|
||||
|
||||
// Test for movz: 16 bits set at positions 0, 16, 32 or 48.
|
||||
if (((value & 0xffffffffffff0000UL) == 0UL) ||
|
||||
((value & 0xffffffff0000ffffUL) == 0UL) ||
|
||||
((value & 0xffff0000ffffffffUL) == 0UL) ||
|
||||
((value & 0x0000ffffffffffffUL) == 0UL)) {
|
||||
if (((value & 0xffffffffffff0000ULL) == 0ULL) ||
|
||||
((value & 0xffffffff0000ffffULL) == 0ULL) ||
|
||||
((value & 0xffff0000ffffffffULL) == 0ULL) ||
|
||||
((value & 0x0000ffffffffffffULL) == 0ULL)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Test for movn: NOT(16 bits set at positions 0, 16, 32 or 48).
|
||||
if ((reg_size == kXRegSize) &&
|
||||
(((value & 0xffffffffffff0000UL) == 0xffffffffffff0000UL) ||
|
||||
((value & 0xffffffff0000ffffUL) == 0xffffffff0000ffffUL) ||
|
||||
((value & 0xffff0000ffffffffUL) == 0xffff0000ffffffffUL) ||
|
||||
((value & 0x0000ffffffffffffUL) == 0x0000ffffffffffffUL))) {
|
||||
(((value & 0xffffffffffff0000ULL) == 0xffffffffffff0000ULL) ||
|
||||
((value & 0xffffffff0000ffffULL) == 0xffffffff0000ffffULL) ||
|
||||
((value & 0xffff0000ffffffffULL) == 0xffff0000ffffffffULL) ||
|
||||
((value & 0x0000ffffffffffffULL) == 0x0000ffffffffffffULL))) {
|
||||
return true;
|
||||
}
|
||||
if ((reg_size == kWRegSize) &&
|
||||
|
||||
@@ -95,7 +95,7 @@ int CountSetBits(uint64_t value, int width) {
|
||||
ASSERT((width == 32) || (width == 64));
|
||||
|
||||
// Mask out unused bits to ensure that they are not counted.
|
||||
value &= (0xffffffffffffffffUL >> (64-width));
|
||||
value &= (0xffffffffffffffffULL >> (64-width));
|
||||
|
||||
// Add up the set bits.
|
||||
// The algorithm works by adding pairs of bit fields together iteratively,
|
||||
@@ -108,12 +108,18 @@ int CountSetBits(uint64_t value, int width) {
|
||||
// value = h+g+f+e d+c+b+a
|
||||
// \ |
|
||||
// value = h+g+f+e+d+c+b+a
|
||||
value = ((value >> 1) & 0x5555555555555555) + (value & 0x5555555555555555);
|
||||
value = ((value >> 2) & 0x3333333333333333) + (value & 0x3333333333333333);
|
||||
value = ((value >> 4) & 0x0f0f0f0f0f0f0f0f) + (value & 0x0f0f0f0f0f0f0f0f);
|
||||
value = ((value >> 8) & 0x00ff00ff00ff00ff) + (value & 0x00ff00ff00ff00ff);
|
||||
value = ((value >> 16) & 0x0000ffff0000ffff) + (value & 0x0000ffff0000ffff);
|
||||
value = ((value >> 32) & 0x00000000ffffffff) + (value & 0x00000000ffffffff);
|
||||
value = ((value >> 1) & 0x5555555555555555ULL) +
|
||||
(value & 0x5555555555555555ULL);
|
||||
value = ((value >> 2) & 0x3333333333333333ULL) +
|
||||
(value & 0x3333333333333333ULL);
|
||||
value = ((value >> 4) & 0x0f0f0f0f0f0f0f0fULL) +
|
||||
(value & 0x0f0f0f0f0f0f0f0fULL);
|
||||
value = ((value >> 8) & 0x00ff00ff00ff00ffULL) +
|
||||
(value & 0x00ff00ff00ff00ffULL);
|
||||
value = ((value >> 16) & 0x0000ffff0000ffffULL) +
|
||||
(value & 0x0000ffff0000ffffULL);
|
||||
value = ((value >> 32) & 0x00000000ffffffffULL) +
|
||||
(value & 0x00000000ffffffffULL);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
@@ -214,6 +214,42 @@ The "ust" backend uses the LTTng Userspace Tracer library. There are no
|
||||
monitor commands built into QEMU, instead UST utilities should be used to list,
|
||||
enable/disable, and dump traces.
|
||||
|
||||
Package lttng-tools is required for userspace tracing. You must ensure that the
|
||||
current user belongs to the "tracing" group, or manually launch the
|
||||
lttng-sessiond daemon for the current user prior to running any instance of
|
||||
QEMU.
|
||||
|
||||
While running an instrumented QEMU, LTTng should be able to list all available
|
||||
events:
|
||||
|
||||
lttng list -u
|
||||
|
||||
Create tracing session:
|
||||
|
||||
lttng create mysession
|
||||
|
||||
Enable events:
|
||||
|
||||
lttng enable-event qemu:g_malloc -u
|
||||
|
||||
Where the events can either be a comma-separated list of events, or "-a" to
|
||||
enable all tracepoint events. Start and stop tracing as needed:
|
||||
|
||||
lttng start
|
||||
lttng stop
|
||||
|
||||
View the trace:
|
||||
|
||||
lttng view
|
||||
|
||||
Destroy tracing session:
|
||||
|
||||
lttng destroy
|
||||
|
||||
Babeltrace can be used at any later time to view the trace:
|
||||
|
||||
babeltrace $HOME/lttng-traces/mysession-<date>-<time>
|
||||
|
||||
=== SystemTap ===
|
||||
|
||||
The "dtrace" backend uses DTrace sdt probes but has only been tested with
|
||||
|
||||
@@ -2372,6 +2372,17 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
|
||||
}
|
||||
}
|
||||
/* Zero plus something non-zero : just return the something */
|
||||
if (flags & float_muladd_halve_result) {
|
||||
if (cExp == 0) {
|
||||
normalizeFloat32Subnormal(cSig, &cExp, &cSig);
|
||||
}
|
||||
/* Subtract one to halve, and one again because roundAndPackFloat32
|
||||
* wants one less than the true exponent.
|
||||
*/
|
||||
cExp -= 2;
|
||||
cSig = (cSig | 0x00800000) << 7;
|
||||
return roundAndPackFloat32(cSign ^ signflip, cExp, cSig STATUS_VAR);
|
||||
}
|
||||
return packFloat32(cSign ^ signflip, cExp, cSig);
|
||||
}
|
||||
|
||||
@@ -2408,6 +2419,9 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
|
||||
/* Throw out the special case of c being an exact zero now */
|
||||
shift64RightJamming(pSig64, 32, &pSig64);
|
||||
pSig = pSig64;
|
||||
if (flags & float_muladd_halve_result) {
|
||||
pExp--;
|
||||
}
|
||||
return roundAndPackFloat32(zSign, pExp - 1,
|
||||
pSig STATUS_VAR);
|
||||
}
|
||||
@@ -2472,6 +2486,10 @@ float32 float32_muladd(float32 a, float32 b, float32 c, int flags STATUS_PARAM)
|
||||
zSig64 <<= shiftcount;
|
||||
zExp -= shiftcount;
|
||||
}
|
||||
if (flags & float_muladd_halve_result) {
|
||||
zExp--;
|
||||
}
|
||||
|
||||
shift64RightJamming(zSig64, 32, &zSig64);
|
||||
return roundAndPackFloat32(zSign, zExp, zSig64 STATUS_VAR);
|
||||
}
|
||||
@@ -4088,6 +4106,17 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
|
||||
}
|
||||
}
|
||||
/* Zero plus something non-zero : just return the something */
|
||||
if (flags & float_muladd_halve_result) {
|
||||
if (cExp == 0) {
|
||||
normalizeFloat64Subnormal(cSig, &cExp, &cSig);
|
||||
}
|
||||
/* Subtract one to halve, and one again because roundAndPackFloat64
|
||||
* wants one less than the true exponent.
|
||||
*/
|
||||
cExp -= 2;
|
||||
cSig = (cSig | 0x0010000000000000ULL) << 10;
|
||||
return roundAndPackFloat64(cSign ^ signflip, cExp, cSig STATUS_VAR);
|
||||
}
|
||||
return packFloat64(cSign ^ signflip, cExp, cSig);
|
||||
}
|
||||
|
||||
@@ -4123,6 +4152,9 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
|
||||
if (!cSig) {
|
||||
/* Throw out the special case of c being an exact zero now */
|
||||
shift128RightJamming(pSig0, pSig1, 64, &pSig0, &pSig1);
|
||||
if (flags & float_muladd_halve_result) {
|
||||
pExp--;
|
||||
}
|
||||
return roundAndPackFloat64(zSign, pExp - 1,
|
||||
pSig1 STATUS_VAR);
|
||||
}
|
||||
@@ -4159,6 +4191,9 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
|
||||
zExp--;
|
||||
}
|
||||
shift128RightJamming(zSig0, zSig1, 64, &zSig0, &zSig1);
|
||||
if (flags & float_muladd_halve_result) {
|
||||
zExp--;
|
||||
}
|
||||
return roundAndPackFloat64(zSign, zExp, zSig1 STATUS_VAR);
|
||||
} else {
|
||||
/* Subtraction */
|
||||
@@ -4209,6 +4244,9 @@ float64 float64_muladd(float64 a, float64 b, float64 c, int flags STATUS_PARAM)
|
||||
zExp -= (shiftcount + 64);
|
||||
}
|
||||
}
|
||||
if (flags & float_muladd_halve_result) {
|
||||
zExp--;
|
||||
}
|
||||
return roundAndPackFloat64(zSign, zExp, zSig0 STATUS_VAR);
|
||||
}
|
||||
}
|
||||
|
||||
11
hmp.c
11
hmp.c
@@ -881,7 +881,7 @@ void hmp_balloon(Monitor *mon, const QDict *qdict)
|
||||
Error *errp = NULL;
|
||||
|
||||
qmp_balloon(value, &errp);
|
||||
if (error_is_set(&errp)) {
|
||||
if (errp) {
|
||||
monitor_printf(mon, "balloon: %s\n", error_get_pretty(errp));
|
||||
error_free(errp);
|
||||
}
|
||||
@@ -1118,7 +1118,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
|
||||
}
|
||||
|
||||
qmp_change(device, target, !!arg, arg, &err);
|
||||
if (error_is_set(&err) &&
|
||||
if (err &&
|
||||
error_get_class(err) == ERROR_CLASS_DEVICE_ENCRYPTED) {
|
||||
error_free(err);
|
||||
monitor_read_block_device_key(mon, device, NULL, NULL);
|
||||
@@ -1234,7 +1234,8 @@ static void hmp_migrate_status_cb(void *opaque)
|
||||
MigrationInfo *info;
|
||||
|
||||
info = qmp_query_migrate(NULL);
|
||||
if (!info->has_status || strcmp(info->status, "active") == 0) {
|
||||
if (!info->has_status || strcmp(info->status, "active") == 0 ||
|
||||
strcmp(info->status, "setup") == 0) {
|
||||
if (info->has_disk) {
|
||||
int progress;
|
||||
|
||||
@@ -1335,12 +1336,12 @@ void hmp_netdev_add(Monitor *mon, const QDict *qdict)
|
||||
QemuOpts *opts;
|
||||
|
||||
opts = qemu_opts_from_qdict(qemu_find_opts("netdev"), qdict, &err);
|
||||
if (error_is_set(&err)) {
|
||||
if (err) {
|
||||
goto out;
|
||||
}
|
||||
|
||||
netdev_add(opts, &err);
|
||||
if (error_is_set(&err)) {
|
||||
if (err) {
|
||||
qemu_opts_del(opts);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ devices-dirs-$(CONFIG_SOFTMMU) += i2c/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += ide/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += input/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += intc/
|
||||
devices-dirs-$(CONFIG_IPACK) += ipack/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += isa/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += misc/
|
||||
devices-dirs-$(CONFIG_SOFTMMU) += net/
|
||||
|
||||
@@ -439,9 +439,9 @@ Object *piix4_pm_find(void)
|
||||
return o;
|
||||
}
|
||||
|
||||
i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
||||
qemu_irq sci_irq, qemu_irq smi_irq,
|
||||
int kvm_enabled, FWCfgState *fw_cfg)
|
||||
I2CBus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
||||
qemu_irq sci_irq, qemu_irq smi_irq,
|
||||
int kvm_enabled, FWCfgState *fw_cfg)
|
||||
{
|
||||
DeviceState *dev;
|
||||
PIIX4PMState *s;
|
||||
|
||||
@@ -326,7 +326,7 @@ Exynos4210State *exynos4210_init(MemoryRegion *system_mem,
|
||||
busdev = SYS_BUS_DEVICE(dev);
|
||||
sysbus_connect_irq(busdev, 0, i2c_irq);
|
||||
sysbus_mmio_map(busdev, 0, addr);
|
||||
s->i2c_if[n] = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
|
||||
s->i2c_if[n] = (I2CBus *)qdev_get_child_bus(dev, "i2c");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1593,7 +1593,7 @@ static void musicpal_init(QEMUMachineInitArgs *args)
|
||||
DeviceState *key_dev;
|
||||
DeviceState *wm8750_dev;
|
||||
SysBusDevice *s;
|
||||
i2c_bus *i2c;
|
||||
I2CBus *i2c;
|
||||
int i;
|
||||
unsigned long flash_size;
|
||||
DriveInfo *dinfo;
|
||||
@@ -1687,7 +1687,7 @@ static void musicpal_init(QEMUMachineInitArgs *args)
|
||||
dev = sysbus_create_simple(TYPE_MUSICPAL_GPIO, MP_GPIO_BASE,
|
||||
pic[MP_GPIO_IRQ]);
|
||||
i2c_dev = sysbus_create_simple("gpio_i2c", -1, NULL);
|
||||
i2c = (i2c_bus *)qdev_get_child_bus(i2c_dev, "i2c");
|
||||
i2c = (I2CBus *)qdev_get_child_bus(i2c_dev, "i2c");
|
||||
|
||||
lcd_dev = sysbus_create_simple(TYPE_MUSICPAL_LCD, MP_LCD_BASE, NULL);
|
||||
key_dev = sysbus_create_simple(TYPE_MUSICPAL_KEY, -1, NULL);
|
||||
|
||||
@@ -202,7 +202,7 @@ static void n8x0_i2c_setup(struct n800_s *s)
|
||||
{
|
||||
DeviceState *dev;
|
||||
qemu_irq tmp_irq = qdev_get_gpio_in(s->mpu->gpio, N8X0_TMP105_GPIO);
|
||||
i2c_bus *i2c = omap_i2c_bus(s->mpu->i2c[0]);
|
||||
I2CBus *i2c = omap_i2c_bus(s->mpu->i2c[0]);
|
||||
|
||||
/* Attach a menelaus PM chip */
|
||||
dev = i2c_create_slave(i2c, "twl92230", N8X0_MENELAUS_ADDR);
|
||||
|
||||
@@ -224,27 +224,24 @@ static const VMStateDescription vmstate_pxa2xx_cm = {
|
||||
}
|
||||
};
|
||||
|
||||
static int pxa2xx_clkcfg_read(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t *value)
|
||||
static uint64_t pxa2xx_clkcfg_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
||||
{
|
||||
PXA2xxState *s = (PXA2xxState *)ri->opaque;
|
||||
*value = s->clkcfg;
|
||||
return 0;
|
||||
return s->clkcfg;
|
||||
}
|
||||
|
||||
static int pxa2xx_clkcfg_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
static void pxa2xx_clkcfg_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
PXA2xxState *s = (PXA2xxState *)ri->opaque;
|
||||
s->clkcfg = value & 0xf;
|
||||
if (value & 2) {
|
||||
printf("%s: CPU frequency change attempt\n", __func__);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
static void pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
PXA2xxState *s = (PXA2xxState *)ri->opaque;
|
||||
static const char *pwrmode[8] = {
|
||||
@@ -310,36 +307,29 @@ static int pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
printf("%s: machine entered %s mode\n", __func__,
|
||||
pwrmode[value & 7]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pxa2xx_cppmnc_read(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t *value)
|
||||
static uint64_t pxa2xx_cppmnc_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
||||
{
|
||||
PXA2xxState *s = (PXA2xxState *)ri->opaque;
|
||||
*value = s->pmnc;
|
||||
return 0;
|
||||
return s->pmnc;
|
||||
}
|
||||
|
||||
static int pxa2xx_cppmnc_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
static void pxa2xx_cppmnc_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
PXA2xxState *s = (PXA2xxState *)ri->opaque;
|
||||
s->pmnc = value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pxa2xx_cpccnt_read(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t *value)
|
||||
static uint64_t pxa2xx_cpccnt_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
||||
{
|
||||
PXA2xxState *s = (PXA2xxState *)ri->opaque;
|
||||
if (s->pmnc & 1) {
|
||||
*value = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
return qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL);
|
||||
} else {
|
||||
*value = 0;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const ARMCPRegInfo pxa_cp_reginfo[] = {
|
||||
@@ -1222,8 +1212,14 @@ static const TypeInfo pxa2xx_rtc_sysbus_info = {
|
||||
};
|
||||
|
||||
/* I2C Interface */
|
||||
typedef struct {
|
||||
I2CSlave i2c;
|
||||
|
||||
#define TYPE_PXA2XX_I2C_SLAVE "pxa2xx-i2c-slave"
|
||||
#define PXA2XX_I2C_SLAVE(obj) \
|
||||
OBJECT_CHECK(PXA2xxI2CSlaveState, (obj), TYPE_PXA2XX_I2C_SLAVE)
|
||||
|
||||
typedef struct PXA2xxI2CSlaveState {
|
||||
I2CSlave parent_obj;
|
||||
|
||||
PXA2xxI2CState *host;
|
||||
} PXA2xxI2CSlaveState;
|
||||
|
||||
@@ -1238,7 +1234,7 @@ struct PXA2xxI2CState {
|
||||
|
||||
MemoryRegion iomem;
|
||||
PXA2xxI2CSlaveState *slave;
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
qemu_irq irq;
|
||||
uint32_t offset;
|
||||
uint32_t region_size;
|
||||
@@ -1268,7 +1264,7 @@ static void pxa2xx_i2c_update(PXA2xxI2CState *s)
|
||||
/* These are only stubs now. */
|
||||
static void pxa2xx_i2c_event(I2CSlave *i2c, enum i2c_event event)
|
||||
{
|
||||
PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
|
||||
PXA2xxI2CSlaveState *slave = PXA2XX_I2C_SLAVE(i2c);
|
||||
PXA2xxI2CState *s = slave->host;
|
||||
|
||||
switch (event) {
|
||||
@@ -1292,10 +1288,12 @@ static void pxa2xx_i2c_event(I2CSlave *i2c, enum i2c_event event)
|
||||
|
||||
static int pxa2xx_i2c_rx(I2CSlave *i2c)
|
||||
{
|
||||
PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
|
||||
PXA2xxI2CSlaveState *slave = PXA2XX_I2C_SLAVE(i2c);
|
||||
PXA2xxI2CState *s = slave->host;
|
||||
if ((s->control & (1 << 14)) || !(s->control & (1 << 6)))
|
||||
|
||||
if ((s->control & (1 << 14)) || !(s->control & (1 << 6))) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (s->status & (1 << 0)) { /* RWM */
|
||||
s->status |= 1 << 6; /* set ITE */
|
||||
@@ -1307,10 +1305,12 @@ static int pxa2xx_i2c_rx(I2CSlave *i2c)
|
||||
|
||||
static int pxa2xx_i2c_tx(I2CSlave *i2c, uint8_t data)
|
||||
{
|
||||
PXA2xxI2CSlaveState *slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, i2c);
|
||||
PXA2xxI2CSlaveState *slave = PXA2XX_I2C_SLAVE(i2c);
|
||||
PXA2xxI2CState *s = slave->host;
|
||||
if ((s->control & (1 << 14)) || !(s->control & (1 << 6)))
|
||||
|
||||
if ((s->control & (1 << 14)) || !(s->control & (1 << 6))) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!(s->status & (1 << 0))) { /* RWM */
|
||||
s->status |= 1 << 7; /* set IRF */
|
||||
@@ -1325,6 +1325,7 @@ static uint64_t pxa2xx_i2c_read(void *opaque, hwaddr addr,
|
||||
unsigned size)
|
||||
{
|
||||
PXA2xxI2CState *s = (PXA2xxI2CState *) opaque;
|
||||
I2CSlave *slave;
|
||||
|
||||
addr -= s->offset;
|
||||
switch (addr) {
|
||||
@@ -1333,7 +1334,8 @@ static uint64_t pxa2xx_i2c_read(void *opaque, hwaddr addr,
|
||||
case ISR:
|
||||
return s->status | (i2c_bus_busy(s->bus) << 2);
|
||||
case ISAR:
|
||||
return s->slave->i2c.address;
|
||||
slave = I2C_SLAVE(s->slave);
|
||||
return slave->address;
|
||||
case IDBR:
|
||||
return s->data;
|
||||
case IBMR:
|
||||
@@ -1408,7 +1410,7 @@ static void pxa2xx_i2c_write(void *opaque, hwaddr addr,
|
||||
break;
|
||||
|
||||
case ISAR:
|
||||
i2c_set_slave_address(&s->slave->i2c, value & 0x7f);
|
||||
i2c_set_slave_address(I2C_SLAVE(s->slave), value & 0x7f);
|
||||
break;
|
||||
|
||||
case IDBR:
|
||||
@@ -1432,7 +1434,7 @@ static const VMStateDescription vmstate_pxa2xx_i2c_slave = {
|
||||
.minimum_version_id = 1,
|
||||
.minimum_version_id_old = 1,
|
||||
.fields = (VMStateField []) {
|
||||
VMSTATE_I2C_SLAVE(i2c, PXA2xxI2CSlaveState),
|
||||
VMSTATE_I2C_SLAVE(parent_obj, PXA2xxI2CSlaveState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -1470,7 +1472,7 @@ static void pxa2xx_i2c_slave_class_init(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static const TypeInfo pxa2xx_i2c_slave_info = {
|
||||
.name = "pxa2xx-i2c-slave",
|
||||
.name = TYPE_PXA2XX_I2C_SLAVE,
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(PXA2xxI2CSlaveState),
|
||||
.class_init = pxa2xx_i2c_slave_class_init,
|
||||
@@ -1482,7 +1484,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,
|
||||
DeviceState *dev;
|
||||
SysBusDevice *i2c_dev;
|
||||
PXA2xxI2CState *s;
|
||||
i2c_bus *i2cbus;
|
||||
I2CBus *i2cbus;
|
||||
|
||||
dev = qdev_create(NULL, TYPE_PXA2XX_I2C);
|
||||
qdev_prop_set_uint32(dev, "size", region_size + 1);
|
||||
@@ -1496,8 +1498,8 @@ PXA2xxI2CState *pxa2xx_i2c_init(hwaddr base,
|
||||
s = PXA2XX_I2C(i2c_dev);
|
||||
/* FIXME: Should the slave device really be on a separate bus? */
|
||||
i2cbus = i2c_init_bus(dev, "dummy");
|
||||
dev = i2c_create_slave(i2cbus, "pxa2xx-i2c-slave", 0);
|
||||
s->slave = FROM_I2C_SLAVE(PXA2xxI2CSlaveState, I2C_SLAVE(dev));
|
||||
dev = i2c_create_slave(i2cbus, TYPE_PXA2XX_I2C_SLAVE, 0);
|
||||
s->slave = PXA2XX_I2C_SLAVE(dev);
|
||||
s->slave->host = s;
|
||||
|
||||
return s;
|
||||
@@ -1518,7 +1520,7 @@ static int pxa2xx_i2c_initfn(SysBusDevice *sbd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
i2c_bus *pxa2xx_i2c_bus(PXA2xxI2CState *s)
|
||||
I2CBus *pxa2xx_i2c_bus(PXA2xxI2CState *s)
|
||||
{
|
||||
return s->bus;
|
||||
}
|
||||
|
||||
@@ -217,20 +217,17 @@ static const int pxa2xx_cp_reg_map[0x10] = {
|
||||
[0xa] = ICPR2,
|
||||
};
|
||||
|
||||
static int pxa2xx_pic_cp_read(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t *value)
|
||||
static uint64_t pxa2xx_pic_cp_read(CPUARMState *env, const ARMCPRegInfo *ri)
|
||||
{
|
||||
int offset = pxa2xx_cp_reg_map[ri->crn];
|
||||
*value = pxa2xx_pic_mem_read(ri->opaque, offset, 4);
|
||||
return 0;
|
||||
return pxa2xx_pic_mem_read(ri->opaque, offset, 4);
|
||||
}
|
||||
|
||||
static int pxa2xx_pic_cp_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
static void pxa2xx_pic_cp_write(CPUARMState *env, const ARMCPRegInfo *ri,
|
||||
uint64_t value)
|
||||
{
|
||||
int offset = pxa2xx_cp_reg_map[ri->crn];
|
||||
pxa2xx_pic_mem_write(ri->opaque, offset, value, 4);
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define REGINFO_FOR_PIC_CP(NAME, CRN) \
|
||||
|
||||
@@ -60,7 +60,7 @@ static void realview_init(QEMUMachineInitArgs *args,
|
||||
qemu_irq mmc_irq[2];
|
||||
PCIBus *pci_bus = NULL;
|
||||
NICInfo *nd;
|
||||
i2c_bus *i2c;
|
||||
I2CBus *i2c;
|
||||
int n;
|
||||
int done_nic = 0;
|
||||
qemu_irq cpu_irq[4];
|
||||
@@ -255,7 +255,7 @@ static void realview_init(QEMUMachineInitArgs *args,
|
||||
}
|
||||
|
||||
dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL);
|
||||
i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
|
||||
i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
|
||||
i2c_create_slave(i2c, "ds1338", 0x68);
|
||||
|
||||
/* Memory map for RealView Emulation Baseboard: */
|
||||
|
||||
@@ -734,7 +734,7 @@ static void spitz_wm8750_addr(void *opaque, int line, int level)
|
||||
static void spitz_i2c_setup(PXA2xxState *cpu)
|
||||
{
|
||||
/* Attach the CPU on one end of our I2C bus. */
|
||||
i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
|
||||
I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
|
||||
|
||||
DeviceState *wm;
|
||||
|
||||
|
||||
@@ -692,7 +692,7 @@ static int stellaris_sys_init(uint32_t base, qemu_irq irq,
|
||||
typedef struct {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
qemu_irq irq;
|
||||
MemoryRegion iomem;
|
||||
uint32_t msa;
|
||||
@@ -868,7 +868,7 @@ static int stellaris_i2c_init(SysBusDevice *sbd)
|
||||
{
|
||||
DeviceState *dev = DEVICE(sbd);
|
||||
stellaris_i2c_state *s = STELLARIS_I2C(dev);
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
|
||||
sysbus_init_irq(sbd, &s->irq);
|
||||
bus = i2c_init_bus(dev, "i2c");
|
||||
@@ -1213,7 +1213,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
|
||||
qemu_irq adc;
|
||||
int sram_size;
|
||||
int flash_size;
|
||||
i2c_bus *i2c;
|
||||
I2CBus *i2c;
|
||||
DeviceState *dev;
|
||||
int i;
|
||||
int j;
|
||||
@@ -1256,7 +1256,7 @@ static void stellaris_init(const char *kernel_filename, const char *cpu_model,
|
||||
|
||||
if (board->dc2 & (1 << 12)) {
|
||||
dev = sysbus_create_simple(TYPE_STELLARIS_I2C, 0x40020000, pic[8]);
|
||||
i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
|
||||
i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
|
||||
if (board->peripherals & BP_OLED_I2C) {
|
||||
i2c_create_slave(i2c, "ssd0303", 0x3d);
|
||||
}
|
||||
|
||||
@@ -132,15 +132,20 @@ static int tosa_ssp_init(SSISlave *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define TYPE_TOSA_DAC "tosa_dac"
|
||||
#define TOSA_DAC(obj) OBJECT_CHECK(TosaDACState, (obj), TYPE_TOSA_DAC)
|
||||
|
||||
typedef struct {
|
||||
I2CSlave i2c;
|
||||
I2CSlave parent_obj;
|
||||
|
||||
int len;
|
||||
char buf[3];
|
||||
} TosaDACState;
|
||||
|
||||
static int tosa_dac_send(I2CSlave *i2c, uint8_t data)
|
||||
{
|
||||
TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
|
||||
TosaDACState *s = TOSA_DAC(i2c);
|
||||
|
||||
s->buf[s->len] = data;
|
||||
if (s->len ++ > 2) {
|
||||
#ifdef VERBOSE
|
||||
@@ -159,7 +164,8 @@ static int tosa_dac_send(I2CSlave *i2c, uint8_t data)
|
||||
|
||||
static void tosa_dac_event(I2CSlave *i2c, enum i2c_event event)
|
||||
{
|
||||
TosaDACState *s = FROM_I2C_SLAVE(TosaDACState, i2c);
|
||||
TosaDACState *s = TOSA_DAC(i2c);
|
||||
|
||||
s->len = 0;
|
||||
switch (event) {
|
||||
case I2C_START_SEND:
|
||||
@@ -194,8 +200,8 @@ static int tosa_dac_init(I2CSlave *i2c)
|
||||
|
||||
static void tosa_tg_init(PXA2xxState *cpu)
|
||||
{
|
||||
i2c_bus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
|
||||
i2c_create_slave(bus, "tosa_dac", DAC_BASE);
|
||||
I2CBus *bus = pxa2xx_i2c_bus(cpu->i2c[0]);
|
||||
i2c_create_slave(bus, TYPE_TOSA_DAC, DAC_BASE);
|
||||
ssi_create_slave(cpu->ssp[1], "tosa-ssp");
|
||||
}
|
||||
|
||||
@@ -271,7 +277,7 @@ static void tosa_dac_class_init(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static const TypeInfo tosa_dac_info = {
|
||||
.name = "tosa_dac",
|
||||
.name = TYPE_TOSA_DAC,
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(TosaDACState),
|
||||
.class_init = tosa_dac_class_init,
|
||||
|
||||
@@ -185,7 +185,7 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
|
||||
DeviceState *pl041;
|
||||
PCIBus *pci_bus;
|
||||
NICInfo *nd;
|
||||
i2c_bus *i2c;
|
||||
I2CBus *i2c;
|
||||
int n;
|
||||
int done_smc = 0;
|
||||
DriveInfo *dinfo;
|
||||
@@ -288,7 +288,7 @@ static void versatile_init(QEMUMachineInitArgs *args, int board_id)
|
||||
sysbus_create_simple("pl031", 0x101e8000, pic[10]);
|
||||
|
||||
dev = sysbus_create_simple("versatile_i2c", 0x10002000, NULL);
|
||||
i2c = (i2c_bus *)qdev_get_child_bus(dev, "i2c");
|
||||
i2c = (I2CBus *)qdev_get_child_bus(dev, "i2c");
|
||||
i2c_create_slave(i2c, "ds1338", 0x68);
|
||||
|
||||
/* Add PL041 AACI Interface to the LM4549 codec */
|
||||
|
||||
22
hw/arm/z2.c
22
hw/arm/z2.c
@@ -193,15 +193,20 @@ static const TypeInfo zipit_lcd_info = {
|
||||
.class_init = zipit_lcd_class_init,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
I2CSlave i2c;
|
||||
#define TYPE_AER915 "aer915"
|
||||
#define AER915(obj) OBJECT_CHECK(AER915State, (obj), TYPE_AER915)
|
||||
|
||||
typedef struct AER915State {
|
||||
I2CSlave parent_obj;
|
||||
|
||||
int len;
|
||||
uint8_t buf[3];
|
||||
} AER915State;
|
||||
|
||||
static int aer915_send(I2CSlave *i2c, uint8_t data)
|
||||
{
|
||||
AER915State *s = FROM_I2C_SLAVE(AER915State, i2c);
|
||||
AER915State *s = AER915(i2c);
|
||||
|
||||
s->buf[s->len] = data;
|
||||
if (s->len++ > 2) {
|
||||
DPRINTF("%s: message too long (%i bytes)\n",
|
||||
@@ -219,7 +224,8 @@ static int aer915_send(I2CSlave *i2c, uint8_t data)
|
||||
|
||||
static void aer915_event(I2CSlave *i2c, enum i2c_event event)
|
||||
{
|
||||
AER915State *s = FROM_I2C_SLAVE(AER915State, i2c);
|
||||
AER915State *s = AER915(i2c);
|
||||
|
||||
switch (event) {
|
||||
case I2C_START_SEND:
|
||||
s->len = 0;
|
||||
@@ -238,8 +244,8 @@ static void aer915_event(I2CSlave *i2c, enum i2c_event event)
|
||||
|
||||
static int aer915_recv(I2CSlave *slave)
|
||||
{
|
||||
AER915State *s = AER915(slave);
|
||||
int retval = 0x00;
|
||||
AER915State *s = FROM_I2C_SLAVE(AER915State, slave);
|
||||
|
||||
switch (s->buf[0]) {
|
||||
/* Return hardcoded battery voltage,
|
||||
@@ -290,7 +296,7 @@ static void aer915_class_init(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static const TypeInfo aer915_info = {
|
||||
.name = "aer915",
|
||||
.name = TYPE_AER915,
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(AER915State),
|
||||
.class_init = aer915_class_init,
|
||||
@@ -308,7 +314,7 @@ static void z2_init(QEMUMachineInitArgs *args)
|
||||
DriveInfo *dinfo;
|
||||
int be;
|
||||
void *z2_lcd;
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
DeviceState *wm;
|
||||
|
||||
if (!cpu_model) {
|
||||
@@ -351,7 +357,7 @@ static void z2_init(QEMUMachineInitArgs *args)
|
||||
type_register_static(&aer915_info);
|
||||
z2_lcd = ssi_create_slave(mpu->ssp[1], "zipit-lcd");
|
||||
bus = pxa2xx_i2c_bus(mpu->i2c[0]);
|
||||
i2c_create_slave(bus, "aer915", 0x55);
|
||||
i2c_create_slave(bus, TYPE_AER915, 0x55);
|
||||
wm = i2c_create_slave(bus, "wm8750", 0x1b);
|
||||
mpu->i2s->opaque = wm;
|
||||
mpu->i2s->codec_out = wm8750_dac_dat;
|
||||
|
||||
@@ -354,7 +354,7 @@ static void adlib_realizefn (DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property adlib_properties[] = {
|
||||
DEFINE_PROP_HEX32 ("iobase", AdlibState, port, 0x220),
|
||||
DEFINE_PROP_UINT32 ("iobase", AdlibState, port, 0x220),
|
||||
DEFINE_PROP_UINT32 ("freq", AdlibState, freq, 44100),
|
||||
DEFINE_PROP_END_OF_LIST (),
|
||||
};
|
||||
|
||||
@@ -673,7 +673,7 @@ static int cs4231a_init (ISABus *bus)
|
||||
}
|
||||
|
||||
static Property cs4231a_properties[] = {
|
||||
DEFINE_PROP_HEX32 ("iobase", CSState, port, 0x534),
|
||||
DEFINE_PROP_UINT32 ("iobase", CSState, port, 0x534),
|
||||
DEFINE_PROP_UINT32 ("irq", CSState, irq, 9),
|
||||
DEFINE_PROP_UINT32 ("dma", CSState, dma, 3),
|
||||
DEFINE_PROP_END_OF_LIST (),
|
||||
|
||||
@@ -304,7 +304,7 @@ static int GUS_init (ISABus *bus)
|
||||
|
||||
static Property gus_properties[] = {
|
||||
DEFINE_PROP_UINT32 ("freq", GUSState, freq, 44100),
|
||||
DEFINE_PROP_HEX32 ("iobase", GUSState, port, 0x240),
|
||||
DEFINE_PROP_UINT32 ("iobase", GUSState, port, 0x240),
|
||||
DEFINE_PROP_UINT32 ("irq", GUSState, emu.gusirq, 7),
|
||||
DEFINE_PROP_UINT32 ("dma", GUSState, emu.gusdma, 3),
|
||||
DEFINE_PROP_END_OF_LIST (),
|
||||
|
||||
@@ -157,6 +157,9 @@ struct HDAAudioStream {
|
||||
uint32_t bpos;
|
||||
};
|
||||
|
||||
#define TYPE_HDA_AUDIO "hda-audio"
|
||||
#define HDA_AUDIO(obj) OBJECT_CHECK(HDAAudioState, (obj), TYPE_HDA_AUDIO)
|
||||
|
||||
struct HDAAudioState {
|
||||
HDACodecDevice hda;
|
||||
const char *name;
|
||||
@@ -288,7 +291,7 @@ static void hda_audio_setup(HDAAudioStream *st)
|
||||
|
||||
static void hda_audio_command(HDACodecDevice *hda, uint32_t nid, uint32_t data)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
|
||||
HDAAudioState *a = HDA_AUDIO(hda);
|
||||
HDAAudioStream *st;
|
||||
const desc_node *node = NULL;
|
||||
const desc_param *param;
|
||||
@@ -448,7 +451,7 @@ fail:
|
||||
|
||||
static void hda_audio_stream(HDACodecDevice *hda, uint32_t stnr, bool running, bool output)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
|
||||
HDAAudioState *a = HDA_AUDIO(hda);
|
||||
int s;
|
||||
|
||||
a->running_compat[stnr] = running;
|
||||
@@ -469,7 +472,7 @@ static void hda_audio_stream(HDACodecDevice *hda, uint32_t stnr, bool running, b
|
||||
|
||||
static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
|
||||
HDAAudioState *a = HDA_AUDIO(hda);
|
||||
HDAAudioStream *st;
|
||||
const desc_node *node;
|
||||
const desc_param *param;
|
||||
@@ -514,7 +517,7 @@ static int hda_audio_init(HDACodecDevice *hda, const struct desc_codec *desc)
|
||||
|
||||
static int hda_audio_exit(HDACodecDevice *hda)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
|
||||
HDAAudioState *a = HDA_AUDIO(hda);
|
||||
HDAAudioStream *st;
|
||||
int i;
|
||||
|
||||
@@ -561,7 +564,7 @@ static int hda_audio_post_load(void *opaque, int version)
|
||||
|
||||
static void hda_audio_reset(DeviceState *dev)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda.qdev, dev);
|
||||
HDAAudioState *a = HDA_AUDIO(dev);
|
||||
HDAAudioStream *st;
|
||||
int i;
|
||||
|
||||
@@ -613,7 +616,7 @@ static Property hda_audio_properties[] = {
|
||||
|
||||
static int hda_audio_init_output(HDACodecDevice *hda)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
|
||||
HDAAudioState *a = HDA_AUDIO(hda);
|
||||
|
||||
if (!a->mixer) {
|
||||
return hda_audio_init(hda, &output_nomixemu);
|
||||
@@ -624,7 +627,7 @@ static int hda_audio_init_output(HDACodecDevice *hda)
|
||||
|
||||
static int hda_audio_init_duplex(HDACodecDevice *hda)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
|
||||
HDAAudioState *a = HDA_AUDIO(hda);
|
||||
|
||||
if (!a->mixer) {
|
||||
return hda_audio_init(hda, &duplex_nomixemu);
|
||||
@@ -635,7 +638,7 @@ static int hda_audio_init_duplex(HDACodecDevice *hda)
|
||||
|
||||
static int hda_audio_init_micro(HDACodecDevice *hda)
|
||||
{
|
||||
HDAAudioState *a = DO_UPCAST(HDAAudioState, hda, hda);
|
||||
HDAAudioState *a = HDA_AUDIO(hda);
|
||||
|
||||
if (!a->mixer) {
|
||||
return hda_audio_init(hda, µ_nomixemu);
|
||||
@@ -644,25 +647,39 @@ static int hda_audio_init_micro(HDACodecDevice *hda)
|
||||
}
|
||||
}
|
||||
|
||||
static void hda_audio_base_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
HDACodecDeviceClass *k = HDA_CODEC_DEVICE_CLASS(klass);
|
||||
|
||||
k->exit = hda_audio_exit;
|
||||
k->command = hda_audio_command;
|
||||
k->stream = hda_audio_stream;
|
||||
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
||||
dc->reset = hda_audio_reset;
|
||||
dc->vmsd = &vmstate_hda_audio;
|
||||
dc->props = hda_audio_properties;
|
||||
}
|
||||
|
||||
static const TypeInfo hda_audio_info = {
|
||||
.name = TYPE_HDA_AUDIO,
|
||||
.parent = TYPE_HDA_CODEC_DEVICE,
|
||||
.class_init = hda_audio_base_class_init,
|
||||
.abstract = true,
|
||||
};
|
||||
|
||||
static void hda_audio_output_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
HDACodecDeviceClass *k = HDA_CODEC_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = hda_audio_init_output;
|
||||
k->exit = hda_audio_exit;
|
||||
k->command = hda_audio_command;
|
||||
k->stream = hda_audio_stream;
|
||||
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
||||
dc->desc = "HDA Audio Codec, output-only (line-out)";
|
||||
dc->reset = hda_audio_reset;
|
||||
dc->vmsd = &vmstate_hda_audio;
|
||||
dc->props = hda_audio_properties;
|
||||
}
|
||||
|
||||
static const TypeInfo hda_audio_output_info = {
|
||||
.name = "hda-output",
|
||||
.parent = TYPE_HDA_CODEC_DEVICE,
|
||||
.parent = TYPE_HDA_AUDIO,
|
||||
.instance_size = sizeof(HDAAudioState),
|
||||
.class_init = hda_audio_output_class_init,
|
||||
};
|
||||
@@ -673,19 +690,12 @@ static void hda_audio_duplex_class_init(ObjectClass *klass, void *data)
|
||||
HDACodecDeviceClass *k = HDA_CODEC_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = hda_audio_init_duplex;
|
||||
k->exit = hda_audio_exit;
|
||||
k->command = hda_audio_command;
|
||||
k->stream = hda_audio_stream;
|
||||
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
||||
dc->desc = "HDA Audio Codec, duplex (line-out, line-in)";
|
||||
dc->reset = hda_audio_reset;
|
||||
dc->vmsd = &vmstate_hda_audio;
|
||||
dc->props = hda_audio_properties;
|
||||
}
|
||||
|
||||
static const TypeInfo hda_audio_duplex_info = {
|
||||
.name = "hda-duplex",
|
||||
.parent = TYPE_HDA_CODEC_DEVICE,
|
||||
.parent = TYPE_HDA_AUDIO,
|
||||
.instance_size = sizeof(HDAAudioState),
|
||||
.class_init = hda_audio_duplex_class_init,
|
||||
};
|
||||
@@ -696,25 +706,19 @@ static void hda_audio_micro_class_init(ObjectClass *klass, void *data)
|
||||
HDACodecDeviceClass *k = HDA_CODEC_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = hda_audio_init_micro;
|
||||
k->exit = hda_audio_exit;
|
||||
k->command = hda_audio_command;
|
||||
k->stream = hda_audio_stream;
|
||||
set_bit(DEVICE_CATEGORY_SOUND, dc->categories);
|
||||
dc->desc = "HDA Audio Codec, duplex (speaker, microphone)";
|
||||
dc->reset = hda_audio_reset;
|
||||
dc->vmsd = &vmstate_hda_audio;
|
||||
dc->props = hda_audio_properties;
|
||||
}
|
||||
|
||||
static const TypeInfo hda_audio_micro_info = {
|
||||
.name = "hda-micro",
|
||||
.parent = TYPE_HDA_CODEC_DEVICE,
|
||||
.parent = TYPE_HDA_AUDIO,
|
||||
.instance_size = sizeof(HDAAudioState),
|
||||
.class_init = hda_audio_micro_class_init,
|
||||
};
|
||||
|
||||
static void hda_audio_register_types(void)
|
||||
{
|
||||
type_register_static(&hda_audio_info);
|
||||
type_register_static(&hda_audio_output_info);
|
||||
type_register_static(&hda_audio_duplex_info);
|
||||
type_register_static(&hda_audio_micro_info);
|
||||
|
||||
@@ -181,7 +181,7 @@ static void pcspk_realizefn(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property pcspk_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", PCSpkState, iobase, -1),
|
||||
DEFINE_PROP_UINT32("iobase", PCSpkState, iobase, -1),
|
||||
DEFINE_PROP_PTR("pit", PCSpkState, pit),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
@@ -1399,8 +1399,8 @@ static int SB16_init (ISABus *bus)
|
||||
}
|
||||
|
||||
static Property sb16_properties[] = {
|
||||
DEFINE_PROP_HEX32 ("version", SB16State, ver, 0x0405), /* 4.5 */
|
||||
DEFINE_PROP_HEX32 ("iobase", SB16State, port, 0x220),
|
||||
DEFINE_PROP_UINT32 ("version", SB16State, ver, 0x0405), /* 4.5 */
|
||||
DEFINE_PROP_UINT32 ("iobase", SB16State, port, 0x220),
|
||||
DEFINE_PROP_UINT32 ("irq", SB16State, irq, 5),
|
||||
DEFINE_PROP_UINT32 ("dma", SB16State, dma, 1),
|
||||
DEFINE_PROP_UINT32 ("dma16", SB16State, hdma, 5),
|
||||
|
||||
@@ -23,8 +23,12 @@ typedef struct {
|
||||
int dac_hz;
|
||||
} WMRate;
|
||||
|
||||
typedef struct {
|
||||
I2CSlave i2c;
|
||||
#define TYPE_WM8750 "wm8750"
|
||||
#define WM8750(obj) OBJECT_CHECK(WM8750State, (obj), TYPE_WM8750)
|
||||
|
||||
typedef struct WM8750State {
|
||||
I2CSlave parent_obj;
|
||||
|
||||
uint8_t i2c_data[2];
|
||||
int i2c_len;
|
||||
QEMUSoundCard card;
|
||||
@@ -256,7 +260,8 @@ static void wm8750_clk_update(WM8750State *s, int ext)
|
||||
|
||||
static void wm8750_reset(I2CSlave *i2c)
|
||||
{
|
||||
WM8750State *s = (WM8750State *) i2c;
|
||||
WM8750State *s = WM8750(i2c);
|
||||
|
||||
s->rate = &wm_rate_table[0];
|
||||
s->enable = 0;
|
||||
wm8750_clk_update(s, 1);
|
||||
@@ -299,7 +304,7 @@ static void wm8750_reset(I2CSlave *i2c)
|
||||
|
||||
static void wm8750_event(I2CSlave *i2c, enum i2c_event event)
|
||||
{
|
||||
WM8750State *s = (WM8750State *) i2c;
|
||||
WM8750State *s = WM8750(i2c);
|
||||
|
||||
switch (event) {
|
||||
case I2C_START_SEND:
|
||||
@@ -356,7 +361,7 @@ static void wm8750_event(I2CSlave *i2c, enum i2c_event event)
|
||||
|
||||
static int wm8750_tx(I2CSlave *i2c, uint8_t data)
|
||||
{
|
||||
WM8750State *s = (WM8750State *) i2c;
|
||||
WM8750State *s = WM8750(i2c);
|
||||
uint8_t cmd;
|
||||
uint16_t value;
|
||||
|
||||
@@ -542,7 +547,7 @@ static int wm8750_tx(I2CSlave *i2c, uint8_t data)
|
||||
break;
|
||||
|
||||
case WM8750_RESET: /* Reset */
|
||||
wm8750_reset(&s->i2c);
|
||||
wm8750_reset(I2C_SLAVE(s));
|
||||
break;
|
||||
|
||||
#ifdef VERBOSE
|
||||
@@ -604,17 +609,17 @@ static const VMStateDescription vmstate_wm8750 = {
|
||||
VMSTATE_UINT8(format, WM8750State),
|
||||
VMSTATE_UINT8(power, WM8750State),
|
||||
VMSTATE_UINT8(rate_vmstate, WM8750State),
|
||||
VMSTATE_I2C_SLAVE(i2c, WM8750State),
|
||||
VMSTATE_I2C_SLAVE(parent_obj, WM8750State),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
static int wm8750_init(I2CSlave *i2c)
|
||||
{
|
||||
WM8750State *s = FROM_I2C_SLAVE(WM8750State, i2c);
|
||||
WM8750State *s = WM8750(i2c);
|
||||
|
||||
AUD_register_card(CODEC, &s->card);
|
||||
wm8750_reset(&s->i2c);
|
||||
wm8750_reset(I2C_SLAVE(s));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -622,8 +627,9 @@ static int wm8750_init(I2CSlave *i2c)
|
||||
#if 0
|
||||
static void wm8750_fini(I2CSlave *i2c)
|
||||
{
|
||||
WM8750State *s = (WM8750State *) i2c;
|
||||
wm8750_reset(&s->i2c);
|
||||
WM8750State *s = WM8750(i2c);
|
||||
|
||||
wm8750_reset(I2C_SLAVE(s));
|
||||
AUD_remove_card(&s->card);
|
||||
g_free(s);
|
||||
}
|
||||
@@ -632,7 +638,8 @@ static void wm8750_fini(I2CSlave *i2c)
|
||||
void wm8750_data_req_set(DeviceState *dev,
|
||||
void (*data_req)(void *, int, int), void *opaque)
|
||||
{
|
||||
WM8750State *s = FROM_I2C_SLAVE(WM8750State, I2C_SLAVE(dev));
|
||||
WM8750State *s = WM8750(dev);
|
||||
|
||||
s->data_req = data_req;
|
||||
s->opaque = opaque;
|
||||
}
|
||||
@@ -702,7 +709,7 @@ static void wm8750_class_init(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static const TypeInfo wm8750_info = {
|
||||
.name = "wm8750",
|
||||
.name = TYPE_WM8750,
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(WM8750State),
|
||||
.class_init = wm8750_class_init,
|
||||
|
||||
@@ -2216,7 +2216,7 @@ static const VMStateDescription vmstate_isa_fdc ={
|
||||
};
|
||||
|
||||
static Property isa_fdc_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", FDCtrlISABus, iobase, 0x3f0),
|
||||
DEFINE_PROP_UINT32("iobase", FDCtrlISABus, iobase, 0x3f0),
|
||||
DEFINE_PROP_UINT32("irq", FDCtrlISABus, irq, 6),
|
||||
DEFINE_PROP_UINT32("dma", FDCtrlISABus, dma, 2),
|
||||
DEFINE_PROP_DRIVE("driveA", FDCtrlISABus, state.drives[0].bs),
|
||||
|
||||
@@ -632,7 +632,7 @@ DeviceState *nand_init(BlockDriverState *bdrv, int manf_id, int chip_id)
|
||||
if (nand_flash_ids[chip_id].size == 0) {
|
||||
hw_error("%s: Unsupported NAND chip ID.\n", __FUNCTION__);
|
||||
}
|
||||
dev = qdev_create(NULL, "nand");
|
||||
dev = DEVICE(object_new(TYPE_NAND));
|
||||
qdev_prop_set_uint8(dev, "manufacturer_id", manf_id);
|
||||
qdev_prop_set_uint8(dev, "chip_id", chip_id);
|
||||
if (bdrv) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
common-obj-$(CONFIG_IPACK) += tpci200.o ipoctal232.o ipack.o
|
||||
common-obj-$(CONFIG_IPACK) += ipoctal232.o
|
||||
common-obj-$(CONFIG_ESCC) += escc.o
|
||||
common-obj-$(CONFIG_PARALLEL) += parallel.o
|
||||
common-obj-$(CONFIG_PL011) += pl011.o
|
||||
|
||||
@@ -110,9 +110,9 @@ static void debugcon_isa_realizefn(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property debugcon_isa_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", ISADebugconState, iobase, 0xe9),
|
||||
DEFINE_PROP_UINT32("iobase", ISADebugconState, iobase, 0xe9),
|
||||
DEFINE_PROP_CHR("chardev", ISADebugconState, state.chr),
|
||||
DEFINE_PROP_HEX32("readback", ISADebugconState, state.readback, 0xe9),
|
||||
DEFINE_PROP_UINT32("readback", ISADebugconState, state.readback, 0xe9),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* later version.
|
||||
*/
|
||||
|
||||
#include "ipack.h"
|
||||
#include "hw/ipack/ipack.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "sysemu/char.h"
|
||||
|
||||
@@ -108,7 +108,8 @@ struct SCC2698Block {
|
||||
};
|
||||
|
||||
struct IPOctalState {
|
||||
IPackDevice dev;
|
||||
IPackDevice parent_obj;
|
||||
|
||||
SCC2698Channel ch[N_CHANNELS];
|
||||
SCC2698Block blk[N_BLOCKS];
|
||||
uint8_t irq_vector;
|
||||
@@ -154,7 +155,7 @@ static const VMStateDescription vmstate_ipoctal = {
|
||||
.minimum_version_id = 1,
|
||||
.minimum_version_id_old = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_IPACK_DEVICE(dev, IPOctalState),
|
||||
VMSTATE_IPACK_DEVICE(parent_obj, IPOctalState),
|
||||
VMSTATE_STRUCT_ARRAY(ch, IPOctalState, N_CHANNELS, 1,
|
||||
vmstate_scc2698_channel, SCC2698Channel),
|
||||
VMSTATE_STRUCT_ARRAY(blk, IPOctalState, N_BLOCKS, 1,
|
||||
@@ -172,6 +173,7 @@ static const uint8_t id_prom_data[] = {
|
||||
|
||||
static void update_irq(IPOctalState *dev, unsigned block)
|
||||
{
|
||||
IPackDevice *idev = IPACK_DEVICE(dev);
|
||||
/* Blocks A and B interrupt on INT0#, C and D on INT1#.
|
||||
Thus, to get the status we have to check two blocks. */
|
||||
SCC2698Block *blk0 = &dev->blk[block];
|
||||
@@ -179,9 +181,9 @@ static void update_irq(IPOctalState *dev, unsigned block)
|
||||
unsigned intno = block / 2;
|
||||
|
||||
if ((blk0->isr & blk0->imr) || (blk1->isr & blk1->imr)) {
|
||||
qemu_irq_raise(dev->dev.irq[intno]);
|
||||
qemu_irq_raise(idev->irq[intno]);
|
||||
} else {
|
||||
qemu_irq_lower(dev->dev.irq[intno]);
|
||||
qemu_irq_lower(idev->irq[intno]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -534,9 +536,9 @@ static void hostdev_event(void *opaque, int event)
|
||||
}
|
||||
}
|
||||
|
||||
static int ipoctal_init(IPackDevice *ip)
|
||||
static void ipoctal_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
IPOctalState *s = IPOCTAL(ip);
|
||||
IPOctalState *s = IPOCTAL(dev);
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < N_CHANNELS; i++) {
|
||||
@@ -552,8 +554,6 @@ static int ipoctal_init(IPackDevice *ip)
|
||||
DPRINTF("Could not redirect channel %u, no chardev set\n", i);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static Property ipoctal_properties[] = {
|
||||
@@ -573,7 +573,7 @@ static void ipoctal_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
IPackDeviceClass *ic = IPACK_DEVICE_CLASS(klass);
|
||||
|
||||
ic->init = ipoctal_init;
|
||||
ic->realize = ipoctal_realize;
|
||||
ic->io_read = io_read;
|
||||
ic->io_write = io_write;
|
||||
ic->id_read = id_read;
|
||||
|
||||
@@ -595,7 +595,7 @@ bool parallel_mm_init(MemoryRegion *address_space,
|
||||
|
||||
static Property parallel_isa_properties[] = {
|
||||
DEFINE_PROP_UINT32("index", ISAParallelState, index, -1),
|
||||
DEFINE_PROP_HEX32("iobase", ISAParallelState, iobase, -1),
|
||||
DEFINE_PROP_UINT32("iobase", ISAParallelState, iobase, -1),
|
||||
DEFINE_PROP_UINT32("irq", ISAParallelState, isairq, 7),
|
||||
DEFINE_PROP_CHR("chardev", ISAParallelState, state.chr),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
|
||||
@@ -88,7 +88,7 @@ static const VMStateDescription vmstate_isa_serial = {
|
||||
|
||||
static Property serial_isa_properties[] = {
|
||||
DEFINE_PROP_UINT32("index", ISASerialState, index, -1),
|
||||
DEFINE_PROP_HEX32("iobase", ISASerialState, iobase, -1),
|
||||
DEFINE_PROP_UINT32("iobase", ISASerialState, iobase, -1),
|
||||
DEFINE_PROP_UINT32("irq", ISASerialState, isairq, -1),
|
||||
DEFINE_PROP_CHR("chardev", ISASerialState, state.chr),
|
||||
DEFINE_PROP_UINT32("wakeup", ISASerialState, state.wakeup, 0),
|
||||
|
||||
@@ -225,7 +225,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
|
||||
|
||||
if (s->tsr_retry <= 0) {
|
||||
if (s->fcr & UART_FCR_FE) {
|
||||
s->tsr = fifo8_is_full(&s->xmit_fifo) ?
|
||||
s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
|
||||
0 : fifo8_pop(&s->xmit_fifo);
|
||||
if (!s->xmit_fifo.num) {
|
||||
s->lsr |= UART_LSR_THRE;
|
||||
|
||||
@@ -109,7 +109,8 @@ static void set_drive(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_drive = {
|
||||
.name = "drive",
|
||||
.name = "str",
|
||||
.legacy_name = "drive",
|
||||
.get = get_drive,
|
||||
.set = set_drive,
|
||||
.release = release_drive,
|
||||
@@ -164,7 +165,8 @@ static void set_chr(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_chr = {
|
||||
.name = "chr",
|
||||
.name = "str",
|
||||
.legacy_name = "chr",
|
||||
.get = get_chr,
|
||||
.set = set_chr,
|
||||
.release = release_chr,
|
||||
@@ -242,7 +244,8 @@ static void set_netdev(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_netdev = {
|
||||
.name = "netdev",
|
||||
.name = "str",
|
||||
.legacy_name = "netdev",
|
||||
.get = get_netdev,
|
||||
.set = set_netdev,
|
||||
};
|
||||
@@ -321,7 +324,8 @@ static void set_vlan(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_vlan = {
|
||||
.name = "vlan",
|
||||
.name = "int32",
|
||||
.legacy_name = "vlan",
|
||||
.print = print_vlan,
|
||||
.get = get_vlan,
|
||||
.set = set_vlan,
|
||||
|
||||
@@ -74,13 +74,6 @@ static void bit_prop_set(DeviceState *dev, Property *props, bool val)
|
||||
}
|
||||
}
|
||||
|
||||
static int prop_print_bit(DeviceState *dev, Property *prop, char *dest,
|
||||
size_t len)
|
||||
{
|
||||
uint32_t *p = qdev_get_prop_ptr(dev, prop);
|
||||
return snprintf(dest, len, (*p & qdev_get_prop_mask(prop)) ? "on" : "off");
|
||||
}
|
||||
|
||||
static void prop_get_bit(Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
{
|
||||
@@ -114,9 +107,8 @@ static void prop_set_bit(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_bit = {
|
||||
.name = "boolean",
|
||||
.name = "bool",
|
||||
.legacy_name = "on/off",
|
||||
.print = prop_print_bit,
|
||||
.get = prop_get_bit,
|
||||
.set = prop_set_bit,
|
||||
};
|
||||
@@ -149,7 +141,7 @@ static void set_bool(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_bool = {
|
||||
.name = "boolean",
|
||||
.name = "bool",
|
||||
.get = get_bool,
|
||||
.set = set_bool,
|
||||
};
|
||||
@@ -187,40 +179,6 @@ PropertyInfo qdev_prop_uint8 = {
|
||||
.set = set_uint8,
|
||||
};
|
||||
|
||||
/* --- 8bit hex value --- */
|
||||
|
||||
static int parse_hex8(DeviceState *dev, Property *prop, const char *str)
|
||||
{
|
||||
uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
char *end;
|
||||
|
||||
if (str[0] != '0' || str[1] != 'x') {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*ptr = strtoul(str, &end, 16);
|
||||
if ((*end != '\0') || (end == str)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int print_hex8(DeviceState *dev, Property *prop, char *dest, size_t len)
|
||||
{
|
||||
uint8_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
return snprintf(dest, len, "0x%" PRIx8, *ptr);
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_hex8 = {
|
||||
.name = "uint8",
|
||||
.legacy_name = "hex8",
|
||||
.parse = parse_hex8,
|
||||
.print = print_hex8,
|
||||
.get = get_uint8,
|
||||
.set = set_uint8,
|
||||
};
|
||||
|
||||
/* --- 16bit integer --- */
|
||||
|
||||
static void get_uint16(Object *obj, Visitor *v, void *opaque,
|
||||
@@ -318,40 +276,6 @@ PropertyInfo qdev_prop_int32 = {
|
||||
.set = set_int32,
|
||||
};
|
||||
|
||||
/* --- 32bit hex value --- */
|
||||
|
||||
static int parse_hex32(DeviceState *dev, Property *prop, const char *str)
|
||||
{
|
||||
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
char *end;
|
||||
|
||||
if (str[0] != '0' || str[1] != 'x') {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*ptr = strtoul(str, &end, 16);
|
||||
if ((*end != '\0') || (end == str)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int print_hex32(DeviceState *dev, Property *prop, char *dest, size_t len)
|
||||
{
|
||||
uint32_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
return snprintf(dest, len, "0x%" PRIx32, *ptr);
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_hex32 = {
|
||||
.name = "uint32",
|
||||
.legacy_name = "hex32",
|
||||
.parse = parse_hex32,
|
||||
.print = print_hex32,
|
||||
.get = get_uint32,
|
||||
.set = set_uint32,
|
||||
};
|
||||
|
||||
/* --- 64bit integer --- */
|
||||
|
||||
static void get_uint64(Object *obj, Visitor *v, void *opaque,
|
||||
@@ -385,40 +309,6 @@ PropertyInfo qdev_prop_uint64 = {
|
||||
.set = set_uint64,
|
||||
};
|
||||
|
||||
/* --- 64bit hex value --- */
|
||||
|
||||
static int parse_hex64(DeviceState *dev, Property *prop, const char *str)
|
||||
{
|
||||
uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
char *end;
|
||||
|
||||
if (str[0] != '0' || str[1] != 'x') {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*ptr = strtoull(str, &end, 16);
|
||||
if ((*end != '\0') || (end == str)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int print_hex64(DeviceState *dev, Property *prop, char *dest, size_t len)
|
||||
{
|
||||
uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
return snprintf(dest, len, "0x%" PRIx64, *ptr);
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_hex64 = {
|
||||
.name = "uint64",
|
||||
.legacy_name = "hex64",
|
||||
.parse = parse_hex64,
|
||||
.print = print_hex64,
|
||||
.get = get_uint64,
|
||||
.set = set_uint64,
|
||||
};
|
||||
|
||||
/* --- string --- */
|
||||
|
||||
static void release_string(Object *obj, const char *name, void *opaque)
|
||||
@@ -427,16 +317,6 @@ static void release_string(Object *obj, const char *name, void *opaque)
|
||||
g_free(*(char **)qdev_get_prop_ptr(DEVICE(obj), prop));
|
||||
}
|
||||
|
||||
static int print_string(DeviceState *dev, Property *prop, char *dest,
|
||||
size_t len)
|
||||
{
|
||||
char **ptr = qdev_get_prop_ptr(dev, prop);
|
||||
if (!*ptr) {
|
||||
return snprintf(dest, len, "<null>");
|
||||
}
|
||||
return snprintf(dest, len, "\"%s\"", *ptr);
|
||||
}
|
||||
|
||||
static void get_string(Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
{
|
||||
@@ -478,8 +358,7 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_string = {
|
||||
.name = "string",
|
||||
.print = print_string,
|
||||
.name = "str",
|
||||
.release = release_string,
|
||||
.get = get_string,
|
||||
.set = set_string,
|
||||
@@ -563,41 +442,31 @@ inval:
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_macaddr = {
|
||||
.name = "macaddr",
|
||||
.name = "str",
|
||||
.legacy_name = "macaddr",
|
||||
.get = get_mac,
|
||||
.set = set_mac,
|
||||
};
|
||||
|
||||
/* --- lost tick policy --- */
|
||||
|
||||
static const char *lost_tick_policy_table[LOST_TICK_MAX+1] = {
|
||||
[LOST_TICK_DISCARD] = "discard",
|
||||
[LOST_TICK_DELAY] = "delay",
|
||||
[LOST_TICK_MERGE] = "merge",
|
||||
[LOST_TICK_SLEW] = "slew",
|
||||
[LOST_TICK_MAX] = NULL,
|
||||
};
|
||||
|
||||
QEMU_BUILD_BUG_ON(sizeof(LostTickPolicy) != sizeof(int));
|
||||
|
||||
PropertyInfo qdev_prop_losttickpolicy = {
|
||||
.name = "LostTickPolicy",
|
||||
.enum_table = lost_tick_policy_table,
|
||||
.enum_table = LostTickPolicy_lookup,
|
||||
.get = get_enum,
|
||||
.set = set_enum,
|
||||
};
|
||||
|
||||
/* --- BIOS CHS translation */
|
||||
|
||||
static const char *bios_chs_trans_table[] = {
|
||||
[BIOS_ATA_TRANSLATION_AUTO] = "auto",
|
||||
[BIOS_ATA_TRANSLATION_NONE] = "none",
|
||||
[BIOS_ATA_TRANSLATION_LBA] = "lba",
|
||||
};
|
||||
QEMU_BUILD_BUG_ON(sizeof(BiosAtaTranslation) != sizeof(int));
|
||||
|
||||
PropertyInfo qdev_prop_bios_chs_trans = {
|
||||
.name = "bios-chs-trans",
|
||||
.enum_table = bios_chs_trans_table,
|
||||
.name = "BiosAtaTranslation",
|
||||
.legacy_name = "bios-chs-trans",
|
||||
.enum_table = BiosAtaTranslation_lookup,
|
||||
.get = get_enum,
|
||||
.set = set_enum,
|
||||
};
|
||||
@@ -715,7 +584,8 @@ static void set_blocksize(Object *obj, Visitor *v, void *opaque,
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_blocksize = {
|
||||
.name = "blocksize",
|
||||
.name = "uint16",
|
||||
.legacy_name = "blocksize",
|
||||
.get = get_uint16,
|
||||
.set = set_blocksize,
|
||||
};
|
||||
@@ -822,7 +692,8 @@ inval:
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_pci_host_devaddr = {
|
||||
.name = "pci-host-devaddr",
|
||||
.name = "str",
|
||||
.legacy_name = "pci-host-devaddr",
|
||||
.get = get_pci_host_devaddr,
|
||||
.set = set_pci_host_devaddr,
|
||||
};
|
||||
@@ -987,20 +858,6 @@ void error_set_from_qdev_prop_error(Error **errp, int ret, DeviceState *dev,
|
||||
}
|
||||
}
|
||||
|
||||
void qdev_prop_parse(DeviceState *dev, const char *name, const char *value,
|
||||
Error **errp)
|
||||
{
|
||||
char *legacy_name;
|
||||
|
||||
legacy_name = g_strdup_printf("legacy-%s", name);
|
||||
if (object_property_get_type(OBJECT(dev), legacy_name, NULL)) {
|
||||
object_property_parse(OBJECT(dev), value, legacy_name, errp);
|
||||
} else {
|
||||
object_property_parse(OBJECT(dev), value, name, errp);
|
||||
}
|
||||
g_free(legacy_name);
|
||||
}
|
||||
|
||||
void qdev_prop_set_bit(DeviceState *dev, const char *name, bool value)
|
||||
{
|
||||
object_property_set_bool(OBJECT(dev), value, name, &error_abort);
|
||||
@@ -1093,7 +950,7 @@ void qdev_prop_set_globals_for_type(DeviceState *dev, const char *typename,
|
||||
if (strcmp(typename, prop->driver) != 0) {
|
||||
continue;
|
||||
}
|
||||
qdev_prop_parse(dev, prop->property, prop->value, &err);
|
||||
object_property_parse(OBJECT(dev), prop->value, prop->property, &err);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
@@ -1140,39 +997,8 @@ static void set_size(Object *obj, Visitor *v, void *opaque,
|
||||
visit_type_size(v, ptr, name, errp);
|
||||
}
|
||||
|
||||
static int parse_size(DeviceState *dev, Property *prop, const char *str)
|
||||
{
|
||||
uint64_t *ptr = qdev_get_prop_ptr(dev, prop);
|
||||
|
||||
if (str != NULL) {
|
||||
parse_option_size(prop->name, str, ptr, &error_abort);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int print_size(DeviceState *dev, Property *prop, char *dest, size_t len)
|
||||
{
|
||||
static const char suffixes[] = { 'B', 'K', 'M', 'G', 'T' };
|
||||
uint64_t div, val = *(uint64_t *)qdev_get_prop_ptr(dev, prop);
|
||||
int i;
|
||||
|
||||
/* Compute floor(log2(val)). */
|
||||
i = 64 - clz64(val);
|
||||
|
||||
/* Find the power of 1024 that we'll display as the units. */
|
||||
i /= 10;
|
||||
if (i >= ARRAY_SIZE(suffixes)) {
|
||||
i = ARRAY_SIZE(suffixes) - 1;
|
||||
}
|
||||
div = 1ULL << (i * 10);
|
||||
|
||||
return snprintf(dest, len, "%0.03f%c", (double)val/div, suffixes[i]);
|
||||
}
|
||||
|
||||
PropertyInfo qdev_prop_size = {
|
||||
.name = "size",
|
||||
.parse = parse_size,
|
||||
.print = print_size,
|
||||
.get = get_size,
|
||||
.set = set_size,
|
||||
};
|
||||
|
||||
@@ -588,31 +588,6 @@ static void qdev_get_legacy_property(Object *obj, Visitor *v, void *opaque,
|
||||
visit_type_str(v, &ptr, name, errp);
|
||||
}
|
||||
|
||||
static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque,
|
||||
const char *name, Error **errp)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
Property *prop = opaque;
|
||||
Error *local_err = NULL;
|
||||
char *ptr = NULL;
|
||||
int ret;
|
||||
|
||||
if (dev->realized) {
|
||||
qdev_prop_set_after_realize(dev, name, errp);
|
||||
return;
|
||||
}
|
||||
|
||||
visit_type_str(v, &ptr, name, &local_err);
|
||||
if (local_err) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = prop->info->parse(dev, prop, ptr);
|
||||
error_set_from_qdev_prop_error(errp, ret, dev, prop, ptr);
|
||||
g_free(ptr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @qdev_add_legacy_property - adds a legacy property
|
||||
*
|
||||
@@ -625,25 +600,20 @@ static void qdev_set_legacy_property(Object *obj, Visitor *v, void *opaque,
|
||||
void qdev_property_add_legacy(DeviceState *dev, Property *prop,
|
||||
Error **errp)
|
||||
{
|
||||
gchar *name, *type;
|
||||
gchar *name;
|
||||
|
||||
/* Register pointer properties as legacy properties */
|
||||
if (!prop->info->print && !prop->info->parse &&
|
||||
(prop->info->set || prop->info->get)) {
|
||||
if (!prop->info->print && prop->info->get) {
|
||||
return;
|
||||
}
|
||||
|
||||
name = g_strdup_printf("legacy-%s", prop->name);
|
||||
type = g_strdup_printf("legacy<%s>",
|
||||
prop->info->legacy_name ?: prop->info->name);
|
||||
|
||||
object_property_add(OBJECT(dev), name, type,
|
||||
object_property_add(OBJECT(dev), name, "str",
|
||||
prop->info->print ? qdev_get_legacy_property : prop->info->get,
|
||||
prop->info->parse ? qdev_set_legacy_property : prop->info->set,
|
||||
NULL,
|
||||
NULL,
|
||||
prop, errp);
|
||||
|
||||
g_free(type);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ static void g364fb_sysbus_reset(DeviceState *d)
|
||||
}
|
||||
|
||||
static Property g364fb_sysbus_properties[] = {
|
||||
DEFINE_PROP_HEX32("vram_size", G364SysBusState, g364.vram_size,
|
||||
DEFINE_PROP_UINT32("vram_size", G364SysBusState, g364.vram_size,
|
||||
8 * 1024 * 1024),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
@@ -41,8 +41,12 @@ enum ssd0303_cmd {
|
||||
SSD0303_CMD_SKIP1
|
||||
};
|
||||
|
||||
#define TYPE_SSD0303 "ssd0303"
|
||||
#define SSD0303(obj) OBJECT_CHECK(ssd0303_state, (obj), TYPE_SSD0303)
|
||||
|
||||
typedef struct {
|
||||
I2CSlave i2c;
|
||||
I2CSlave parent_obj;
|
||||
|
||||
QemuConsole *con;
|
||||
int row;
|
||||
int col;
|
||||
@@ -65,8 +69,9 @@ static int ssd0303_recv(I2CSlave *i2c)
|
||||
|
||||
static int ssd0303_send(I2CSlave *i2c, uint8_t data)
|
||||
{
|
||||
ssd0303_state *s = (ssd0303_state *)i2c;
|
||||
ssd0303_state *s = SSD0303(i2c);
|
||||
enum ssd0303_cmd old_cmd_state;
|
||||
|
||||
switch (s->mode) {
|
||||
case SSD0303_IDLE:
|
||||
DPRINTF("byte 0x%02x\n", data);
|
||||
@@ -175,7 +180,8 @@ static int ssd0303_send(I2CSlave *i2c, uint8_t data)
|
||||
|
||||
static void ssd0303_event(I2CSlave *i2c, enum i2c_event event)
|
||||
{
|
||||
ssd0303_state *s = (ssd0303_state *)i2c;
|
||||
ssd0303_state *s = SSD0303(i2c);
|
||||
|
||||
switch (event) {
|
||||
case I2C_FINISH:
|
||||
s->mode = SSD0303_IDLE;
|
||||
@@ -279,7 +285,7 @@ static const VMStateDescription vmstate_ssd0303 = {
|
||||
VMSTATE_UINT32(mode, ssd0303_state),
|
||||
VMSTATE_UINT32(cmd_state, ssd0303_state),
|
||||
VMSTATE_BUFFER(framebuffer, ssd0303_state),
|
||||
VMSTATE_I2C_SLAVE(i2c, ssd0303_state),
|
||||
VMSTATE_I2C_SLAVE(parent_obj, ssd0303_state),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -291,7 +297,7 @@ static const GraphicHwOps ssd0303_ops = {
|
||||
|
||||
static int ssd0303_init(I2CSlave *i2c)
|
||||
{
|
||||
ssd0303_state *s = FROM_I2C_SLAVE(ssd0303_state, i2c);
|
||||
ssd0303_state *s = SSD0303(i2c);
|
||||
|
||||
s->con = graphic_console_init(DEVICE(i2c), &ssd0303_ops, s);
|
||||
qemu_console_resize(s->con, 96 * MAGNIFY, 16 * MAGNIFY);
|
||||
@@ -311,7 +317,7 @@ static void ssd0303_class_init(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static const TypeInfo ssd0303_info = {
|
||||
.name = "ssd0303",
|
||||
.name = TYPE_SSD0303,
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(ssd0303_state),
|
||||
.class_init = ssd0303_class_init,
|
||||
|
||||
@@ -617,11 +617,11 @@ static int tcx_init1(SysBusDevice *dev)
|
||||
}
|
||||
|
||||
static Property tcx_properties[] = {
|
||||
DEFINE_PROP_HEX32("vram_size", TCXState, vram_size, -1),
|
||||
DEFINE_PROP_UINT32("vram_size", TCXState, vram_size, -1),
|
||||
DEFINE_PROP_UINT16("width", TCXState, width, -1),
|
||||
DEFINE_PROP_UINT16("height", TCXState, height, -1),
|
||||
DEFINE_PROP_UINT16("depth", TCXState, depth, -1),
|
||||
DEFINE_PROP_HEX64("prom_addr", TCXState, prom_addr, -1),
|
||||
DEFINE_PROP_UINT64("prom_addr", TCXState, prom_addr, -1),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ static void i82374_isa_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property i82374_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", ISAi82374State, iobase, 0x400),
|
||||
DEFINE_PROP_UINT32("iobase", ISAi82374State, iobase, 0x400),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
};
|
||||
|
||||
|
||||
@@ -362,7 +362,7 @@ static int iommu_init1(SysBusDevice *dev)
|
||||
}
|
||||
|
||||
static Property iommu_properties[] = {
|
||||
DEFINE_PROP_HEX32("version", IOMMUState, version, 0),
|
||||
DEFINE_PROP_UINT32("version", IOMMUState, version, 0),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -9,8 +9,12 @@
|
||||
|
||||
#include "hw/i2c/i2c.h"
|
||||
|
||||
typedef struct {
|
||||
I2CSlave i2c;
|
||||
#define TYPE_MAX7310 "max7310"
|
||||
#define MAX7310(obj) OBJECT_CHECK(MAX7310State, (obj), TYPE_MAX7310)
|
||||
|
||||
typedef struct MAX7310State {
|
||||
I2CSlave parent_obj;
|
||||
|
||||
int i2c_command_byte;
|
||||
int len;
|
||||
|
||||
@@ -25,7 +29,8 @@ typedef struct {
|
||||
|
||||
static void max7310_reset(DeviceState *dev)
|
||||
{
|
||||
MAX7310State *s = FROM_I2C_SLAVE(MAX7310State, I2C_SLAVE(dev));
|
||||
MAX7310State *s = MAX7310(dev);
|
||||
|
||||
s->level &= s->direction;
|
||||
s->direction = 0xff;
|
||||
s->polarity = 0xf0;
|
||||
@@ -35,7 +40,7 @@ static void max7310_reset(DeviceState *dev)
|
||||
|
||||
static int max7310_rx(I2CSlave *i2c)
|
||||
{
|
||||
MAX7310State *s = (MAX7310State *) i2c;
|
||||
MAX7310State *s = MAX7310(i2c);
|
||||
|
||||
switch (s->command) {
|
||||
case 0x00: /* Input port */
|
||||
@@ -70,7 +75,7 @@ static int max7310_rx(I2CSlave *i2c)
|
||||
|
||||
static int max7310_tx(I2CSlave *i2c, uint8_t data)
|
||||
{
|
||||
MAX7310State *s = (MAX7310State *) i2c;
|
||||
MAX7310State *s = MAX7310(i2c);
|
||||
uint8_t diff;
|
||||
int line;
|
||||
|
||||
@@ -125,7 +130,7 @@ static int max7310_tx(I2CSlave *i2c, uint8_t data)
|
||||
|
||||
static void max7310_event(I2CSlave *i2c, enum i2c_event event)
|
||||
{
|
||||
MAX7310State *s = (MAX7310State *) i2c;
|
||||
MAX7310State *s = MAX7310(i2c);
|
||||
s->len = 0;
|
||||
|
||||
switch (event) {
|
||||
@@ -156,7 +161,7 @@ static const VMStateDescription vmstate_max7310 = {
|
||||
VMSTATE_UINT8(polarity, MAX7310State),
|
||||
VMSTATE_UINT8(status, MAX7310State),
|
||||
VMSTATE_UINT8(command, MAX7310State),
|
||||
VMSTATE_I2C_SLAVE(i2c, MAX7310State),
|
||||
VMSTATE_I2C_SLAVE(parent_obj, MAX7310State),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -177,7 +182,7 @@ static void max7310_gpio_set(void *opaque, int line, int level)
|
||||
* but also accepts sequences that are not SMBus so return an I2C device. */
|
||||
static int max7310_init(I2CSlave *i2c)
|
||||
{
|
||||
MAX7310State *s = FROM_I2C_SLAVE(MAX7310State, i2c);
|
||||
MAX7310State *s = MAX7310(i2c);
|
||||
|
||||
qdev_init_gpio_in(&i2c->qdev, max7310_gpio_set, 8);
|
||||
qdev_init_gpio_out(&i2c->qdev, s->handler, 8);
|
||||
@@ -199,7 +204,7 @@ static void max7310_class_init(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static const TypeInfo max7310_info = {
|
||||
.name = "max7310",
|
||||
.name = TYPE_MAX7310,
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(MAX7310State),
|
||||
.class_init = max7310_class_init,
|
||||
|
||||
@@ -46,7 +46,7 @@ typedef enum bitbang_i2c_state {
|
||||
} bitbang_i2c_state;
|
||||
|
||||
struct bitbang_i2c_interface {
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
bitbang_i2c_state state;
|
||||
int last_data;
|
||||
int last_clock;
|
||||
@@ -170,7 +170,7 @@ int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level)
|
||||
abort();
|
||||
}
|
||||
|
||||
bitbang_i2c_interface *bitbang_i2c_init(i2c_bus *bus)
|
||||
bitbang_i2c_interface *bitbang_i2c_init(I2CBus *bus)
|
||||
{
|
||||
bitbang_i2c_interface *s;
|
||||
|
||||
@@ -213,7 +213,7 @@ static int gpio_i2c_init(SysBusDevice *sbd)
|
||||
{
|
||||
DeviceState *dev = DEVICE(sbd);
|
||||
GPIOI2CState *s = GPIO_I2C(dev);
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
|
||||
memory_region_init(&s->dummy_iomem, OBJECT(s), "gpio_i2c", 0);
|
||||
sysbus_init_mmio(sbd, &s->dummy_iomem);
|
||||
|
||||
@@ -8,7 +8,7 @@ typedef struct bitbang_i2c_interface bitbang_i2c_interface;
|
||||
#define BITBANG_I2C_SDA 0
|
||||
#define BITBANG_I2C_SCL 1
|
||||
|
||||
bitbang_i2c_interface *bitbang_i2c_init(i2c_bus *bus);
|
||||
bitbang_i2c_interface *bitbang_i2c_init(I2CBus *bus);
|
||||
int bitbang_i2c_set(bitbang_i2c_interface *i2c, int line, int level);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "hw/i2c/i2c.h"
|
||||
|
||||
struct i2c_bus
|
||||
struct I2CBus
|
||||
{
|
||||
BusState qbus;
|
||||
I2CSlave *current_dev;
|
||||
@@ -23,24 +23,24 @@ static Property i2c_props[] = {
|
||||
};
|
||||
|
||||
#define TYPE_I2C_BUS "i2c-bus"
|
||||
#define I2C_BUS(obj) OBJECT_CHECK(i2c_bus, (obj), TYPE_I2C_BUS)
|
||||
#define I2C_BUS(obj) OBJECT_CHECK(I2CBus, (obj), TYPE_I2C_BUS)
|
||||
|
||||
static const TypeInfo i2c_bus_info = {
|
||||
.name = TYPE_I2C_BUS,
|
||||
.parent = TYPE_BUS,
|
||||
.instance_size = sizeof(i2c_bus),
|
||||
.instance_size = sizeof(I2CBus),
|
||||
};
|
||||
|
||||
static void i2c_bus_pre_save(void *opaque)
|
||||
{
|
||||
i2c_bus *bus = opaque;
|
||||
I2CBus *bus = opaque;
|
||||
|
||||
bus->saved_address = bus->current_dev ? bus->current_dev->address : -1;
|
||||
}
|
||||
|
||||
static int i2c_bus_post_load(void *opaque, int version_id)
|
||||
{
|
||||
i2c_bus *bus = opaque;
|
||||
I2CBus *bus = opaque;
|
||||
|
||||
/* The bus is loaded before attached devices, so load and save the
|
||||
current device id. Devices will check themselves as loaded. */
|
||||
@@ -56,15 +56,15 @@ static const VMStateDescription vmstate_i2c_bus = {
|
||||
.pre_save = i2c_bus_pre_save,
|
||||
.post_load = i2c_bus_post_load,
|
||||
.fields = (VMStateField []) {
|
||||
VMSTATE_UINT8(saved_address, i2c_bus),
|
||||
VMSTATE_UINT8(saved_address, I2CBus),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
/* Create a new I2C bus. */
|
||||
i2c_bus *i2c_init_bus(DeviceState *parent, const char *name)
|
||||
I2CBus *i2c_init_bus(DeviceState *parent, const char *name)
|
||||
{
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
|
||||
bus = I2C_BUS(qbus_create(TYPE_I2C_BUS, parent, name));
|
||||
vmstate_register(NULL, -1, &vmstate_i2c_bus, bus);
|
||||
@@ -77,14 +77,14 @@ void i2c_set_slave_address(I2CSlave *dev, uint8_t address)
|
||||
}
|
||||
|
||||
/* Return nonzero if bus is busy. */
|
||||
int i2c_bus_busy(i2c_bus *bus)
|
||||
int i2c_bus_busy(I2CBus *bus)
|
||||
{
|
||||
return bus->current_dev != NULL;
|
||||
}
|
||||
|
||||
/* Returns non-zero if the address is not valid. */
|
||||
/* TODO: Make this handle multiple masters. */
|
||||
int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
|
||||
int i2c_start_transfer(I2CBus *bus, uint8_t address, int recv)
|
||||
{
|
||||
BusChild *kid;
|
||||
I2CSlave *slave = NULL;
|
||||
@@ -113,7 +113,7 @@ int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void i2c_end_transfer(i2c_bus *bus)
|
||||
void i2c_end_transfer(I2CBus *bus)
|
||||
{
|
||||
I2CSlave *dev = bus->current_dev;
|
||||
I2CSlaveClass *sc;
|
||||
@@ -130,7 +130,7 @@ void i2c_end_transfer(i2c_bus *bus)
|
||||
bus->current_dev = NULL;
|
||||
}
|
||||
|
||||
int i2c_send(i2c_bus *bus, uint8_t data)
|
||||
int i2c_send(I2CBus *bus, uint8_t data)
|
||||
{
|
||||
I2CSlave *dev = bus->current_dev;
|
||||
I2CSlaveClass *sc;
|
||||
@@ -147,7 +147,7 @@ int i2c_send(i2c_bus *bus, uint8_t data)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int i2c_recv(i2c_bus *bus)
|
||||
int i2c_recv(I2CBus *bus)
|
||||
{
|
||||
I2CSlave *dev = bus->current_dev;
|
||||
I2CSlaveClass *sc;
|
||||
@@ -164,7 +164,7 @@ int i2c_recv(i2c_bus *bus)
|
||||
return -1;
|
||||
}
|
||||
|
||||
void i2c_nack(i2c_bus *bus)
|
||||
void i2c_nack(I2CBus *bus)
|
||||
{
|
||||
I2CSlave *dev = bus->current_dev;
|
||||
I2CSlaveClass *sc;
|
||||
@@ -182,7 +182,7 @@ void i2c_nack(i2c_bus *bus)
|
||||
static int i2c_slave_post_load(void *opaque, int version_id)
|
||||
{
|
||||
I2CSlave *dev = opaque;
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
bus = I2C_BUS(qdev_get_parent_bus(DEVICE(dev)));
|
||||
if (bus->saved_address == dev->address) {
|
||||
bus->current_dev = dev;
|
||||
@@ -210,7 +210,7 @@ static int i2c_slave_qdev_init(DeviceState *dev)
|
||||
return sc->init(s);
|
||||
}
|
||||
|
||||
DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
|
||||
DeviceState *i2c_create_slave(I2CBus *bus, const char *name, uint8_t addr)
|
||||
{
|
||||
DeviceState *dev;
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ typedef struct Exynos4210I2CState {
|
||||
SysBusDevice parent_obj;
|
||||
|
||||
MemoryRegion iomem;
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
qemu_irq irq;
|
||||
|
||||
uint8_t i2ccon;
|
||||
|
||||
@@ -30,7 +30,7 @@ typedef struct OMAPI2CState {
|
||||
MemoryRegion iomem;
|
||||
qemu_irq irq;
|
||||
qemu_irq drq[2];
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
|
||||
uint8_t revision;
|
||||
void *iclk;
|
||||
@@ -491,7 +491,7 @@ static void omap_i2c_register_types(void)
|
||||
type_register_static(&omap_i2c_info);
|
||||
}
|
||||
|
||||
i2c_bus *omap_i2c_bus(DeviceState *omap_i2c)
|
||||
I2CBus *omap_i2c_bus(DeviceState *omap_i2c)
|
||||
{
|
||||
OMAPI2CState *s = OMAP_I2C(omap_i2c);
|
||||
return s->bus;
|
||||
|
||||
@@ -59,7 +59,7 @@ static void smb_transaction(PMSMBus *s)
|
||||
uint8_t read = s->smb_addr & 0x01;
|
||||
uint8_t cmd = s->smb_cmd;
|
||||
uint8_t addr = s->smb_addr >> 1;
|
||||
i2c_bus *bus = s->smbus;
|
||||
I2CBus *bus = s->smbus;
|
||||
|
||||
SMBUS_DPRINTF("SMBus trans addr=0x%02x prot=0x%02x\n", addr, prot);
|
||||
/* Transaction isn't exec if STS_DEV_ERR bit set */
|
||||
|
||||
@@ -208,13 +208,13 @@ static int smbus_device_init(I2CSlave *i2c)
|
||||
}
|
||||
|
||||
/* Master device commands. */
|
||||
void smbus_quick_command(i2c_bus *bus, uint8_t addr, int read)
|
||||
void smbus_quick_command(I2CBus *bus, uint8_t addr, int read)
|
||||
{
|
||||
i2c_start_transfer(bus, addr, read);
|
||||
i2c_end_transfer(bus);
|
||||
}
|
||||
|
||||
uint8_t smbus_receive_byte(i2c_bus *bus, uint8_t addr)
|
||||
uint8_t smbus_receive_byte(I2CBus *bus, uint8_t addr)
|
||||
{
|
||||
uint8_t data;
|
||||
|
||||
@@ -225,14 +225,14 @@ uint8_t smbus_receive_byte(i2c_bus *bus, uint8_t addr)
|
||||
return data;
|
||||
}
|
||||
|
||||
void smbus_send_byte(i2c_bus *bus, uint8_t addr, uint8_t data)
|
||||
void smbus_send_byte(I2CBus *bus, uint8_t addr, uint8_t data)
|
||||
{
|
||||
i2c_start_transfer(bus, addr, 0);
|
||||
i2c_send(bus, data);
|
||||
i2c_end_transfer(bus);
|
||||
}
|
||||
|
||||
uint8_t smbus_read_byte(i2c_bus *bus, uint8_t addr, uint8_t command)
|
||||
uint8_t smbus_read_byte(I2CBus *bus, uint8_t addr, uint8_t command)
|
||||
{
|
||||
uint8_t data;
|
||||
i2c_start_transfer(bus, addr, 0);
|
||||
@@ -244,7 +244,7 @@ uint8_t smbus_read_byte(i2c_bus *bus, uint8_t addr, uint8_t command)
|
||||
return data;
|
||||
}
|
||||
|
||||
void smbus_write_byte(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t data)
|
||||
void smbus_write_byte(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t data)
|
||||
{
|
||||
i2c_start_transfer(bus, addr, 0);
|
||||
i2c_send(bus, command);
|
||||
@@ -252,7 +252,7 @@ void smbus_write_byte(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t data)
|
||||
i2c_end_transfer(bus);
|
||||
}
|
||||
|
||||
uint16_t smbus_read_word(i2c_bus *bus, uint8_t addr, uint8_t command)
|
||||
uint16_t smbus_read_word(I2CBus *bus, uint8_t addr, uint8_t command)
|
||||
{
|
||||
uint16_t data;
|
||||
i2c_start_transfer(bus, addr, 0);
|
||||
@@ -265,7 +265,7 @@ uint16_t smbus_read_word(i2c_bus *bus, uint8_t addr, uint8_t command)
|
||||
return data;
|
||||
}
|
||||
|
||||
void smbus_write_word(i2c_bus *bus, uint8_t addr, uint8_t command, uint16_t data)
|
||||
void smbus_write_word(I2CBus *bus, uint8_t addr, uint8_t command, uint16_t data)
|
||||
{
|
||||
i2c_start_transfer(bus, addr, 0);
|
||||
i2c_send(bus, command);
|
||||
@@ -274,7 +274,7 @@ void smbus_write_word(i2c_bus *bus, uint8_t addr, uint8_t command, uint16_t data
|
||||
i2c_end_transfer(bus);
|
||||
}
|
||||
|
||||
int smbus_read_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data)
|
||||
int smbus_read_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data)
|
||||
{
|
||||
int len;
|
||||
int i;
|
||||
@@ -292,7 +292,7 @@ int smbus_read_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data)
|
||||
return len;
|
||||
}
|
||||
|
||||
void smbus_write_block(i2c_bus *bus, uint8_t addr, uint8_t command, uint8_t *data,
|
||||
void smbus_write_block(I2CBus *bus, uint8_t addr, uint8_t command, uint8_t *data,
|
||||
int len)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -139,7 +139,7 @@ static void smbus_eeprom_register_types(void)
|
||||
|
||||
type_init(smbus_eeprom_register_types)
|
||||
|
||||
void smbus_eeprom_init(i2c_bus *smbus, int nb_eeprom,
|
||||
void smbus_eeprom_init(I2CBus *smbus, int nb_eeprom,
|
||||
const uint8_t *eeprom_spd, int eeprom_spd_size)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -108,7 +108,7 @@ static void ich9_smb_class_init(ObjectClass *klass, void *data)
|
||||
dc->cannot_instantiate_with_device_add_yet = true;
|
||||
}
|
||||
|
||||
i2c_bus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
|
||||
I2CBus *ich9_smb_init(PCIBus *bus, int devfn, uint32_t smb_io_base)
|
||||
{
|
||||
PCIDevice *d =
|
||||
pci_create_simple_multifunction(bus, devfn, true, TYPE_ICH9_SMB_DEVICE);
|
||||
|
||||
@@ -81,7 +81,7 @@ static int versatile_i2c_init(SysBusDevice *sbd)
|
||||
{
|
||||
DeviceState *dev = DEVICE(sbd);
|
||||
VersatileI2CState *s = VERSATILE_I2C(dev);
|
||||
i2c_bus *bus;
|
||||
I2CBus *bus;
|
||||
|
||||
bus = i2c_init_bus(dev, "i2c");
|
||||
s->bitbang = bitbang_i2c_init(bus);
|
||||
|
||||
@@ -268,9 +268,9 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
|
||||
return;
|
||||
}
|
||||
switch (s->lost_tick_policy) {
|
||||
case LOST_TICK_DELAY:
|
||||
case LOST_TICK_POLICY_DELAY:
|
||||
break; /* enabled by default */
|
||||
case LOST_TICK_DISCARD:
|
||||
case LOST_TICK_POLICY_DISCARD:
|
||||
if (kvm_check_extension(kvm_state, KVM_CAP_REINJECT_CONTROL)) {
|
||||
struct kvm_reinject_control control = { .pit_reinject = 0 };
|
||||
|
||||
@@ -298,9 +298,9 @@ static void kvm_pit_realizefn(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property kvm_pit_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", PITCommonState, iobase, -1),
|
||||
DEFINE_PROP_UINT32("iobase", PITCommonState, iobase, -1),
|
||||
DEFINE_PROP_LOSTTICKPOLICY("lost_tick_policy", KVMPITState,
|
||||
lost_tick_policy, LOST_TICK_DELAY),
|
||||
lost_tick_policy, LOST_TICK_POLICY_DELAY),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ static void pc_init1(QEMUMachineInitArgs *args,
|
||||
}
|
||||
|
||||
if (pci_enabled && acpi_enabled) {
|
||||
i2c_bus *smbus;
|
||||
I2CBus *smbus;
|
||||
|
||||
smi_irq = qemu_allocate_irqs(pc_acpi_smi_interrupt, first_cpu, 1);
|
||||
/* TODO: Populate SPD eeprom data. */
|
||||
|
||||
@@ -104,8 +104,8 @@ ISADevice *isa_ide_init(ISABus *bus, int iobase, int iobase2, int isairq,
|
||||
}
|
||||
|
||||
static Property isa_ide_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", ISAIDEState, iobase, 0x1f0),
|
||||
DEFINE_PROP_HEX32("iobase2", ISAIDEState, iobase2, 0x3f6),
|
||||
DEFINE_PROP_UINT32("iobase", ISAIDEState, iobase, 0x1f0),
|
||||
DEFINE_PROP_UINT32("iobase2", ISAIDEState, iobase2, 0x3f6),
|
||||
DEFINE_PROP_UINT32("irq", ISAIDEState, isairq, 14),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
@@ -206,7 +206,7 @@ static int ide_drive_initfn(IDEDevice *dev)
|
||||
#define DEFINE_IDE_DEV_PROPERTIES() \
|
||||
DEFINE_BLOCK_PROPERTIES(IDEDrive, dev.conf), \
|
||||
DEFINE_PROP_STRING("ver", IDEDrive, dev.version), \
|
||||
DEFINE_PROP_HEX64("wwn", IDEDrive, dev.wwn, 0), \
|
||||
DEFINE_PROP_UINT64("wwn", IDEDrive, dev.wwn, 0), \
|
||||
DEFINE_PROP_STRING("serial", IDEDrive, dev.serial),\
|
||||
DEFINE_PROP_STRING("model", IDEDrive, dev.model)
|
||||
|
||||
|
||||
@@ -23,8 +23,12 @@
|
||||
#include "qemu/timer.h"
|
||||
#include "ui/console.h"
|
||||
|
||||
#define TYPE_LM8323 "lm8323"
|
||||
#define LM8323(obj) OBJECT_CHECK(LM823KbdState, (obj), TYPE_LM8323)
|
||||
|
||||
typedef struct {
|
||||
I2CSlave i2c;
|
||||
I2CSlave parent_obj;
|
||||
|
||||
uint8_t i2c_dir;
|
||||
uint8_t i2c_cycle;
|
||||
uint8_t reg;
|
||||
@@ -380,7 +384,7 @@ static void lm_kbd_write(LM823KbdState *s, int reg, int byte, uint8_t value)
|
||||
|
||||
static void lm_i2c_event(I2CSlave *i2c, enum i2c_event event)
|
||||
{
|
||||
LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
|
||||
LM823KbdState *s = LM8323(i2c);
|
||||
|
||||
switch (event) {
|
||||
case I2C_START_RECV:
|
||||
@@ -396,14 +400,14 @@ static void lm_i2c_event(I2CSlave *i2c, enum i2c_event event)
|
||||
|
||||
static int lm_i2c_rx(I2CSlave *i2c)
|
||||
{
|
||||
LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
|
||||
LM823KbdState *s = LM8323(i2c);
|
||||
|
||||
return lm_kbd_read(s, s->reg, s->i2c_cycle ++);
|
||||
}
|
||||
|
||||
static int lm_i2c_tx(I2CSlave *i2c, uint8_t data)
|
||||
{
|
||||
LM823KbdState *s = (LM823KbdState *) i2c;
|
||||
LM823KbdState *s = LM8323(i2c);
|
||||
|
||||
if (!s->i2c_cycle)
|
||||
s->reg = data;
|
||||
@@ -431,7 +435,7 @@ static const VMStateDescription vmstate_lm_kbd = {
|
||||
.minimum_version_id_old = 0,
|
||||
.post_load = lm_kbd_post_load,
|
||||
.fields = (VMStateField []) {
|
||||
VMSTATE_I2C_SLAVE(i2c, LM823KbdState),
|
||||
VMSTATE_I2C_SLAVE(parent_obj, LM823KbdState),
|
||||
VMSTATE_UINT8(i2c_dir, LM823KbdState),
|
||||
VMSTATE_UINT8(i2c_cycle, LM823KbdState),
|
||||
VMSTATE_UINT8(reg, LM823KbdState),
|
||||
@@ -460,13 +464,13 @@ static const VMStateDescription vmstate_lm_kbd = {
|
||||
|
||||
static int lm8323_init(I2CSlave *i2c)
|
||||
{
|
||||
LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, i2c);
|
||||
LM823KbdState *s = LM8323(i2c);
|
||||
|
||||
s->model = 0x8323;
|
||||
s->pwm.tm[0] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm0_tick, s);
|
||||
s->pwm.tm[1] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm1_tick, s);
|
||||
s->pwm.tm[2] = timer_new_ns(QEMU_CLOCK_VIRTUAL, lm_kbd_pwm2_tick, s);
|
||||
qdev_init_gpio_out(&i2c->qdev, &s->nirq, 1);
|
||||
qdev_init_gpio_out(DEVICE(i2c), &s->nirq, 1);
|
||||
|
||||
lm_kbd_reset(s);
|
||||
|
||||
@@ -476,7 +480,7 @@ static int lm8323_init(I2CSlave *i2c)
|
||||
|
||||
void lm832x_key_event(DeviceState *dev, int key, int state)
|
||||
{
|
||||
LM823KbdState *s = FROM_I2C_SLAVE(LM823KbdState, I2C_SLAVE(dev));
|
||||
LM823KbdState *s = LM8323(dev);
|
||||
|
||||
if ((s->status & INT_ERROR) && (s->error & ERR_FIFOOVR))
|
||||
return;
|
||||
@@ -507,7 +511,7 @@ static void lm8323_class_init(ObjectClass *klass, void *data)
|
||||
}
|
||||
|
||||
static const TypeInfo lm8323_info = {
|
||||
.name = "lm8323",
|
||||
.name = TYPE_LM8323,
|
||||
.parent = TYPE_I2C_SLAVE,
|
||||
.instance_size = sizeof(LM823KbdState),
|
||||
.class_init = lm8323_class_init,
|
||||
|
||||
@@ -189,7 +189,7 @@ uint32_t gic_acknowledge_irq(GICState *s, int cpu)
|
||||
}
|
||||
s->last_active[irq][cpu] = s->running_irq[cpu];
|
||||
|
||||
if (s->revision == REV_11MPCORE) {
|
||||
if (s->revision == REV_11MPCORE || s->revision == REV_NVIC) {
|
||||
/* Clear pending flags for both level and edge triggered interrupts.
|
||||
* Level triggered IRQs will be reasserted once they become inactive.
|
||||
*/
|
||||
|
||||
@@ -123,9 +123,9 @@ static const VMStateDescription vmstate_pic_common = {
|
||||
};
|
||||
|
||||
static Property pic_properties_common[] = {
|
||||
DEFINE_PROP_HEX32("iobase", PICCommonState, iobase, -1),
|
||||
DEFINE_PROP_HEX32("elcr_addr", PICCommonState, elcr_addr, -1),
|
||||
DEFINE_PROP_HEX8("elcr_mask", PICCommonState, elcr_mask, -1),
|
||||
DEFINE_PROP_UINT32("iobase", PICCommonState, iobase, -1),
|
||||
DEFINE_PROP_UINT32("elcr_addr", PICCommonState, elcr_addr, -1),
|
||||
DEFINE_PROP_UINT8("elcr_mask", PICCommonState, elcr_mask, -1),
|
||||
DEFINE_PROP_BIT("master", PICCommonState, master, 0, false),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
2
hw/ipack/Makefile.objs
Normal file
2
hw/ipack/Makefile.objs
Normal file
@@ -0,0 +1,2 @@
|
||||
common-obj-$(CONFIG_IPACK) += ipack.o
|
||||
common-obj-$(CONFIG_IPACK) += tpci200.o
|
||||
@@ -8,7 +8,7 @@
|
||||
* later version.
|
||||
*/
|
||||
|
||||
#include "ipack.h"
|
||||
#include "hw/ipack/ipack.h"
|
||||
|
||||
IPackDevice *ipack_device_find(IPackBus *bus, int32_t slot)
|
||||
{
|
||||
@@ -34,37 +34,39 @@ void ipack_bus_new_inplace(IPackBus *bus, size_t bus_size,
|
||||
bus->set_irq = handler;
|
||||
}
|
||||
|
||||
static int ipack_device_dev_init(DeviceState *qdev)
|
||||
static void ipack_device_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
IPackBus *bus = IPACK_BUS(qdev_get_parent_bus(qdev));
|
||||
IPackDevice *dev = IPACK_DEVICE(qdev);
|
||||
IPackDevice *idev = IPACK_DEVICE(dev);
|
||||
IPackBus *bus = IPACK_BUS(qdev_get_parent_bus(dev));
|
||||
IPackDeviceClass *k = IPACK_DEVICE_GET_CLASS(dev);
|
||||
|
||||
if (dev->slot < 0) {
|
||||
dev->slot = bus->free_slot;
|
||||
if (idev->slot < 0) {
|
||||
idev->slot = bus->free_slot;
|
||||
}
|
||||
if (dev->slot >= bus->n_slots) {
|
||||
return -1;
|
||||
if (idev->slot >= bus->n_slots) {
|
||||
error_setg(errp, "Only %" PRIu8 " slots available.", bus->n_slots);
|
||||
return;
|
||||
}
|
||||
bus->free_slot = dev->slot + 1;
|
||||
bus->free_slot = idev->slot + 1;
|
||||
|
||||
dev->irq = qemu_allocate_irqs(bus->set_irq, dev, 2);
|
||||
idev->irq = qemu_allocate_irqs(bus->set_irq, idev, 2);
|
||||
|
||||
return k->init(dev);
|
||||
k->realize(dev, errp);
|
||||
}
|
||||
|
||||
static int ipack_device_dev_exit(DeviceState *qdev)
|
||||
static void ipack_device_unrealize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
IPackDevice *dev = IPACK_DEVICE(qdev);
|
||||
IPackDevice *idev = IPACK_DEVICE(dev);
|
||||
IPackDeviceClass *k = IPACK_DEVICE_GET_CLASS(dev);
|
||||
Error *err = NULL;
|
||||
|
||||
if (k->exit) {
|
||||
k->exit(dev);
|
||||
if (k->unrealize) {
|
||||
k->unrealize(dev, &err);
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
}
|
||||
|
||||
qemu_free_irqs(dev->irq);
|
||||
|
||||
return 0;
|
||||
qemu_free_irqs(idev->irq);
|
||||
}
|
||||
|
||||
static Property ipack_device_props[] = {
|
||||
@@ -75,10 +77,11 @@ static Property ipack_device_props[] = {
|
||||
static void ipack_device_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *k = DEVICE_CLASS(klass);
|
||||
|
||||
set_bit(DEVICE_CATEGORY_INPUT, k->categories);
|
||||
k->bus_type = TYPE_IPACK_BUS;
|
||||
k->init = ipack_device_dev_init;
|
||||
k->exit = ipack_device_dev_exit;
|
||||
k->realize = ipack_device_realize;
|
||||
k->unrealize = ipack_device_unrealize;
|
||||
k->props = ipack_device_props;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
* later version.
|
||||
*/
|
||||
|
||||
#include "ipack.h"
|
||||
#include "hw/ipack/ipack.h"
|
||||
#include "hw/pci/pci.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include <stdio.h>
|
||||
@@ -369,7 +369,7 @@ static const VMStateDescription vmstate_pc87312 = {
|
||||
};
|
||||
|
||||
static Property pc87312_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", PC87312State, iobase, 0x398),
|
||||
DEFINE_PROP_UINT32("iobase", PC87312State, iobase, 0x398),
|
||||
DEFINE_PROP_UINT8("config", PC87312State, config, 1),
|
||||
DEFINE_PROP_END_OF_LIST()
|
||||
};
|
||||
|
||||
@@ -369,8 +369,8 @@ static int vt82c686b_pm_initfn(PCIDevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
i2c_bus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
||||
qemu_irq sci_irq)
|
||||
I2CBus *vt82c686b_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base,
|
||||
qemu_irq sci_irq)
|
||||
{
|
||||
PCIDevice *dev;
|
||||
VT686PMState *s;
|
||||
|
||||
@@ -276,7 +276,7 @@ static void mips_fulong2e_init(QEMUMachineInitArgs *args)
|
||||
qemu_irq *cpu_exit_irq;
|
||||
PCIBus *pci_bus;
|
||||
ISABus *isa_bus;
|
||||
i2c_bus *smbus;
|
||||
I2CBus *smbus;
|
||||
int i;
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
MIPSCPU *cpu;
|
||||
|
||||
@@ -900,7 +900,7 @@ void mips_malta_init(QEMUMachineInitArgs *args)
|
||||
qemu_irq *isa_irq;
|
||||
qemu_irq *cpu_exit_irq;
|
||||
int piix4_devfn;
|
||||
i2c_bus *smbus;
|
||||
I2CBus *smbus;
|
||||
int i;
|
||||
DriveInfo *dinfo;
|
||||
DriveInfo *hd[MAX_IDE_BUS * MAX_IDE_DEVS];
|
||||
|
||||
@@ -249,7 +249,7 @@ static void applesmc_isa_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property applesmc_isa_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", AppleSMCState, iobase,
|
||||
DEFINE_PROP_UINT32("iobase", AppleSMCState, iobase,
|
||||
APPLESMC_DEFAULT_IOBASE),
|
||||
DEFINE_PROP_STRING("osk", AppleSMCState, osk),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
|
||||
@@ -47,8 +47,8 @@ static void debug_exit_realizefn(DeviceState *d, Error **errp)
|
||||
}
|
||||
|
||||
static Property debug_exit_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", ISADebugExitState, iobase, 0x501),
|
||||
DEFINE_PROP_HEX32("iosize", ISADebugExitState, iosize, 0x02),
|
||||
DEFINE_PROP_UINT32("iobase", ISADebugExitState, iobase, 0x501),
|
||||
DEFINE_PROP_UINT32("iosize", ISADebugExitState, iosize, 0x02),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -314,7 +314,7 @@ static int ecc_init1(SysBusDevice *dev)
|
||||
}
|
||||
|
||||
static Property ecc_properties[] = {
|
||||
DEFINE_PROP_HEX32("version", ECCState, version, -1),
|
||||
DEFINE_PROP_UINT32("version", ECCState, version, -1),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ static void isa_ne2000_realizefn(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property ne2000_isa_properties[] = {
|
||||
DEFINE_PROP_HEX32("iobase", ISANE2000State, iobase, 0x300),
|
||||
DEFINE_PROP_UINT32("iobase", ISANE2000State, iobase, 0x300),
|
||||
DEFINE_PROP_UINT32("irq", ISANE2000State, isairq, 9),
|
||||
DEFINE_NIC_PROPERTIES(ISANE2000State, ne2000.c),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
|
||||
@@ -584,8 +584,8 @@ static void fw_cfg_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
|
||||
static Property fw_cfg_properties[] = {
|
||||
DEFINE_PROP_HEX32("ctl_iobase", FWCfgState, ctl_iobase, -1),
|
||||
DEFINE_PROP_HEX32("data_iobase", FWCfgState, data_iobase, -1),
|
||||
DEFINE_PROP_UINT32("ctl_iobase", FWCfgState, ctl_iobase, -1),
|
||||
DEFINE_PROP_UINT32("data_iobase", FWCfgState, data_iobase, -1),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ static PCIDevice *qemu_pci_hot_add_nic(Monitor *mon,
|
||||
qemu_opt_set(opts, "type", "nic");
|
||||
|
||||
ret = net_client_init(opts, 0, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
error_free(local_err);
|
||||
return NULL;
|
||||
@@ -322,7 +322,7 @@ static int pci_device_hot_remove(Monitor *mon, const char *pci_addr)
|
||||
}
|
||||
|
||||
qdev_unplug(&d->qdev, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
if (local_err) {
|
||||
monitor_printf(mon, "%s\n", error_get_pretty(local_err));
|
||||
error_free(local_err);
|
||||
return -1;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user