Compare commits
180 Commits
v2.0.2
...
pull-vga-2
Author | SHA1 | Date | |
---|---|---|---|
|
a889bc2bb2 | ||
|
0850fd583f | ||
|
63e3e24db2 | ||
|
e2bbfc8ee2 | ||
|
411f491e0a | ||
|
7931b05987 | ||
|
0e96643c98 | ||
|
ad600a4d49 | ||
|
ba3627ec38 | ||
|
4b8abfb78e | ||
|
370e681629 | ||
|
840a178c94 | ||
|
9b17031ac4 | ||
|
ac1307abfe | ||
|
409951f552 | ||
|
90d9d30152 | ||
|
f2d953ec31 | ||
|
9ffe333276 | ||
|
98522f63f4 | ||
|
5ff679b47d | ||
|
636ea3708c | ||
|
acd7fdc6d8 | ||
|
b8afb520e4 | ||
|
4ab9dab5b9 | ||
|
9ce10c0bdc | ||
|
da15ee5134 | ||
|
1dd3a44753 | ||
|
54db38a479 | ||
|
02eb19d0ec | ||
|
662deb908f | ||
|
f46fc4e6a9 | ||
|
df9ebea53e | ||
|
671c835b7d | ||
|
4b304cfae1 | ||
|
1194dcba22 | ||
|
170bf9315b | ||
|
f6c6afc1d4 | ||
|
d998e555d2 | ||
|
1976cccec8 | ||
|
50c5c4d125 | ||
|
20022fa15f | ||
|
ad5171dbd4 | ||
|
b36dc67b95 | ||
|
9d85d55732 | ||
|
2300aed15d | ||
|
e40cdb0e6e | ||
|
968fc24d84 | ||
|
423d00c857 | ||
|
ee25595f01 | ||
|
86e117724a | ||
|
d61ce900b9 | ||
|
1634df567d | ||
|
b321afbefd | ||
|
0374f5089a | ||
|
3bf16cb31a | ||
|
4bdd547aaa | ||
|
af9fe31070 | ||
|
1f91f39219 | ||
|
b672cf66c3 | ||
|
4c186ee2cf | ||
|
dcf91778ca | ||
|
2d03b49c3f | ||
|
e44a90c596 | ||
|
33bbd75a7c | ||
|
5538937368 | ||
|
6954a1cd97 | ||
|
15e3611e1c | ||
|
db302f8f93 | ||
|
6619bc5c55 | ||
|
103db49a10 | ||
|
286226a479 | ||
|
a63f9f85e3 | ||
|
323a8771cf | ||
|
2237094d96 | ||
|
1c70aa6264 | ||
|
f727d0e621 | ||
|
b5cde1da0a | ||
|
177311157c | ||
|
7633378d5f | ||
|
c29f9a0a29 | ||
|
f318cec6ad | ||
|
377a44ec8f | ||
|
3933443e38 | ||
|
19525524a7 | ||
|
f32cdad55d | ||
|
9449fdf61f | ||
|
00a29f3ddc | ||
|
85acfa9c38 | ||
|
1090b9c6cc | ||
|
2eef0bf821 | ||
|
014406b510 | ||
|
0ff644a786 | ||
|
cb1fa941c1 | ||
|
a50c0f5133 | ||
|
52e60cdd34 | ||
|
2f2a00aec9 | ||
|
a65f1de982 | ||
|
f502cfc207 | ||
|
a0618a1990 | ||
|
6cd8a2649a | ||
|
7e09797c29 | ||
|
aca3f40b37 | ||
|
9225d739e7 | ||
|
2c8dd31863 | ||
|
2c7ffc414d | ||
|
90e496386f | ||
|
8c6afa6ab1 | ||
|
00892383c9 | ||
|
d4a2dc675b | ||
|
8bcbf37caa | ||
|
abf1172fc6 | ||
|
c2b820fe58 | ||
|
ccd380876b | ||
|
c6138aabfb | ||
|
5149e557d7 | ||
|
06ef8604e9 | ||
|
39acc64741 | ||
|
e566be049a | ||
|
8f811b9a4a | ||
|
a9e05a1ceb | ||
|
0e154fe92c | ||
|
ef3765cb95 | ||
|
e8d8fef48f | ||
|
6580935246 | ||
|
76bff4f82f | ||
|
e20b8c04a3 | ||
|
8b0190bbde | ||
|
f477ed3c11 | ||
|
cd2754addc | ||
|
3d045dbca5 | ||
|
baee04abba | ||
|
b144be9e06 | ||
|
5e5863ecf1 | ||
|
9a734d64f9 | ||
|
9a8fa1bdad | ||
|
83ebb7cd01 | ||
|
42774a56ec | ||
|
958683482c | ||
|
cd2d46fd21 | ||
|
595b8fdd54 | ||
|
a4af30447b | ||
|
46010969f3 | ||
|
c67b67e511 | ||
|
1eaa1da7e4 | ||
|
8f56ced8aa | ||
|
89fe090bb3 | ||
|
6b88b37c0e | ||
|
075b8ddb9b | ||
|
de4d3555fa | ||
|
3bd67b7dab | ||
|
db4a16458c | ||
|
194cfb43d5 | ||
|
64f45e4991 | ||
|
5238c88657 | ||
|
67debe3ae5 | ||
|
b825025f08 | ||
|
a056c9faa4 | ||
|
3d4299f425 | ||
|
dc73dfd4bc | ||
|
edd8824cd4 | ||
|
e81864a109 | ||
|
de61d14fa7 | ||
|
667b1cdd4e | ||
|
9e4177ad6d | ||
|
dc0c8aaf2c | ||
|
ae7ab46aa8 | ||
|
6f4724672c | ||
|
38d195aa05 | ||
|
95f72aa90a | ||
|
d82b78e48b | ||
|
3d9e69a238 | ||
|
cae1f6f3e6 | ||
|
81d8a5ee19 | ||
|
c6e310d938 | ||
|
d8918df577 | ||
|
4ec4f0bd56 | ||
|
dfeb5fe770 | ||
|
929f8b5550 | ||
|
8bf56493f1 | ||
|
661f7fa4b0 |
104
arch_init.c
104
arch_init.c
@@ -992,68 +992,70 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
|
||||
{
|
||||
ram_addr_t addr;
|
||||
int flags, ret = 0;
|
||||
int error;
|
||||
static uint64_t seq_iter;
|
||||
|
||||
seq_iter++;
|
||||
|
||||
if (version_id != 4) {
|
||||
ret = -EINVAL;
|
||||
if (version_id < 4 || version_id > 4) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
while (!ret) {
|
||||
do {
|
||||
addr = qemu_get_be64(f);
|
||||
|
||||
flags = addr & ~TARGET_PAGE_MASK;
|
||||
addr &= TARGET_PAGE_MASK;
|
||||
|
||||
if (flags & RAM_SAVE_FLAG_MEM_SIZE) {
|
||||
/* Synchronize RAM block list */
|
||||
char id[256];
|
||||
ram_addr_t length;
|
||||
ram_addr_t total_ram_bytes = addr;
|
||||
if (version_id == 4) {
|
||||
/* Synchronize RAM block list */
|
||||
char id[256];
|
||||
ram_addr_t length;
|
||||
ram_addr_t total_ram_bytes = addr;
|
||||
|
||||
while (total_ram_bytes) {
|
||||
RAMBlock *block;
|
||||
uint8_t len;
|
||||
while (total_ram_bytes) {
|
||||
RAMBlock *block;
|
||||
uint8_t len;
|
||||
|
||||
len = qemu_get_byte(f);
|
||||
qemu_get_buffer(f, (uint8_t *)id, len);
|
||||
id[len] = 0;
|
||||
length = qemu_get_be64(f);
|
||||
len = qemu_get_byte(f);
|
||||
qemu_get_buffer(f, (uint8_t *)id, len);
|
||||
id[len] = 0;
|
||||
length = qemu_get_be64(f);
|
||||
|
||||
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
|
||||
if (!strncmp(id, block->idstr, sizeof(id))) {
|
||||
if (block->length != length) {
|
||||
fprintf(stderr,
|
||||
"Length mismatch: %s: " RAM_ADDR_FMT
|
||||
" in != " RAM_ADDR_FMT "\n", id, length,
|
||||
block->length);
|
||||
ret = -EINVAL;
|
||||
QTAILQ_FOREACH(block, &ram_list.blocks, next) {
|
||||
if (!strncmp(id, block->idstr, sizeof(id))) {
|
||||
if (block->length != length) {
|
||||
fprintf(stderr,
|
||||
"Length mismatch: %s: " RAM_ADDR_FMT
|
||||
" in != " RAM_ADDR_FMT "\n", id, length,
|
||||
block->length);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!block) {
|
||||
fprintf(stderr, "Unknown ramblock \"%s\", cannot "
|
||||
"accept migration\n", id);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
if (ret) {
|
||||
break;
|
||||
}
|
||||
if (!block) {
|
||||
fprintf(stderr, "Unknown ramblock \"%s\", cannot "
|
||||
"accept migration\n", id);
|
||||
ret = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
total_ram_bytes -= length;
|
||||
total_ram_bytes -= length;
|
||||
}
|
||||
}
|
||||
} else if (flags & RAM_SAVE_FLAG_COMPRESS) {
|
||||
}
|
||||
|
||||
if (flags & RAM_SAVE_FLAG_COMPRESS) {
|
||||
void *host;
|
||||
uint8_t ch;
|
||||
|
||||
host = host_from_stream_offset(f, addr, flags);
|
||||
if (!host) {
|
||||
error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ch = qemu_get_byte(f);
|
||||
@@ -1063,39 +1065,31 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
|
||||
|
||||
host = host_from_stream_offset(f, addr, flags);
|
||||
if (!host) {
|
||||
error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
qemu_get_buffer(f, host, TARGET_PAGE_SIZE);
|
||||
} else if (flags & RAM_SAVE_FLAG_XBZRLE) {
|
||||
void *host = host_from_stream_offset(f, addr, flags);
|
||||
if (!host) {
|
||||
error_report("Illegal RAM offset " RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (load_xbzrle(f, addr, host) < 0) {
|
||||
error_report("Failed to decompress XBZRLE page at "
|
||||
RAM_ADDR_FMT, addr);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
goto done;
|
||||
}
|
||||
} else if (flags & RAM_SAVE_FLAG_HOOK) {
|
||||
ram_control_load_hook(f, flags);
|
||||
} else if (flags & RAM_SAVE_FLAG_EOS) {
|
||||
/* normal exit */
|
||||
break;
|
||||
} else {
|
||||
error_report("Unknown migration flags: %#x", flags);
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
ret = qemu_file_get_error(f);
|
||||
}
|
||||
error = qemu_file_get_error(f);
|
||||
if (error) {
|
||||
ret = error;
|
||||
goto done;
|
||||
}
|
||||
} while (!(flags & RAM_SAVE_FLAG_EOS));
|
||||
|
||||
done:
|
||||
DPRINTF("Completed load of VM with exit code %d seq iteration "
|
||||
"%" PRIu64 "\n", ret, seq_iter);
|
||||
return ret;
|
||||
|
14
async.c
14
async.c
@@ -117,21 +117,15 @@ void qemu_bh_schedule_idle(QEMUBH *bh)
|
||||
|
||||
void qemu_bh_schedule(QEMUBH *bh)
|
||||
{
|
||||
AioContext *ctx;
|
||||
|
||||
if (bh->scheduled)
|
||||
return;
|
||||
ctx = bh->ctx;
|
||||
bh->idle = 0;
|
||||
/* Make sure that:
|
||||
* 1. idle & any writes needed by the callback are done before the
|
||||
* locations are read in the aio_bh_poll.
|
||||
* 2. ctx is loaded before scheduled is set and the callback has a chance
|
||||
* to execute.
|
||||
/* Make sure that idle & any writes needed by the callback are done
|
||||
* before the locations are read in the aio_bh_poll.
|
||||
*/
|
||||
smp_mb();
|
||||
smp_wmb();
|
||||
bh->scheduled = 1;
|
||||
aio_notify(ctx);
|
||||
aio_notify(bh->ctx);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -310,13 +310,28 @@ static int mig_save_device_bulk(QEMUFile *f, BlkMigDevState *bmds)
|
||||
|
||||
/* Called with iothread lock taken. */
|
||||
|
||||
static void set_dirty_tracking(void)
|
||||
static int set_dirty_tracking(void)
|
||||
{
|
||||
BlkMigDevState *bmds;
|
||||
int ret;
|
||||
|
||||
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
|
||||
bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE);
|
||||
bmds->dirty_bitmap = bdrv_create_dirty_bitmap(bmds->bs, BLOCK_SIZE,
|
||||
NULL);
|
||||
if (!bmds->dirty_bitmap) {
|
||||
ret = -errno;
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
||||
fail:
|
||||
QSIMPLEQ_FOREACH(bmds, &block_mig_state.bmds_list, entry) {
|
||||
if (bmds->dirty_bitmap) {
|
||||
bdrv_release_dirty_bitmap(bmds->bs, bmds->dirty_bitmap);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void unset_dirty_tracking(void)
|
||||
@@ -611,10 +626,17 @@ static int block_save_setup(QEMUFile *f, void *opaque)
|
||||
block_mig_state.submitted, block_mig_state.transferred);
|
||||
|
||||
qemu_mutex_lock_iothread();
|
||||
init_blk_migration(f);
|
||||
|
||||
/* start track dirty blocks */
|
||||
set_dirty_tracking();
|
||||
ret = set_dirty_tracking();
|
||||
|
||||
if (ret) {
|
||||
qemu_mutex_unlock_iothread();
|
||||
return ret;
|
||||
}
|
||||
|
||||
init_blk_migration(f);
|
||||
|
||||
qemu_mutex_unlock_iothread();
|
||||
|
||||
ret = flush_blks(f);
|
||||
|
103
block.c
103
block.c
@@ -332,10 +332,21 @@ void bdrv_register(BlockDriver *bdrv)
|
||||
}
|
||||
|
||||
/* create a new block device (by default it is empty) */
|
||||
BlockDriverState *bdrv_new(const char *device_name)
|
||||
BlockDriverState *bdrv_new(const char *device_name, Error **errp)
|
||||
{
|
||||
BlockDriverState *bs;
|
||||
|
||||
if (bdrv_find(device_name)) {
|
||||
error_setg(errp, "Device with id '%s' already exists",
|
||||
device_name);
|
||||
return NULL;
|
||||
}
|
||||
if (bdrv_find_node(device_name)) {
|
||||
error_setg(errp, "Device with node-name '%s' already exists",
|
||||
device_name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bs = g_malloc0(sizeof(BlockDriverState));
|
||||
QLIST_INIT(&bs->dirty_bitmaps);
|
||||
pstrcpy(bs->device_name, sizeof(bs->device_name), device_name);
|
||||
@@ -788,38 +799,36 @@ static int bdrv_open_flags(BlockDriverState *bs, int flags)
|
||||
return open_flags;
|
||||
}
|
||||
|
||||
static int bdrv_assign_node_name(BlockDriverState *bs,
|
||||
const char *node_name,
|
||||
Error **errp)
|
||||
static void bdrv_assign_node_name(BlockDriverState *bs,
|
||||
const char *node_name,
|
||||
Error **errp)
|
||||
{
|
||||
if (!node_name) {
|
||||
return 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/* empty string node name is invalid */
|
||||
if (node_name[0] == '\0') {
|
||||
error_setg(errp, "Empty node name");
|
||||
return -EINVAL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
return;
|
||||
}
|
||||
|
||||
/* takes care of avoiding duplicates node names */
|
||||
if (bdrv_find_node(node_name)) {
|
||||
error_setg(errp, "Duplicate node name");
|
||||
return -EINVAL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* copy node name into the bs and insert it into the graph list */
|
||||
pstrcpy(bs->node_name, sizeof(bs->node_name), node_name);
|
||||
QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs, node_list);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -854,9 +863,10 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
|
||||
trace_bdrv_open_common(bs, filename ?: "", flags, drv->format_name);
|
||||
|
||||
node_name = qdict_get_try_str(options, "node-name");
|
||||
ret = bdrv_assign_node_name(bs, node_name, errp);
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
bdrv_assign_node_name(bs, node_name, &local_err);
|
||||
if (error_is_set(&local_err)) {
|
||||
error_propagate(errp, local_err);
|
||||
return -EINVAL;
|
||||
}
|
||||
qdict_del(options, "node-name");
|
||||
|
||||
@@ -1058,14 +1068,14 @@ fail:
|
||||
*/
|
||||
int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
||||
{
|
||||
char *backing_filename = g_malloc0(PATH_MAX);
|
||||
int back_flags, ret = 0;
|
||||
char backing_filename[PATH_MAX];
|
||||
int back_flags, ret;
|
||||
BlockDriver *back_drv = NULL;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (bs->backing_hd != NULL) {
|
||||
QDECREF(options);
|
||||
goto free_exit;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* NULL means an empty set of options */
|
||||
@@ -1078,9 +1088,10 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
||||
backing_filename[0] = '\0';
|
||||
} else if (bs->backing_file[0] == '\0' && qdict_size(options) == 0) {
|
||||
QDECREF(options);
|
||||
goto free_exit;
|
||||
return 0;
|
||||
} else {
|
||||
bdrv_get_full_backing_filename(bs, backing_filename, PATH_MAX);
|
||||
bdrv_get_full_backing_filename(bs, backing_filename,
|
||||
sizeof(backing_filename));
|
||||
}
|
||||
|
||||
if (bs->backing_format[0] != '\0') {
|
||||
@@ -1101,7 +1112,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
||||
error_setg(errp, "Could not open backing file: %s",
|
||||
error_get_pretty(local_err));
|
||||
error_free(local_err);
|
||||
goto free_exit;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (bs->backing_hd->file) {
|
||||
@@ -1112,9 +1123,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
|
||||
/* Recalculate the BlockLimits with the backing file */
|
||||
bdrv_refresh_limits(bs);
|
||||
|
||||
free_exit:
|
||||
g_free(backing_filename);
|
||||
return ret;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1158,7 +1167,6 @@ int bdrv_open_image(BlockDriverState **pbs, const char *filename,
|
||||
bdref_key);
|
||||
ret = -EINVAL;
|
||||
}
|
||||
QDECREF(image_options);
|
||||
goto done;
|
||||
}
|
||||
|
||||
@@ -1172,7 +1180,8 @@ done:
|
||||
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
||||
{
|
||||
/* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
|
||||
char *tmp_filename = g_malloc0(PATH_MAX + 1);
|
||||
char tmp_filename[PATH_MAX + 1];
|
||||
|
||||
int64_t total_size;
|
||||
BlockDriver *bdrv_qcow2;
|
||||
QEMUOptionParameter *create_options;
|
||||
@@ -1188,15 +1197,15 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
||||
total_size = bdrv_getlength(bs);
|
||||
if (total_size < 0) {
|
||||
error_setg_errno(errp, -total_size, "Could not get image size");
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
total_size &= BDRV_SECTOR_MASK;
|
||||
|
||||
/* Create the temporary image */
|
||||
ret = get_tmp_filename(tmp_filename, PATH_MAX + 1);
|
||||
ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
|
||||
if (ret < 0) {
|
||||
error_setg_errno(errp, -ret, "Could not get temporary filename");
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
bdrv_qcow2 = bdrv_find_format("qcow2");
|
||||
@@ -1212,7 +1221,7 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
||||
"'%s': %s", tmp_filename,
|
||||
error_get_pretty(local_err));
|
||||
error_free(local_err);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Prepare a new options QDict for the temporary file */
|
||||
@@ -1222,20 +1231,17 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
|
||||
qdict_put(snapshot_options, "file.filename",
|
||||
qstring_from_str(tmp_filename));
|
||||
|
||||
bs_snapshot = bdrv_new("");
|
||||
bs_snapshot = bdrv_new("", &error_abort);
|
||||
bs_snapshot->is_temporary = 1;
|
||||
|
||||
ret = bdrv_open(&bs_snapshot, NULL, NULL, snapshot_options,
|
||||
bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err);
|
||||
if (ret < 0) {
|
||||
error_propagate(errp, local_err);
|
||||
goto out;
|
||||
return;
|
||||
}
|
||||
|
||||
bdrv_append(bs_snapshot, bs);
|
||||
|
||||
out:
|
||||
g_free(tmp_filename);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1292,7 +1298,7 @@ int bdrv_open(BlockDriverState **pbs, const char *filename,
|
||||
if (*pbs) {
|
||||
bs = *pbs;
|
||||
} else {
|
||||
bs = bdrv_new("");
|
||||
bs = bdrv_new("", &error_abort);
|
||||
}
|
||||
|
||||
/* NULL means an empty set of options */
|
||||
@@ -2585,6 +2591,10 @@ static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,
|
||||
{
|
||||
int64_t len;
|
||||
|
||||
if (size > INT_MAX) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
if (!bdrv_is_inserted(bs))
|
||||
return -ENOMEDIUM;
|
||||
|
||||
@@ -2605,7 +2615,7 @@ static int bdrv_check_byte_request(BlockDriverState *bs, int64_t offset,
|
||||
static int bdrv_check_request(BlockDriverState *bs, int64_t sector_num,
|
||||
int nb_sectors)
|
||||
{
|
||||
if (nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
|
||||
if (nb_sectors < 0 || nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
@@ -2690,6 +2700,10 @@ static int bdrv_rw_co(BlockDriverState *bs, int64_t sector_num, uint8_t *buf,
|
||||
.iov_len = nb_sectors * BDRV_SECTOR_SIZE,
|
||||
};
|
||||
|
||||
if (nb_sectors < 0 || nb_sectors > INT_MAX / BDRV_SECTOR_SIZE) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
qemu_iovec_init_external(&qiov, &iov, 1);
|
||||
return bdrv_prwv_co(bs, sector_num << BDRV_SECTOR_BITS,
|
||||
&qiov, is_write, flags);
|
||||
@@ -2745,10 +2759,16 @@ int bdrv_write_zeroes(BlockDriverState *bs, int64_t sector_num,
|
||||
*/
|
||||
int bdrv_make_zero(BlockDriverState *bs, BdrvRequestFlags flags)
|
||||
{
|
||||
int64_t target_size = bdrv_getlength(bs) / BDRV_SECTOR_SIZE;
|
||||
int64_t target_size;
|
||||
int64_t ret, nb_sectors, sector_num = 0;
|
||||
int n;
|
||||
|
||||
target_size = bdrv_getlength(bs);
|
||||
if (target_size < 0) {
|
||||
return target_size;
|
||||
}
|
||||
target_size /= BDRV_SECTOR_SIZE;
|
||||
|
||||
for (;;) {
|
||||
nb_sectors = target_size - sector_num;
|
||||
if (nb_sectors <= 0) {
|
||||
@@ -5100,7 +5120,8 @@ bool bdrv_qiov_is_aligned(BlockDriverState *bs, QEMUIOVector *qiov)
|
||||
return true;
|
||||
}
|
||||
|
||||
BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity)
|
||||
BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity,
|
||||
Error **errp)
|
||||
{
|
||||
int64_t bitmap_size;
|
||||
BdrvDirtyBitmap *bitmap;
|
||||
@@ -5109,7 +5130,13 @@ BdrvDirtyBitmap *bdrv_create_dirty_bitmap(BlockDriverState *bs, int granularity)
|
||||
|
||||
granularity >>= BDRV_SECTOR_BITS;
|
||||
assert(granularity);
|
||||
bitmap_size = (bdrv_getlength(bs) >> BDRV_SECTOR_BITS);
|
||||
bitmap_size = bdrv_getlength(bs);
|
||||
if (bitmap_size < 0) {
|
||||
error_setg_errno(errp, -bitmap_size, "could not get length of device");
|
||||
errno = -bitmap_size;
|
||||
return NULL;
|
||||
}
|
||||
bitmap_size >>= BDRV_SECTOR_BITS;
|
||||
bitmap = g_malloc0(sizeof(BdrvDirtyBitmap));
|
||||
bitmap->bitmap = hbitmap_alloc(bitmap_size, ffs(granularity) - 1);
|
||||
QLIST_INSERT_HEAD(&bs->dirty_bitmaps, bitmap, list);
|
||||
|
@@ -72,7 +72,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
}
|
||||
s->block_size = be32_to_cpu(s->block_size);
|
||||
if (s->block_size % 512) {
|
||||
error_setg(errp, "block_size %u must be a multiple of 512",
|
||||
error_setg(errp, "block_size %" PRIu32 " must be a multiple of 512",
|
||||
s->block_size);
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -86,7 +86,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
* need a buffer this big.
|
||||
*/
|
||||
if (s->block_size > MAX_BLOCK_SIZE) {
|
||||
error_setg(errp, "block_size %u must be %u MB or less",
|
||||
error_setg(errp, "block_size %" PRIu32 " must be %u MB or less",
|
||||
s->block_size,
|
||||
MAX_BLOCK_SIZE / (1024 * 1024));
|
||||
return -EINVAL;
|
||||
@@ -101,7 +101,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
/* read offsets */
|
||||
if (s->n_blocks > (UINT32_MAX - 1) / sizeof(uint64_t)) {
|
||||
/* Prevent integer overflow */
|
||||
error_setg(errp, "n_blocks %u must be %zu or less",
|
||||
error_setg(errp, "n_blocks %" PRIu32 " must be %zu or less",
|
||||
s->n_blocks,
|
||||
(UINT32_MAX - 1) / sizeof(uint64_t));
|
||||
return -EINVAL;
|
||||
@@ -133,7 +133,7 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
if (s->offsets[i] < s->offsets[i - 1]) {
|
||||
error_setg(errp, "offsets not monotonically increasing at "
|
||||
"index %u, image file is corrupt", i);
|
||||
"index %" PRIu32 ", image file is corrupt", i);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
@@ -146,8 +146,8 @@ static int cloop_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
* ridiculous s->compressed_block allocation.
|
||||
*/
|
||||
if (size > 2 * MAX_BLOCK_SIZE) {
|
||||
error_setg(errp, "invalid compressed block size at index %u, "
|
||||
"image file is corrupt", i);
|
||||
error_setg(errp, "invalid compressed block size at index %" PRIu32
|
||||
", image file is corrupt", i);
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
@@ -543,7 +543,7 @@ static int curl_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
return 0;
|
||||
|
||||
out:
|
||||
fprintf(stderr, "CURL: Error opening file: %s\n", state->errmsg);
|
||||
error_setg(errp, "CURL: Error opening file: %s", state->errmsg);
|
||||
curl_easy_cleanup(state->curl);
|
||||
state->curl = NULL;
|
||||
out_noclean:
|
||||
|
@@ -1401,7 +1401,7 @@ static int iscsi_create(const char *filename, QEMUOptionParameter *options,
|
||||
IscsiLun *iscsilun = NULL;
|
||||
QDict *bs_options;
|
||||
|
||||
bs = bdrv_new("");
|
||||
bs = bdrv_new("", &error_abort);
|
||||
|
||||
/* Read out options */
|
||||
while (options && options->name) {
|
||||
|
@@ -259,11 +259,9 @@ static uint64_t coroutine_fn mirror_iteration(MirrorBlockJob *s)
|
||||
next_sector = sector_num;
|
||||
while (nb_chunks-- > 0) {
|
||||
MirrorBuffer *buf = QSIMPLEQ_FIRST(&s->buf_free);
|
||||
size_t remaining = (nb_sectors * BDRV_SECTOR_SIZE) - op->qiov.size;
|
||||
|
||||
QSIMPLEQ_REMOVE_HEAD(&s->buf_free, next);
|
||||
s->buf_free_count--;
|
||||
qemu_iovec_add(&op->qiov, buf, MIN(s->granularity, remaining));
|
||||
qemu_iovec_add(&op->qiov, buf, s->granularity);
|
||||
|
||||
/* Advance the HBitmapIter in parallel, so that we do not examine
|
||||
* the same sector twice.
|
||||
@@ -326,18 +324,9 @@ static void coroutine_fn mirror_run(void *opaque)
|
||||
}
|
||||
|
||||
s->common.len = bdrv_getlength(bs);
|
||||
if (s->common.len < 0) {
|
||||
ret = s->common.len;
|
||||
goto immediate_exit;
|
||||
} else if (s->common.len == 0) {
|
||||
/* Report BLOCK_JOB_READY and wait for complete. */
|
||||
block_job_ready(&s->common);
|
||||
s->synced = true;
|
||||
while (!block_job_is_cancelled(&s->common) && !s->should_complete) {
|
||||
block_job_yield(&s->common);
|
||||
}
|
||||
s->common.cancelled = false;
|
||||
goto immediate_exit;
|
||||
if (s->common.len <= 0) {
|
||||
block_job_completed(&s->common, s->common.len);
|
||||
return;
|
||||
}
|
||||
|
||||
length = (bdrv_getlength(bs) + s->granularity - 1) / s->granularity;
|
||||
@@ -616,7 +605,10 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target,
|
||||
s->granularity = granularity;
|
||||
s->buf_size = MAX(buf_size, granularity);
|
||||
|
||||
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity);
|
||||
s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, errp);
|
||||
if (!s->dirty_bitmap) {
|
||||
return;
|
||||
}
|
||||
bdrv_set_enable_write_cache(s->target, true);
|
||||
bdrv_set_on_error(s->target, on_target_error, on_target_error);
|
||||
bdrv_iostatus_enable(s->target);
|
||||
|
@@ -474,7 +474,6 @@ static void dump_qobject(fprintf_function func_fprintf, void *f,
|
||||
case QTYPE_QERROR: {
|
||||
QString *value = qerror_human((QError *)obj);
|
||||
func_fprintf(f, "%s", qstring_get_str(value));
|
||||
QDECREF(value);
|
||||
break;
|
||||
}
|
||||
case QTYPE_NONE:
|
||||
|
44
block/qcow.c
44
block/qcow.c
@@ -48,10 +48,9 @@ typedef struct QCowHeader {
|
||||
uint64_t size; /* in bytes */
|
||||
uint8_t cluster_bits;
|
||||
uint8_t l2_bits;
|
||||
uint16_t padding;
|
||||
uint32_t crypt_method;
|
||||
uint64_t l1_table_offset;
|
||||
} QEMU_PACKED QCowHeader;
|
||||
} QCowHeader;
|
||||
|
||||
#define L2_CACHE_SIZE 16
|
||||
|
||||
@@ -61,7 +60,7 @@ typedef struct BDRVQcowState {
|
||||
int cluster_sectors;
|
||||
int l2_bits;
|
||||
int l2_size;
|
||||
unsigned int l1_size;
|
||||
int l1_size;
|
||||
uint64_t cluster_offset_mask;
|
||||
uint64_t l1_table_offset;
|
||||
uint64_t *l1_table;
|
||||
@@ -97,8 +96,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
Error **errp)
|
||||
{
|
||||
BDRVQcowState *s = bs->opaque;
|
||||
unsigned int len, i, shift;
|
||||
int ret;
|
||||
int len, i, shift, ret;
|
||||
QCowHeader header;
|
||||
|
||||
ret = bdrv_pread(bs->file, 0, &header, sizeof(header));
|
||||
@@ -128,25 +126,11 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (header.size <= 1) {
|
||||
error_setg(errp, "Image size is too small (must be at least 2 bytes)");
|
||||
if (header.size <= 1 || header.cluster_bits < 9) {
|
||||
error_setg(errp, "invalid value in qcow header");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
if (header.cluster_bits < 9 || header.cluster_bits > 16) {
|
||||
error_setg(errp, "Cluster size must be between 512 and 64k");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* l2_bits specifies number of entries; storing a uint64_t in each entry,
|
||||
* so bytes = num_entries << 3. */
|
||||
if (header.l2_bits < 9 - 3 || header.l2_bits > 16 - 3) {
|
||||
error_setg(errp, "L2 table size must be between 512 and 64k");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (header.crypt_method > QCOW_CRYPT_AES) {
|
||||
error_setg(errp, "invalid encryption method in qcow header");
|
||||
ret = -EINVAL;
|
||||
@@ -166,19 +150,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
|
||||
/* read the level 1 table */
|
||||
shift = s->cluster_bits + s->l2_bits;
|
||||
if (header.size > UINT64_MAX - (1LL << shift)) {
|
||||
error_setg(errp, "Image too large");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
} else {
|
||||
uint64_t l1_size = (header.size + (1LL << shift) - 1) >> shift;
|
||||
if (l1_size > INT_MAX / sizeof(uint64_t)) {
|
||||
error_setg(errp, "Image too large");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
}
|
||||
s->l1_size = l1_size;
|
||||
}
|
||||
s->l1_size = (header.size + (1LL << shift) - 1) >> shift;
|
||||
|
||||
s->l1_table_offset = header.l1_table_offset;
|
||||
s->l1_table = g_malloc(s->l1_size * sizeof(uint64_t));
|
||||
@@ -202,9 +174,7 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
||||
if (header.backing_file_offset != 0) {
|
||||
len = header.backing_file_size;
|
||||
if (len > 1023) {
|
||||
error_setg(errp, "Backing file name too long");
|
||||
ret = -EINVAL;
|
||||
goto fail;
|
||||
len = 1023;
|
||||
}
|
||||
ret = bdrv_pread(bs->file, header.backing_file_offset,
|
||||
bs->backing_file, len);
|
||||
|
@@ -1306,7 +1306,6 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
|
||||
options = qdict_clone_shallow(bs->options);
|
||||
|
||||
ret = qcow2_open(bs, options, flags, &local_err);
|
||||
QDECREF(options);
|
||||
if (local_err) {
|
||||
error_setg(errp, "Could not reopen qcow2 layer: %s",
|
||||
error_get_pretty(local_err));
|
||||
@@ -1317,6 +1316,8 @@ static void qcow2_invalidate_cache(BlockDriverState *bs, Error **errp)
|
||||
return;
|
||||
}
|
||||
|
||||
QDECREF(options);
|
||||
|
||||
if (crypt_method) {
|
||||
s->crypt_method = crypt_method;
|
||||
memcpy(&s->aes_encrypt_key, &aes_encrypt_key, sizeof(aes_encrypt_key));
|
||||
|
16
block/qed.c
16
block/qed.c
@@ -650,19 +650,21 @@ static int bdrv_qed_create(const char *filename, QEMUOptionParameter *options,
|
||||
}
|
||||
|
||||
if (!qed_is_cluster_size_valid(cluster_size)) {
|
||||
fprintf(stderr, "QED cluster size must be within range [%u, %u] and power of 2\n",
|
||||
QED_MIN_CLUSTER_SIZE, QED_MAX_CLUSTER_SIZE);
|
||||
error_setg(errp, "QED cluster size must be within range [%u, %u] "
|
||||
"and power of 2",
|
||||
QED_MIN_CLUSTER_SIZE, QED_MAX_CLUSTER_SIZE);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!qed_is_table_size_valid(table_size)) {
|
||||
fprintf(stderr, "QED table size must be within range [%u, %u] and power of 2\n",
|
||||
QED_MIN_TABLE_SIZE, QED_MAX_TABLE_SIZE);
|
||||
error_setg(errp, "QED table size must be within range [%u, %u] "
|
||||
"and power of 2",
|
||||
QED_MIN_TABLE_SIZE, QED_MAX_TABLE_SIZE);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!qed_is_image_size_valid(image_size, cluster_size, table_size)) {
|
||||
fprintf(stderr, "QED image size must be a non-zero multiple of "
|
||||
"cluster size and less than %" PRIu64 " bytes\n",
|
||||
qed_max_image_size(cluster_size, table_size));
|
||||
error_setg(errp, "QED image size must be a non-zero multiple of "
|
||||
"cluster size and less than %" PRIu64 " bytes",
|
||||
qed_max_image_size(cluster_size, table_size));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
@@ -2149,7 +2149,6 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
||||
strncpy(s->inode.tag, sn_info->name, sizeof(s->inode.tag));
|
||||
/* we don't need to update entire object */
|
||||
datalen = SD_INODE_SIZE - sizeof(s->inode.data_vdi_id);
|
||||
inode = g_malloc(datalen);
|
||||
|
||||
/* refresh inode. */
|
||||
fd = connect_to_sdog(s);
|
||||
@@ -2172,6 +2171,8 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
inode = (SheepdogInode *)g_malloc(datalen);
|
||||
|
||||
ret = read_object(fd, (char *)inode, vid_to_vdi_oid(new_vid),
|
||||
s->inode.nr_copies, datalen, 0, s->cache_flags);
|
||||
|
||||
@@ -2185,7 +2186,6 @@ static int sd_snapshot_create(BlockDriverState *bs, QEMUSnapshotInfo *sn_info)
|
||||
s->inode.name, s->inode.snap_id, s->inode.vdi_id);
|
||||
|
||||
cleanup:
|
||||
g_free(inode);
|
||||
closesocket(fd);
|
||||
return ret;
|
||||
}
|
||||
|
23
block/vmdk.c
23
block/vmdk.c
@@ -262,7 +262,7 @@ static uint32_t vmdk_read_cid(BlockDriverState *bs, int parent)
|
||||
p_name = strstr(desc, cid_str);
|
||||
if (p_name != NULL) {
|
||||
p_name += cid_str_size;
|
||||
sscanf(p_name, "%x", &cid);
|
||||
sscanf(p_name, "%" SCNx32, &cid);
|
||||
}
|
||||
|
||||
return cid;
|
||||
@@ -290,7 +290,7 @@ static int vmdk_write_cid(BlockDriverState *bs, uint32_t cid)
|
||||
p_name = strstr(desc, "CID");
|
||||
if (p_name != NULL) {
|
||||
p_name += sizeof("CID");
|
||||
snprintf(p_name, sizeof(desc) - (p_name - desc), "%x\n", cid);
|
||||
snprintf(p_name, sizeof(desc) - (p_name - desc), "%" PRIx32 "\n", cid);
|
||||
pstrcat(desc, sizeof(desc), tmp_desc);
|
||||
}
|
||||
|
||||
@@ -640,7 +640,7 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
||||
|
||||
if (le32_to_cpu(header.version) > 3) {
|
||||
char buf[64];
|
||||
snprintf(buf, sizeof(buf), "VMDK version %d",
|
||||
snprintf(buf, sizeof(buf), "VMDK version %" PRId32,
|
||||
le32_to_cpu(header.version));
|
||||
error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
||||
bs->device_name, "vmdk", buf);
|
||||
@@ -671,8 +671,9 @@ static int vmdk_open_vmdk4(BlockDriverState *bs,
|
||||
}
|
||||
if (bdrv_getlength(file) <
|
||||
le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE) {
|
||||
error_setg(errp, "File truncated, expecting at least %lld bytes",
|
||||
le64_to_cpu(header.grain_offset) * BDRV_SECTOR_SIZE);
|
||||
error_setg(errp, "File truncated, expecting at least %" PRId64 " bytes",
|
||||
(int64_t)(le64_to_cpu(header.grain_offset)
|
||||
* BDRV_SECTOR_SIZE));
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@@ -1707,8 +1708,8 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
|
||||
const char desc_template[] =
|
||||
"# Disk DescriptorFile\n"
|
||||
"version=1\n"
|
||||
"CID=%x\n"
|
||||
"parentCID=%x\n"
|
||||
"CID=%" PRIx32 "\n"
|
||||
"parentCID=%" PRIx32 "\n"
|
||||
"createType=\"%s\"\n"
|
||||
"%s"
|
||||
"\n"
|
||||
@@ -1720,7 +1721,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
|
||||
"\n"
|
||||
"ddb.virtualHWVersion = \"%d\"\n"
|
||||
"ddb.geometry.cylinders = \"%" PRId64 "\"\n"
|
||||
"ddb.geometry.heads = \"%d\"\n"
|
||||
"ddb.geometry.heads = \"%" PRIu32 "\"\n"
|
||||
"ddb.geometry.sectors = \"63\"\n"
|
||||
"ddb.adapterType = \"%s\"\n";
|
||||
|
||||
@@ -1780,9 +1781,9 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
|
||||
strcmp(fmt, "twoGbMaxExtentFlat"));
|
||||
compress = !strcmp(fmt, "streamOptimized");
|
||||
if (flat) {
|
||||
desc_extent_line = "RW %lld FLAT \"%s\" 0\n";
|
||||
desc_extent_line = "RW %" PRId64 " FLAT \"%s\" 0\n";
|
||||
} else {
|
||||
desc_extent_line = "RW %lld SPARSE \"%s\"\n";
|
||||
desc_extent_line = "RW %" PRId64 " SPARSE \"%s\"\n";
|
||||
}
|
||||
if (flat && backing_file) {
|
||||
error_setg(errp, "Flat image can't have backing file");
|
||||
@@ -1850,7 +1851,7 @@ static int vmdk_create(const char *filename, QEMUOptionParameter *options,
|
||||
}
|
||||
/* generate descriptor file */
|
||||
desc = g_strdup_printf(desc_template,
|
||||
(unsigned int)time(NULL),
|
||||
(uint32_t)time(NULL),
|
||||
parent_cid,
|
||||
fmt,
|
||||
parent_desc_line,
|
||||
|
@@ -787,9 +787,7 @@ static int read_directory(BDRVVVFATState* s, int mapping_index)
|
||||
s->current_mapping->path=buffer;
|
||||
s->current_mapping->read_only =
|
||||
(st.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH)) == 0;
|
||||
} else {
|
||||
g_free(buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir(dir);
|
||||
|
||||
@@ -1866,7 +1864,7 @@ static int check_directory_consistency(BDRVVVFATState *s,
|
||||
|
||||
if (s->used_clusters[cluster_num] & USED_ANY) {
|
||||
fprintf(stderr, "cluster %d used more than once\n", (int)cluster_num);
|
||||
goto fail;
|
||||
return 0;
|
||||
}
|
||||
s->used_clusters[cluster_num] = USED_DIRECTORY;
|
||||
|
||||
@@ -2949,7 +2947,7 @@ static int enable_write_target(BDRVVVFATState *s)
|
||||
unlink(s->qcow_filename);
|
||||
#endif
|
||||
|
||||
s->bs->backing_hd = bdrv_new("");
|
||||
s->bs->backing_hd = bdrv_new("", &error_abort);
|
||||
s->bs->backing_hd->drv = &vvfat_write_target;
|
||||
s->bs->backing_hd->opaque = g_malloc(sizeof(void*));
|
||||
*(void**)s->bs->backing_hd->opaque = s;
|
||||
|
@@ -27,9 +27,8 @@ static void nbd_accept(void *opaque)
|
||||
socklen_t addr_len = sizeof(addr);
|
||||
|
||||
int fd = accept(server_fd, (struct sockaddr *)&addr, &addr_len);
|
||||
if (fd >= 0 && !nbd_client_new(NULL, fd, nbd_client_put)) {
|
||||
shutdown(fd, 2);
|
||||
close(fd);
|
||||
if (fd >= 0) {
|
||||
nbd_client_new(NULL, fd, nbd_client_put);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,10 +91,6 @@ void qmp_nbd_server_add(const char *device, bool has_writable, bool writable,
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
return;
|
||||
}
|
||||
if (!bdrv_is_inserted(bs)) {
|
||||
error_set(errp, QERR_DEVICE_HAS_NO_MEDIUM, device);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!has_writable) {
|
||||
writable = false;
|
||||
|
38
blockdev.c
38
blockdev.c
@@ -332,7 +332,7 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
opts = qemu_opts_create(&qemu_common_drive_opts, id, 1, &error);
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
goto err_no_opts;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
qemu_opts_absorb_qdict(opts, bs_opts, &error);
|
||||
@@ -452,16 +452,14 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
}
|
||||
}
|
||||
|
||||
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 = bdrv_new(dinfo->id, &error);
|
||||
if (error) {
|
||||
error_propagate(errp, error);
|
||||
goto bdrv_new_err;
|
||||
}
|
||||
dinfo->bdrv->open_flags = snapshot ? BDRV_O_SNAPSHOT : 0;
|
||||
dinfo->bdrv->read_only = ro;
|
||||
dinfo->refcount = 1;
|
||||
@@ -523,13 +521,13 @@ static DriveInfo *blockdev_init(const char *file, QDict *bs_opts,
|
||||
|
||||
err:
|
||||
bdrv_unref(dinfo->bdrv);
|
||||
g_free(dinfo->id);
|
||||
QTAILQ_REMOVE(&drives, dinfo, next);
|
||||
bdrv_new_err:
|
||||
g_free(dinfo->id);
|
||||
g_free(dinfo);
|
||||
early_err:
|
||||
qemu_opts_del(opts);
|
||||
err_no_opts:
|
||||
QDECREF(bs_opts);
|
||||
qemu_opts_del(opts);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -903,7 +901,6 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
|
||||
/* Actual block device init: Functionality shared with blockdev-add */
|
||||
dinfo = blockdev_init(filename, bs_opts, &local_err);
|
||||
bs_opts = NULL;
|
||||
if (dinfo == NULL) {
|
||||
if (local_err) {
|
||||
qerror_report_err(local_err);
|
||||
@@ -941,7 +938,6 @@ DriveInfo *drive_init(QemuOpts *all_opts, BlockInterfaceType block_default_type)
|
||||
|
||||
fail:
|
||||
qemu_opts_del(legacy_opts);
|
||||
QDECREF(bs_opts);
|
||||
return dinfo;
|
||||
}
|
||||
|
||||
@@ -1867,8 +1863,7 @@ void qmp_block_stream(const char *device, bool has_base,
|
||||
}
|
||||
|
||||
void qmp_block_commit(const char *device,
|
||||
bool has_base, const char *base,
|
||||
bool has_top, const char *top,
|
||||
bool has_base, const char *base, const char *top,
|
||||
bool has_speed, int64_t speed,
|
||||
Error **errp)
|
||||
{
|
||||
@@ -1887,11 +1882,6 @@ void qmp_block_commit(const char *device,
|
||||
/* drain all i/o before commits */
|
||||
bdrv_drain_all();
|
||||
|
||||
/* Important Note:
|
||||
* libvirt relies on the DeviceNotFound error class in order to probe for
|
||||
* live commit feature versions; for this to work, we must make sure to
|
||||
* perform the device lookup before any generic errors that may occur in a
|
||||
* scenario in which all optional arguments are omitted. */
|
||||
bs = bdrv_find(device);
|
||||
if (!bs) {
|
||||
error_set(errp, QERR_DEVICE_NOT_FOUND, device);
|
||||
@@ -1901,7 +1891,7 @@ void qmp_block_commit(const char *device,
|
||||
/* default top_bs is the active layer */
|
||||
top_bs = bs;
|
||||
|
||||
if (has_top && top) {
|
||||
if (top) {
|
||||
if (strcmp(bs->filename, top) != 0) {
|
||||
top_bs = bdrv_find_backing_image(bs, top);
|
||||
}
|
||||
@@ -1923,12 +1913,6 @@ void qmp_block_commit(const char *device,
|
||||
return;
|
||||
}
|
||||
|
||||
/* Do not allow attempts to commit an image into itself */
|
||||
if (top_bs == base_bs) {
|
||||
error_setg(errp, "cannot commit an image into itself");
|
||||
return;
|
||||
}
|
||||
|
||||
if (top_bs == bs) {
|
||||
commit_active_start(bs, base_bs, speed, on_error, block_job_cb,
|
||||
bs, &local_err);
|
||||
|
14
blockjob.c
14
blockjob.c
@@ -206,20 +206,6 @@ void block_job_sleep_ns(BlockJob *job, QEMUClockType type, int64_t ns)
|
||||
job->busy = true;
|
||||
}
|
||||
|
||||
void block_job_yield(BlockJob *job)
|
||||
{
|
||||
assert(job->busy);
|
||||
|
||||
/* Check cancellation *before* setting busy = false, too! */
|
||||
if (block_job_is_cancelled(job)) {
|
||||
return;
|
||||
}
|
||||
|
||||
job->busy = false;
|
||||
qemu_coroutine_yield();
|
||||
job->busy = true;
|
||||
}
|
||||
|
||||
BlockJobInfo *block_job_query(BlockJob *job)
|
||||
{
|
||||
BlockJobInfo *info = g_new0(BlockJobInfo, 1);
|
||||
|
7
configure
vendored
7
configure
vendored
@@ -1217,8 +1217,8 @@ Advanced options (experts only):
|
||||
--enable-modules enable modules support
|
||||
--enable-debug-tcg enable TCG debugging
|
||||
--disable-debug-tcg disable TCG debugging (default)
|
||||
--enable-debug-info enable debugging information (default)
|
||||
--disable-debug-info disable debugging information
|
||||
--enable-debug-info enable debugging information (default)
|
||||
--disable-debug-info disable debugging information
|
||||
--enable-debug enable common debug build options
|
||||
--enable-sparse enable sparse checker
|
||||
--disable-sparse disable sparse checker (default)
|
||||
@@ -2624,7 +2624,7 @@ done
|
||||
if test "$modules" = yes; then
|
||||
shacmd_probe="sha1sum sha1 shasum"
|
||||
for c in $shacmd_probe; do
|
||||
if which $c >/dev/null 2>&1; then
|
||||
if which $c &>/dev/null; then
|
||||
shacmd="$c"
|
||||
break
|
||||
fi
|
||||
@@ -4095,7 +4095,6 @@ echo "sparse enabled $sparse"
|
||||
echo "strip binaries $strip_opt"
|
||||
echo "profiler $profiler"
|
||||
echo "static build $static"
|
||||
echo "-Werror enabled $werror"
|
||||
if test "$darwin" = "yes" ; then
|
||||
echo "Cocoa support $cocoa"
|
||||
fi
|
||||
|
@@ -36,17 +36,8 @@ typedef struct
|
||||
static __thread CoroutineWin32 leader;
|
||||
static __thread Coroutine *current;
|
||||
|
||||
/* This function is marked noinline to prevent GCC from inlining it
|
||||
* into coroutine_trampoline(). If we allow it to do that then it
|
||||
* hoists the code to get the address of the TLS variable "current"
|
||||
* out of the while() loop. This is an invalid transformation because
|
||||
* the SwitchToFiber() call may be called when running thread A but
|
||||
* return in thread B, and so we might be in a different thread
|
||||
* context each time round the loop.
|
||||
*/
|
||||
CoroutineAction __attribute__((noinline))
|
||||
qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,
|
||||
CoroutineAction action)
|
||||
CoroutineAction qemu_coroutine_switch(Coroutine *from_, Coroutine *to_,
|
||||
CoroutineAction action)
|
||||
{
|
||||
CoroutineWin32 *from = DO_UPCAST(CoroutineWin32, base, from_);
|
||||
CoroutineWin32 *to = DO_UPCAST(CoroutineWin32, base, to_);
|
||||
|
6
cputlb.c
6
cputlb.c
@@ -331,10 +331,8 @@ tb_page_addr_t get_page_addr_code(CPUArchState *env1, target_ulong addr)
|
||||
}
|
||||
|
||||
#define MMUSUFFIX _cmmu
|
||||
#undef GETPC_ADJ
|
||||
#define GETPC_ADJ 0
|
||||
#undef GETRA
|
||||
#define GETRA() ((uintptr_t)0)
|
||||
#undef GETPC
|
||||
#define GETPC() ((uintptr_t)0)
|
||||
#define SOFTMMU_CODE_ACCESS
|
||||
|
||||
#define SHIFT 0
|
||||
|
@@ -1,6 +1,7 @@
|
||||
CONFIG_USB_TABLET_WACOM=y
|
||||
CONFIG_USB_STORAGE_BOT=y
|
||||
CONFIG_USB_STORAGE_UAS=y
|
||||
CONFIG_USB_STORAGE_MTP=y
|
||||
CONFIG_USB_SMARTCARD=y
|
||||
CONFIG_USB_AUDIO=y
|
||||
CONFIG_USB_SERIAL=y
|
||||
|
@@ -4,7 +4,7 @@ common-obj-$(CONFIG_ARM_DIS) += arm.o
|
||||
common-obj-$(CONFIG_ARM_A64_DIS) += arm-a64.o
|
||||
common-obj-$(CONFIG_ARM_A64_DIS) += libvixl/
|
||||
libvixldir = $(SRC_PATH)/disas/libvixl
|
||||
$(obj)/arm-a64.o: QEMU_CFLAGS := -I$(libvixldir) $(QEMU_CFLAGS)
|
||||
$(obj)/arm-a64.o: QEMU_CFLAGS += -I$(libvixldir)
|
||||
common-obj-$(CONFIG_CRIS_DIS) += cris.o
|
||||
common-obj-$(CONFIG_HPPA_DIS) += hppa.o
|
||||
common-obj-$(CONFIG_I386_DIS) += i386.o
|
||||
|
@@ -3,6 +3,6 @@ libvixl_OBJS = utils.o \
|
||||
a64/decoder-a64.o \
|
||||
a64/disasm-a64.o
|
||||
|
||||
$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS := -I$(SRC_PATH)/disas/libvixl $(QEMU_CFLAGS)
|
||||
$(addprefix $(obj)/,$(libvixl_OBJS)): QEMU_CFLAGS += -I$(SRC_PATH)/disas/libvixl
|
||||
|
||||
common-obj-$(CONFIG_ARM_A64_DIS) += $(libvixl_OBJS)
|
||||
|
@@ -5,9 +5,10 @@ QEMU Standard VGA
|
||||
Exists in two variants, for isa and pci.
|
||||
|
||||
command line switches:
|
||||
-vga std [ picks isa for -M isapc, otherwise pci ]
|
||||
-device VGA [ pci variant ]
|
||||
-device isa-vga [ isa variant ]
|
||||
-vga std [ picks isa for -M isapc, otherwise pci ]
|
||||
-device VGA [ pci variant ]
|
||||
-device isa-vga [ isa variant ]
|
||||
-device secondary-vga [ legacy-free pci variant ]
|
||||
|
||||
|
||||
PCI spec
|
||||
@@ -31,9 +32,15 @@ PCI ROM Region:
|
||||
Holds the vgabios (qemu 0.14+).
|
||||
|
||||
|
||||
The legacy-free variant has no ROM and has PCI_CLASS_DISPLAY_OTHER
|
||||
instead of PCI_CLASS_DISPLAY_VGA.
|
||||
|
||||
|
||||
IO ports used
|
||||
-------------
|
||||
|
||||
Doesn't apply to the legacy-free pci variant, use the MMIO bar instead.
|
||||
|
||||
03c0 - 03df : standard vga ports
|
||||
01ce : bochs vbe interface index port
|
||||
01cf : bochs vbe interface data port (x86 only)
|
||||
|
@@ -55,7 +55,7 @@ these four paragraphs for those parts of this code that are retained.
|
||||
| The result is stored in the location pointed to by `zPtr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
|
||||
INLINE void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t *zPtr)
|
||||
{
|
||||
uint32_t z;
|
||||
|
||||
@@ -81,7 +81,7 @@ static inline void shift32RightJamming(uint32_t a, int_fast16_t count, uint32_t
|
||||
| The result is stored in the location pointed to by `zPtr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
|
||||
INLINE void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t *zPtr)
|
||||
{
|
||||
uint64_t z;
|
||||
|
||||
@@ -115,7 +115,7 @@ static inline void shift64RightJamming(uint64_t a, int_fast16_t count, uint64_t
|
||||
| described above, and is returned at the location pointed to by `z1Ptr'.)
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
shift64ExtraRightJamming(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
@@ -152,7 +152,7 @@ static inline void
|
||||
| which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
shift128Right(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
@@ -187,7 +187,7 @@ static inline void
|
||||
| the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
shift128RightJamming(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
@@ -238,7 +238,7 @@ static inline void
|
||||
| `z2Ptr'.)
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
shift128ExtraRightJamming(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
@@ -296,7 +296,7 @@ static inline void
|
||||
| pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
shortShift128Left(
|
||||
uint64_t a0, uint64_t a1, int_fast16_t count, uint64_t *z0Ptr, uint64_t *z1Ptr)
|
||||
{
|
||||
@@ -315,7 +315,7 @@ static inline void
|
||||
| `z1Ptr', and `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
shortShift192Left(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
@@ -350,7 +350,7 @@ static inline void
|
||||
| are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
add128(
|
||||
uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
{
|
||||
@@ -370,7 +370,7 @@ static inline void
|
||||
| `z1Ptr', and `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
add192(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
@@ -408,7 +408,7 @@ static inline void
|
||||
| `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
sub128(
|
||||
uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
{
|
||||
@@ -426,7 +426,7 @@ static inline void
|
||||
| pointed to by `z0Ptr', `z1Ptr', and `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
sub192(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
@@ -462,7 +462,7 @@ static inline void
|
||||
| `z0Ptr' and `z1Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
INLINE void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t *z1Ptr )
|
||||
{
|
||||
uint32_t aHigh, aLow, bHigh, bLow;
|
||||
uint64_t z0, zMiddleA, zMiddleB, z1;
|
||||
@@ -492,7 +492,7 @@ static inline void mul64To128( uint64_t a, uint64_t b, uint64_t *z0Ptr, uint64_t
|
||||
| `z2Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
mul128By64To192(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
@@ -520,7 +520,7 @@ static inline void
|
||||
| the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline void
|
||||
INLINE void
|
||||
mul128To256(
|
||||
uint64_t a0,
|
||||
uint64_t a1,
|
||||
@@ -702,7 +702,7 @@ static int8 countLeadingZeros64( uint64_t a )
|
||||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
INLINE flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 == b0 ) && ( a1 == b1 );
|
||||
@@ -715,7 +715,7 @@ static inline flag eq128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
INLINE flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
|
||||
@@ -728,7 +728,7 @@ static inline flag le128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
| returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
INLINE flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
|
||||
@@ -741,7 +741,7 @@ static inline flag lt128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
| Otherwise, returns 0.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
INLINE flag ne128( uint64_t a0, uint64_t a1, uint64_t b0, uint64_t b1 )
|
||||
{
|
||||
|
||||
return ( a0 != b0 ) || ( a1 != b1 );
|
||||
|
@@ -66,7 +66,7 @@ these four paragraphs for those parts of this code that are retained.
|
||||
| Returns the fraction bits of the half-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline uint32_t extractFloat16Frac(float16 a)
|
||||
INLINE uint32_t extractFloat16Frac(float16 a)
|
||||
{
|
||||
return float16_val(a) & 0x3ff;
|
||||
}
|
||||
@@ -75,7 +75,7 @@ static inline uint32_t extractFloat16Frac(float16 a)
|
||||
| Returns the exponent bits of the half-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline int_fast16_t extractFloat16Exp(float16 a)
|
||||
INLINE int_fast16_t extractFloat16Exp(float16 a)
|
||||
{
|
||||
return (float16_val(a) >> 10) & 0x1f;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ static inline int_fast16_t extractFloat16Exp(float16 a)
|
||||
| Returns the sign bit of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag extractFloat16Sign(float16 a)
|
||||
INLINE flag extractFloat16Sign(float16 a)
|
||||
{
|
||||
return float16_val(a)>>15;
|
||||
}
|
||||
@@ -255,7 +255,7 @@ static int64 roundAndPackUint64(flag zSign, uint64_t absZ0,
|
||||
| Returns the fraction bits of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline uint32_t extractFloat32Frac( float32 a )
|
||||
INLINE uint32_t extractFloat32Frac( float32 a )
|
||||
{
|
||||
|
||||
return float32_val(a) & 0x007FFFFF;
|
||||
@@ -266,7 +266,7 @@ static inline uint32_t extractFloat32Frac( float32 a )
|
||||
| Returns the exponent bits of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline int_fast16_t extractFloat32Exp(float32 a)
|
||||
INLINE int_fast16_t extractFloat32Exp(float32 a)
|
||||
{
|
||||
|
||||
return ( float32_val(a)>>23 ) & 0xFF;
|
||||
@@ -277,7 +277,7 @@ static inline int_fast16_t extractFloat32Exp(float32 a)
|
||||
| Returns the sign bit of the single-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag extractFloat32Sign( float32 a )
|
||||
INLINE flag extractFloat32Sign( float32 a )
|
||||
{
|
||||
|
||||
return float32_val(a)>>31;
|
||||
@@ -328,7 +328,7 @@ static void
|
||||
| significand.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
|
||||
INLINE float32 packFloat32(flag zSign, int_fast16_t zExp, uint32_t zSig)
|
||||
{
|
||||
|
||||
return make_float32(
|
||||
@@ -440,7 +440,7 @@ static float32
|
||||
| Returns the fraction bits of the double-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline uint64_t extractFloat64Frac( float64 a )
|
||||
INLINE uint64_t extractFloat64Frac( float64 a )
|
||||
{
|
||||
|
||||
return float64_val(a) & LIT64( 0x000FFFFFFFFFFFFF );
|
||||
@@ -451,7 +451,7 @@ static inline uint64_t extractFloat64Frac( float64 a )
|
||||
| Returns the exponent bits of the double-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline int_fast16_t extractFloat64Exp(float64 a)
|
||||
INLINE int_fast16_t extractFloat64Exp(float64 a)
|
||||
{
|
||||
|
||||
return ( float64_val(a)>>52 ) & 0x7FF;
|
||||
@@ -462,7 +462,7 @@ static inline int_fast16_t extractFloat64Exp(float64 a)
|
||||
| Returns the sign bit of the double-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag extractFloat64Sign( float64 a )
|
||||
INLINE flag extractFloat64Sign( float64 a )
|
||||
{
|
||||
|
||||
return float64_val(a)>>63;
|
||||
@@ -513,7 +513,7 @@ static void
|
||||
| significand.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
|
||||
INLINE float64 packFloat64(flag zSign, int_fast16_t zExp, uint64_t zSig)
|
||||
{
|
||||
|
||||
return make_float64(
|
||||
@@ -625,7 +625,7 @@ static float64
|
||||
| value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline uint64_t extractFloatx80Frac( floatx80 a )
|
||||
INLINE uint64_t extractFloatx80Frac( floatx80 a )
|
||||
{
|
||||
|
||||
return a.low;
|
||||
@@ -637,7 +637,7 @@ static inline uint64_t extractFloatx80Frac( floatx80 a )
|
||||
| value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline int32 extractFloatx80Exp( floatx80 a )
|
||||
INLINE int32 extractFloatx80Exp( floatx80 a )
|
||||
{
|
||||
|
||||
return a.high & 0x7FFF;
|
||||
@@ -649,7 +649,7 @@ static inline int32 extractFloatx80Exp( floatx80 a )
|
||||
| `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag extractFloatx80Sign( floatx80 a )
|
||||
INLINE flag extractFloatx80Sign( floatx80 a )
|
||||
{
|
||||
|
||||
return a.high>>15;
|
||||
@@ -679,7 +679,7 @@ static void
|
||||
| extended double-precision floating-point value, returning the result.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
|
||||
INLINE floatx80 packFloatx80( flag zSign, int32 zExp, uint64_t zSig )
|
||||
{
|
||||
floatx80 z;
|
||||
|
||||
@@ -921,7 +921,7 @@ static floatx80
|
||||
| floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline uint64_t extractFloat128Frac1( float128 a )
|
||||
INLINE uint64_t extractFloat128Frac1( float128 a )
|
||||
{
|
||||
|
||||
return a.low;
|
||||
@@ -933,7 +933,7 @@ static inline uint64_t extractFloat128Frac1( float128 a )
|
||||
| floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline uint64_t extractFloat128Frac0( float128 a )
|
||||
INLINE uint64_t extractFloat128Frac0( float128 a )
|
||||
{
|
||||
|
||||
return a.high & LIT64( 0x0000FFFFFFFFFFFF );
|
||||
@@ -945,7 +945,7 @@ static inline uint64_t extractFloat128Frac0( float128 a )
|
||||
| `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline int32 extractFloat128Exp( float128 a )
|
||||
INLINE int32 extractFloat128Exp( float128 a )
|
||||
{
|
||||
|
||||
return ( a.high>>48 ) & 0x7FFF;
|
||||
@@ -956,7 +956,7 @@ static inline int32 extractFloat128Exp( float128 a )
|
||||
| Returns the sign bit of the quadruple-precision floating-point value `a'.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline flag extractFloat128Sign( float128 a )
|
||||
INLINE flag extractFloat128Sign( float128 a )
|
||||
{
|
||||
|
||||
return a.high>>63;
|
||||
@@ -1017,7 +1017,7 @@ static void
|
||||
| significand.
|
||||
*----------------------------------------------------------------------------*/
|
||||
|
||||
static inline float128
|
||||
INLINE float128
|
||||
packFloat128( flag zSign, int32 zExp, uint64_t zSig0, uint64_t zSig1 )
|
||||
{
|
||||
float128 z;
|
||||
@@ -7088,7 +7088,7 @@ uint64_t float64_to_uint64_round_to_zero (float64 a STATUS_PARAM)
|
||||
}
|
||||
|
||||
#define COMPARE(s, nan_exp) \
|
||||
static inline int float ## s ## _compare_internal( float ## s a, float ## s b, \
|
||||
INLINE int float ## s ## _compare_internal( float ## s a, float ## s b, \
|
||||
int is_quiet STATUS_PARAM ) \
|
||||
{ \
|
||||
flag aSign, bSign; \
|
||||
@@ -7140,7 +7140,7 @@ int float ## s ## _compare_quiet( float ## s a, float ## s b STATUS_PARAM ) \
|
||||
COMPARE(32, 0xff)
|
||||
COMPARE(64, 0x7ff)
|
||||
|
||||
static inline int floatx80_compare_internal( floatx80 a, floatx80 b,
|
||||
INLINE int floatx80_compare_internal( floatx80 a, floatx80 b,
|
||||
int is_quiet STATUS_PARAM )
|
||||
{
|
||||
flag aSign, bSign;
|
||||
@@ -7186,7 +7186,7 @@ int floatx80_compare_quiet( floatx80 a, floatx80 b STATUS_PARAM )
|
||||
return floatx80_compare_internal(a, b, 1 STATUS_VAR);
|
||||
}
|
||||
|
||||
static inline int float128_compare_internal( float128 a, float128 b,
|
||||
INLINE int float128_compare_internal( float128 a, float128 b,
|
||||
int is_quiet STATUS_PARAM )
|
||||
{
|
||||
flag aSign, bSign;
|
||||
@@ -7242,7 +7242,7 @@ int float128_compare_quiet( float128 a, float128 b STATUS_PARAM )
|
||||
* semantics provided by many CPUs which predate that specification.
|
||||
*/
|
||||
#define MINMAX(s) \
|
||||
static inline float ## s float ## s ## _minmax(float ## s a, float ## s b, \
|
||||
INLINE float ## s float ## s ## _minmax(float ## s a, float ## s b, \
|
||||
int ismin, int isieee STATUS_PARAM) \
|
||||
{ \
|
||||
flag aSign, bSign; \
|
||||
|
@@ -417,12 +417,8 @@ static void do_cpu_reset(void *opaque)
|
||||
if (info) {
|
||||
if (!info->is_linux) {
|
||||
/* Jump to the entry point. */
|
||||
if (env->aarch64) {
|
||||
env->pc = info->entry;
|
||||
} else {
|
||||
env->regs[15] = info->entry & 0xfffffffe;
|
||||
env->thumb = info->entry & 1;
|
||||
}
|
||||
env->regs[15] = info->entry & 0xfffffffe;
|
||||
env->thumb = info->entry & 1;
|
||||
} else {
|
||||
if (CPU(cpu) == first_cpu) {
|
||||
if (env->aarch64) {
|
||||
|
@@ -43,6 +43,19 @@ static void cubieboard_init(QEMUMachineInitArgs *args)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_property_set_int(OBJECT(&s->a10->timer), 32768, "clk0-freq", &err);
|
||||
if (err != NULL) {
|
||||
error_report("Couldn't set clk0 frequency: %s", error_get_pretty(err));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_property_set_int(OBJECT(&s->a10->timer), 24000000, "clk1-freq",
|
||||
&err);
|
||||
if (err != NULL) {
|
||||
error_report("Couldn't set clk1 frequency: %s", error_get_pretty(err));
|
||||
exit(1);
|
||||
}
|
||||
|
||||
object_property_set_bool(OBJECT(s->a10), true, "realized", &err);
|
||||
if (err != NULL) {
|
||||
error_report("Couldn't realize Allwinner A10: %s",
|
||||
|
@@ -172,7 +172,7 @@ static void omap_timer_clk_update(void *opaque, int line, int on)
|
||||
static void omap_timer_clk_setup(struct omap_mpu_timer_s *timer)
|
||||
{
|
||||
omap_clk_adduser(timer->clk,
|
||||
qemu_allocate_irq(omap_timer_clk_update, timer, 0));
|
||||
qemu_allocate_irqs(omap_timer_clk_update, timer, 1)[0]);
|
||||
timer->rate = omap_clk_getrate(timer->clk);
|
||||
}
|
||||
|
||||
@@ -2098,7 +2098,7 @@ static struct omap_mpuio_s *omap_mpuio_init(MemoryRegion *memory,
|
||||
"omap-mpuio", 0x800);
|
||||
memory_region_add_subregion(memory, base, &s->iomem);
|
||||
|
||||
omap_clk_adduser(clk, qemu_allocate_irq(omap_mpuio_onoff, s, 0));
|
||||
omap_clk_adduser(clk, qemu_allocate_irqs(omap_mpuio_onoff, s, 1)[0]);
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -2401,7 +2401,7 @@ static struct omap_pwl_s *omap_pwl_init(MemoryRegion *system_memory,
|
||||
"omap-pwl", 0x800);
|
||||
memory_region_add_subregion(system_memory, base, &s->iomem);
|
||||
|
||||
omap_clk_adduser(clk, qemu_allocate_irq(omap_pwl_clk_update, s, 0));
|
||||
omap_clk_adduser(clk, qemu_allocate_irqs(omap_pwl_clk_update, s, 1)[0]);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -3485,8 +3485,8 @@ static void omap_mcbsp_i2s_start(void *opaque, int line, int level)
|
||||
void omap_mcbsp_i2s_attach(struct omap_mcbsp_s *s, I2SCodec *slave)
|
||||
{
|
||||
s->codec = slave;
|
||||
slave->rx_swallow = qemu_allocate_irq(omap_mcbsp_i2s_swallow, s, 0);
|
||||
slave->tx_start = qemu_allocate_irq(omap_mcbsp_i2s_start, s, 0);
|
||||
slave->rx_swallow = qemu_allocate_irqs(omap_mcbsp_i2s_swallow, s, 1)[0];
|
||||
slave->tx_start = qemu_allocate_irqs(omap_mcbsp_i2s_start, s, 1)[0];
|
||||
}
|
||||
|
||||
/* LED Pulse Generators */
|
||||
@@ -3634,7 +3634,7 @@ static struct omap_lpg_s *omap_lpg_init(MemoryRegion *system_memory,
|
||||
memory_region_init_io(&s->iomem, NULL, &omap_lpg_ops, s, "omap-lpg", 0x800);
|
||||
memory_region_add_subregion(system_memory, base, &s->iomem);
|
||||
|
||||
omap_clk_adduser(clk, qemu_allocate_irq(omap_lpg_clk_update, s, 0));
|
||||
omap_clk_adduser(clk, qemu_allocate_irqs(omap_lpg_clk_update, s, 1)[0]);
|
||||
|
||||
return s;
|
||||
}
|
||||
@@ -3848,7 +3848,7 @@ struct omap_mpu_state_s *omap310_mpu_init(MemoryRegion *system_memory,
|
||||
s->sdram_size = sdram_size;
|
||||
s->sram_size = OMAP15XX_SRAM_SIZE;
|
||||
|
||||
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
|
||||
s->wakeup = qemu_allocate_irqs(omap_mpu_wakeup, s, 1)[0];
|
||||
|
||||
/* Clocks */
|
||||
omap_clk_init(s);
|
||||
|
@@ -2260,7 +2260,7 @@ struct omap_mpu_state_s *omap2420_mpu_init(MemoryRegion *sysmem,
|
||||
s->sdram_size = sdram_size;
|
||||
s->sram_size = OMAP242X_SRAM_SIZE;
|
||||
|
||||
s->wakeup = qemu_allocate_irq(omap_mpu_wakeup, s, 0);
|
||||
s->wakeup = qemu_allocate_irqs(omap_mpu_wakeup, s, 1)[0];
|
||||
|
||||
/* Clocks */
|
||||
omap_clk_init(s);
|
||||
|
@@ -732,7 +732,7 @@ static void pxa2xx_ssp_save(QEMUFile *f, void *opaque)
|
||||
static int pxa2xx_ssp_load(QEMUFile *f, void *opaque, int version_id)
|
||||
{
|
||||
PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;
|
||||
int i, v;
|
||||
int i;
|
||||
|
||||
s->enable = qemu_get_be32(f);
|
||||
|
||||
@@ -746,11 +746,7 @@ static int pxa2xx_ssp_load(QEMUFile *f, void *opaque, int version_id)
|
||||
qemu_get_8s(f, &s->ssrsa);
|
||||
qemu_get_8s(f, &s->ssacd);
|
||||
|
||||
v = qemu_get_byte(f);
|
||||
if (v < 0 || v > ARRAY_SIZE(s->rx_fifo)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->rx_level = v;
|
||||
s->rx_level = qemu_get_byte(f);
|
||||
s->rx_start = 0;
|
||||
for (i = 0; i < s->rx_level; i ++)
|
||||
s->rx_fifo[i] = qemu_get_byte(f);
|
||||
@@ -2059,7 +2055,7 @@ PXA2xxState *pxa270_init(MemoryRegion *address_space,
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0);
|
||||
s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0];
|
||||
|
||||
/* SDRAM & Internal Memory Storage */
|
||||
memory_region_init_ram(&s->sdram, NULL, "pxa270.sdram", sdram_size);
|
||||
@@ -2190,7 +2186,7 @@ PXA2xxState *pxa255_init(MemoryRegion *address_space, unsigned int sdram_size)
|
||||
fprintf(stderr, "Unable to find CPU definition\n");
|
||||
exit(1);
|
||||
}
|
||||
s->reset = qemu_allocate_irq(pxa2xx_reset, s, 0);
|
||||
s->reset = qemu_allocate_irqs(pxa2xx_reset, s, 1)[0];
|
||||
|
||||
/* SDRAM & Internal Memory Storage */
|
||||
memory_region_init_ram(&s->sdram, NULL, "pxa255.sdram", sdram_size);
|
||||
|
@@ -744,7 +744,7 @@ static void spitz_i2c_setup(PXA2xxState *cpu)
|
||||
|
||||
spitz_wm8750_addr(wm, 0, 0);
|
||||
qdev_connect_gpio_out(cpu->gpio, SPITZ_GPIO_WM,
|
||||
qemu_allocate_irq(spitz_wm8750_addr, wm, 0));
|
||||
qemu_allocate_irqs(spitz_wm8750_addr, wm, 1)[0]);
|
||||
/* .. and to the sound interface. */
|
||||
cpu->i2s->opaque = wm;
|
||||
cpu->i2s->codec_out = wm8750_dac_dat;
|
||||
@@ -850,7 +850,7 @@ static void spitz_gpio_setup(PXA2xxState *cpu, int slots)
|
||||
* wouldn't guarantee that a guest ever exits the loop.
|
||||
*/
|
||||
spitz_hsync = 0;
|
||||
lcd_hsync = qemu_allocate_irq(spitz_lcd_hsync_handler, cpu, 0);
|
||||
lcd_hsync = qemu_allocate_irqs(spitz_lcd_hsync_handler, cpu, 1)[0];
|
||||
pxa2xx_gpio_read_notifier(cpu->gpio, lcd_hsync);
|
||||
pxa2xx_lcd_vsync_notifier(cpu->lcd, lcd_hsync);
|
||||
|
||||
|
@@ -365,7 +365,7 @@ static void z2_init(QEMUMachineInitArgs *args)
|
||||
wm8750_data_req_set(wm, mpu->i2s->data_req, mpu->i2s);
|
||||
|
||||
qdev_connect_gpio_out(mpu->gpio, Z2_GPIO_LCD_CS,
|
||||
qemu_allocate_irq(z2_lcd_cs, z2_lcd, 0));
|
||||
qemu_allocate_irqs(z2_lcd_cs, z2_lcd, 1)[0]);
|
||||
|
||||
z2_binfo.kernel_filename = kernel_filename;
|
||||
z2_binfo.kernel_cmdline = kernel_cmdline;
|
||||
|
@@ -30,6 +30,7 @@
|
||||
* License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define INLINE static inline
|
||||
#define HAS_YM3812 1
|
||||
|
||||
#include <stdio.h>
|
||||
@@ -246,7 +247,7 @@ static INT32 feedback2; /* connect for SLOT 2 */
|
||||
|
||||
/* --------------------- subroutines --------------------- */
|
||||
|
||||
static inline int Limit( int val, int max, int min ) {
|
||||
INLINE int Limit( int val, int max, int min ) {
|
||||
if ( val > max )
|
||||
val = max;
|
||||
else if ( val < min )
|
||||
@@ -256,7 +257,7 @@ static inline int Limit( int val, int max, int min ) {
|
||||
}
|
||||
|
||||
/* status set and IRQ handling */
|
||||
static inline void OPL_STATUS_SET(FM_OPL *OPL,int flag)
|
||||
INLINE void OPL_STATUS_SET(FM_OPL *OPL,int flag)
|
||||
{
|
||||
/* set status flag */
|
||||
OPL->status |= flag;
|
||||
@@ -272,7 +273,7 @@ static inline void OPL_STATUS_SET(FM_OPL *OPL,int flag)
|
||||
}
|
||||
|
||||
/* status reset and IRQ handling */
|
||||
static inline void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
|
||||
INLINE void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
|
||||
{
|
||||
/* reset status flag */
|
||||
OPL->status &=~flag;
|
||||
@@ -288,7 +289,7 @@ static inline void OPL_STATUS_RESET(FM_OPL *OPL,int flag)
|
||||
}
|
||||
|
||||
/* IRQ mask set */
|
||||
static inline void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
|
||||
INLINE void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
|
||||
{
|
||||
OPL->statusmask = flag;
|
||||
/* IRQ handling check */
|
||||
@@ -297,7 +298,7 @@ static inline void OPL_STATUSMASK_SET(FM_OPL *OPL,int flag)
|
||||
}
|
||||
|
||||
/* ----- key on ----- */
|
||||
static inline void OPL_KEYON(OPL_SLOT *SLOT)
|
||||
INLINE void OPL_KEYON(OPL_SLOT *SLOT)
|
||||
{
|
||||
/* sin wave restart */
|
||||
SLOT->Cnt = 0;
|
||||
@@ -308,7 +309,7 @@ static inline void OPL_KEYON(OPL_SLOT *SLOT)
|
||||
SLOT->eve = EG_AED;
|
||||
}
|
||||
/* ----- key off ----- */
|
||||
static inline void OPL_KEYOFF(OPL_SLOT *SLOT)
|
||||
INLINE void OPL_KEYOFF(OPL_SLOT *SLOT)
|
||||
{
|
||||
if( SLOT->evm > ENV_MOD_RR)
|
||||
{
|
||||
@@ -324,7 +325,7 @@ static inline void OPL_KEYOFF(OPL_SLOT *SLOT)
|
||||
|
||||
/* ---------- calcrate Envelope Generator & Phase Generator ---------- */
|
||||
/* return : envelope output */
|
||||
static inline UINT32 OPL_CALC_SLOT( OPL_SLOT *SLOT )
|
||||
INLINE UINT32 OPL_CALC_SLOT( OPL_SLOT *SLOT )
|
||||
{
|
||||
/* calcrate envelope generator */
|
||||
if( (SLOT->evc+=SLOT->evs) >= SLOT->eve )
|
||||
@@ -370,7 +371,7 @@ static void set_algorithm( OPL_CH *CH)
|
||||
}
|
||||
|
||||
/* ---------- frequency counter for operater update ---------- */
|
||||
static inline void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
|
||||
INLINE void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
|
||||
{
|
||||
int ksr;
|
||||
|
||||
@@ -390,7 +391,7 @@ static inline void CALC_FCSLOT(OPL_CH *CH,OPL_SLOT *SLOT)
|
||||
}
|
||||
|
||||
/* set multi,am,vib,EG-TYP,KSR,mul */
|
||||
static inline void set_mul(FM_OPL *OPL,int slot,int v)
|
||||
INLINE void set_mul(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
@@ -404,7 +405,7 @@ static inline void set_mul(FM_OPL *OPL,int slot,int v)
|
||||
}
|
||||
|
||||
/* set ksl & tl */
|
||||
static inline void set_ksl_tl(FM_OPL *OPL,int slot,int v)
|
||||
INLINE void set_ksl_tl(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
@@ -420,7 +421,7 @@ static inline void set_ksl_tl(FM_OPL *OPL,int slot,int v)
|
||||
}
|
||||
|
||||
/* set attack rate & decay rate */
|
||||
static inline void set_ar_dr(FM_OPL *OPL,int slot,int v)
|
||||
INLINE void set_ar_dr(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
@@ -437,7 +438,7 @@ static inline void set_ar_dr(FM_OPL *OPL,int slot,int v)
|
||||
}
|
||||
|
||||
/* set sustain level & release rate */
|
||||
static inline void set_sl_rr(FM_OPL *OPL,int slot,int v)
|
||||
INLINE void set_sl_rr(FM_OPL *OPL,int slot,int v)
|
||||
{
|
||||
OPL_CH *CH = &OPL->P_CH[slot/2];
|
||||
OPL_SLOT *SLOT = &CH->SLOT[slot&1];
|
||||
@@ -454,7 +455,7 @@ static inline void set_sl_rr(FM_OPL *OPL,int slot,int v)
|
||||
/* operator output calcrator */
|
||||
#define OP_OUT(slot,env,con) slot->wavetable[((slot->Cnt+con)/(0x1000000/SIN_ENT))&(SIN_ENT-1)][env]
|
||||
/* ---------- calcrate one of channel ---------- */
|
||||
static inline void OPL_CALC_CH( OPL_CH *CH )
|
||||
INLINE void OPL_CALC_CH( OPL_CH *CH )
|
||||
{
|
||||
UINT32 env_out;
|
||||
OPL_SLOT *SLOT;
|
||||
@@ -499,7 +500,7 @@ static inline void OPL_CALC_CH( OPL_CH *CH )
|
||||
|
||||
/* ---------- calcrate rhythm block ---------- */
|
||||
#define WHITE_NOISE_db 6.0
|
||||
static inline void OPL_CALC_RH( OPL_CH *CH )
|
||||
INLINE void OPL_CALC_RH( OPL_CH *CH )
|
||||
{
|
||||
UINT32 env_tam,env_sd,env_top,env_hh;
|
||||
int whitenoise = (rand()&1)*(WHITE_NOISE_db/EG_STEP);
|
||||
@@ -715,7 +716,7 @@ static void OPLCloseTable( void )
|
||||
}
|
||||
|
||||
/* CSM Key Control */
|
||||
static inline void CSMKeyControll(OPL_CH *CH)
|
||||
INLINE void CSMKeyControll(OPL_CH *CH)
|
||||
{
|
||||
OPL_SLOT *slot1 = &CH->SLOT[SLOT1];
|
||||
OPL_SLOT *slot2 = &CH->SLOT[SLOT2];
|
||||
|
@@ -817,11 +817,14 @@ static int blk_connect(struct XenDevice *xendev)
|
||||
index = (blkdev->xendev.dev - 202 * 256) / 16;
|
||||
blkdev->dinfo = drive_get(IF_XEN, 0, index);
|
||||
if (!blkdev->dinfo) {
|
||||
Error *local_err = NULL;
|
||||
/* setup via xenbus -> create new block driver instance */
|
||||
xen_be_printf(&blkdev->xendev, 2, "create new bdrv (xenbus setup)\n");
|
||||
blkdev->bs = bdrv_new(blkdev->dev);
|
||||
blkdev->bs = bdrv_new(blkdev->dev, &local_err);
|
||||
if (local_err) {
|
||||
blkdev->bs = NULL;
|
||||
}
|
||||
if (blkdev->bs) {
|
||||
Error *local_err = NULL;
|
||||
BlockDriver *drv = bdrv_find_whitelisted_format(blkdev->fileproto,
|
||||
readonly);
|
||||
if (bdrv_open(&blkdev->bs, blkdev->filename, NULL, NULL, qflags,
|
||||
|
@@ -175,10 +175,8 @@ static void uart_send_breaks(UartState *s)
|
||||
{
|
||||
int break_enabled = 1;
|
||||
|
||||
if (s->chr) {
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
|
||||
&break_enabled);
|
||||
}
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_BREAK,
|
||||
&break_enabled);
|
||||
}
|
||||
|
||||
static void uart_parameters_setup(UartState *s)
|
||||
@@ -229,9 +227,7 @@ static void uart_parameters_setup(UartState *s)
|
||||
|
||||
packet_size += ssp.data_bits + ssp.stop_bits;
|
||||
s->char_tx_time = (get_ticks_per_sec() / ssp.speed) * packet_size;
|
||||
if (s->chr) {
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
|
||||
}
|
||||
qemu_chr_fe_ioctl(s->chr, CHR_IOCTL_SERIAL_SET_PARAMS, &ssp);
|
||||
}
|
||||
|
||||
static int uart_can_receive(void *opaque)
|
||||
@@ -299,7 +295,6 @@ static gboolean cadence_uart_xmit(GIOChannel *chan, GIOCondition cond,
|
||||
/* instant drain the fifo when there's no back-end */
|
||||
if (!s->chr) {
|
||||
s->tx_count = 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!s->tx_count) {
|
||||
@@ -379,9 +374,7 @@ static void uart_read_rx_fifo(UartState *s, uint32_t *c)
|
||||
*c = s->rx_fifo[rx_rpos];
|
||||
s->rx_count--;
|
||||
|
||||
if (s->chr) {
|
||||
qemu_chr_accept_input(s->chr);
|
||||
}
|
||||
qemu_chr_accept_input(s->chr);
|
||||
} else {
|
||||
*c = 0;
|
||||
}
|
||||
|
@@ -670,7 +670,6 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
|
||||
uint32_t max_nr_ports, nr_active_ports, ports_map;
|
||||
unsigned int i;
|
||||
int ret;
|
||||
uint32_t tmp;
|
||||
|
||||
if (version_id > 3) {
|
||||
return -EINVAL;
|
||||
@@ -686,12 +685,17 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Unused */
|
||||
qemu_get_be16s(f, (uint16_t *) &tmp);
|
||||
qemu_get_be16s(f, (uint16_t *) &tmp);
|
||||
qemu_get_be32s(f, &tmp);
|
||||
/* The config space */
|
||||
qemu_get_be16s(f, &s->config.cols);
|
||||
qemu_get_be16s(f, &s->config.rows);
|
||||
|
||||
qemu_get_be32s(f, &max_nr_ports);
|
||||
tswap32s(&max_nr_ports);
|
||||
if (max_nr_ports > tswap32(s->config.max_nr_ports)) {
|
||||
/* Source could have had more ports than us. Fail migration. */
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
max_nr_ports = tswap32(s->config.max_nr_ports);
|
||||
for (i = 0; i < (max_nr_ports + 31) / 32; i++) {
|
||||
qemu_get_be32s(f, &ports_map);
|
||||
|
||||
|
@@ -102,7 +102,7 @@ qemu_irq qemu_irq_invert(qemu_irq irq)
|
||||
{
|
||||
/* The default state for IRQs is low, so raise the output now. */
|
||||
qemu_irq_raise(irq);
|
||||
return qemu_allocate_irq(qemu_notirq, irq, 0);
|
||||
return qemu_allocate_irqs(qemu_notirq, irq, 1)[0];
|
||||
}
|
||||
|
||||
static void qemu_splitirq(void *opaque, int line, int level)
|
||||
@@ -117,7 +117,7 @@ qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)
|
||||
qemu_irq *s = g_malloc0(2 * sizeof(qemu_irq));
|
||||
s[0] = irq1;
|
||||
s[1] = irq2;
|
||||
return qemu_allocate_irq(qemu_splitirq, s, 0);
|
||||
return qemu_allocate_irqs(qemu_splitirq, s, 1)[0];
|
||||
}
|
||||
|
||||
static void proxy_irq_handler(void *opaque, int n, int level)
|
||||
|
@@ -174,14 +174,14 @@ int qdev_init(DeviceState *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void device_realize(DeviceState *dev, Error **errp)
|
||||
static void device_realize(DeviceState *dev, Error **err)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
||||
|
||||
if (dc->init) {
|
||||
int rc = dc->init(dev);
|
||||
if (rc < 0) {
|
||||
error_setg(errp, "Device initialization failed.");
|
||||
error_setg(err, "Device initialization failed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -504,46 +504,43 @@ static void bus_unparent(Object *obj)
|
||||
}
|
||||
}
|
||||
|
||||
static bool bus_get_realized(Object *obj, Error **errp)
|
||||
static bool bus_get_realized(Object *obj, Error **err)
|
||||
{
|
||||
BusState *bus = BUS(obj);
|
||||
|
||||
return bus->realized;
|
||||
}
|
||||
|
||||
static void bus_set_realized(Object *obj, bool value, Error **errp)
|
||||
static void bus_set_realized(Object *obj, bool value, Error **err)
|
||||
{
|
||||
BusState *bus = BUS(obj);
|
||||
BusClass *bc = BUS_GET_CLASS(bus);
|
||||
BusChild *kid;
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (value && !bus->realized) {
|
||||
if (bc->realize) {
|
||||
bc->realize(bus, &local_err);
|
||||
}
|
||||
|
||||
/* TODO: recursive realization */
|
||||
} else if (!value && bus->realized) {
|
||||
QTAILQ_FOREACH(kid, &bus->children, sibling) {
|
||||
DeviceState *dev = kid->child;
|
||||
object_property_set_bool(OBJECT(dev), false, "realized",
|
||||
&local_err);
|
||||
if (local_err != NULL) {
|
||||
break;
|
||||
goto error;
|
||||
}
|
||||
|
||||
}
|
||||
} else if (!value && bus->realized) {
|
||||
if (bc->unrealize) {
|
||||
bc->unrealize(bus, &local_err);
|
||||
|
||||
if (local_err != NULL) {
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
if (bc->unrealize && local_err == NULL) {
|
||||
bc->unrealize(bus, &local_err);
|
||||
}
|
||||
}
|
||||
|
||||
if (local_err != NULL) {
|
||||
error_propagate(errp, local_err);
|
||||
return;
|
||||
}
|
||||
|
||||
bus->realized = value;
|
||||
return;
|
||||
|
||||
error:
|
||||
error_propagate(err, local_err);
|
||||
}
|
||||
|
||||
void qbus_create_inplace(void *bus, size_t size, const char *typename,
|
||||
@@ -727,13 +724,13 @@ void qdev_property_add_static(DeviceState *dev, Property *prop,
|
||||
}
|
||||
}
|
||||
|
||||
static bool device_get_realized(Object *obj, Error **errp)
|
||||
static bool device_get_realized(Object *obj, Error **err)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
return dev->realized;
|
||||
}
|
||||
|
||||
static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
static void device_set_realized(Object *obj, bool value, Error **err)
|
||||
{
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(dev);
|
||||
@@ -741,7 +738,7 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
Error *local_err = NULL;
|
||||
|
||||
if (dev->hotplugged && !dc->hotpluggable) {
|
||||
error_set(errp, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
error_set(err, QERR_DEVICE_NO_HOTPLUG, object_get_typename(obj));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -800,14 +797,14 @@ static void device_set_realized(Object *obj, bool value, Error **errp)
|
||||
}
|
||||
|
||||
if (local_err != NULL) {
|
||||
error_propagate(errp, local_err);
|
||||
error_propagate(err, local_err);
|
||||
return;
|
||||
}
|
||||
|
||||
dev->realized = value;
|
||||
}
|
||||
|
||||
static bool device_get_hotpluggable(Object *obj, Error **errp)
|
||||
static bool device_get_hotpluggable(Object *obj, Error **err)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_GET_CLASS(obj);
|
||||
DeviceState *dev = DEVICE(obj);
|
||||
|
@@ -2913,7 +2913,7 @@ static void isa_cirrus_vga_realizefn(DeviceState *dev, Error **errp)
|
||||
ISACirrusVGAState *d = ISA_CIRRUS_VGA(dev);
|
||||
VGACommonState *s = &d->cirrus_vga.vga;
|
||||
|
||||
vga_common_init(s, OBJECT(dev));
|
||||
vga_common_init(s, OBJECT(dev), true);
|
||||
cirrus_init_common(&d->cirrus_vga, OBJECT(dev), CIRRUS_ID_CLGD5430, 0,
|
||||
isa_address_space(isadev),
|
||||
isa_address_space_io(isadev));
|
||||
@@ -2960,7 +2960,7 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
|
||||
int16_t device_id = pc->device_id;
|
||||
|
||||
/* setup VGA */
|
||||
vga_common_init(&s->vga, OBJECT(dev));
|
||||
vga_common_init(&s->vga, OBJECT(dev), true);
|
||||
cirrus_init_common(s, OBJECT(dev), device_id, 1, pci_address_space(dev),
|
||||
pci_address_space_io(dev));
|
||||
s->vga.con = graphic_console_init(DEVICE(dev), 0, s->vga.hw_ops, &s->vga);
|
||||
|
@@ -2061,7 +2061,7 @@ static int qxl_init_primary(PCIDevice *dev)
|
||||
qxl->id = 0;
|
||||
qxl_init_ramsize(qxl);
|
||||
vga->vram_size_mb = qxl->vga.vram_size >> 20;
|
||||
vga_common_init(vga, OBJECT(dev));
|
||||
vga_common_init(vga, OBJECT(dev), true);
|
||||
vga_init(vga, OBJECT(dev),
|
||||
pci_address_space(dev), pci_address_space_io(dev), false);
|
||||
portio_list_init(qxl_vga_port_list, OBJECT(dev), qxl_vga_portio_list,
|
||||
|
@@ -312,42 +312,18 @@ static int ssd0323_load(QEMUFile *f, void *opaque, int version_id)
|
||||
return -EINVAL;
|
||||
|
||||
s->cmd_len = qemu_get_be32(f);
|
||||
if (s->cmd_len < 0 || s->cmd_len > ARRAY_SIZE(s->cmd_data)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->cmd = qemu_get_be32(f);
|
||||
for (i = 0; i < 8; i++)
|
||||
s->cmd_data[i] = qemu_get_be32(f);
|
||||
s->row = qemu_get_be32(f);
|
||||
if (s->row < 0 || s->row >= 80) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->row_start = qemu_get_be32(f);
|
||||
if (s->row_start < 0 || s->row_start >= 80) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->row_end = qemu_get_be32(f);
|
||||
if (s->row_end < 0 || s->row_end >= 80) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->col = qemu_get_be32(f);
|
||||
if (s->col < 0 || s->col >= 64) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->col_start = qemu_get_be32(f);
|
||||
if (s->col_start < 0 || s->col_start >= 64) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->col_end = qemu_get_be32(f);
|
||||
if (s->col_end < 0 || s->col_end >= 64) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->redraw = qemu_get_be32(f);
|
||||
s->remap = qemu_get_be32(f);
|
||||
s->mode = qemu_get_be32(f);
|
||||
if (s->mode != SSD0323_CMD && s->mode != SSD0323_DATA) {
|
||||
return -EINVAL;
|
||||
}
|
||||
qemu_get_buffer(f, s->framebuffer, sizeof(s->framebuffer));
|
||||
|
||||
ss->cs = qemu_get_be32(f);
|
||||
|
@@ -132,7 +132,7 @@ int isa_vga_mm_init(hwaddr vram_base,
|
||||
s = g_malloc0(sizeof(*s));
|
||||
|
||||
s->vga.vram_size_mb = VGA_RAM_SIZE >> 20;
|
||||
vga_common_init(&s->vga, NULL);
|
||||
vga_common_init(&s->vga, NULL, true);
|
||||
vga_mm_init(s, vram_base, ctrl_base, it_shift, address_space);
|
||||
|
||||
s->vga.con = graphic_console_init(NULL, 0, s->vga.hw_ops, s);
|
||||
|
@@ -56,7 +56,7 @@ static void vga_isa_realizefn(DeviceState *dev, Error **errp)
|
||||
MemoryRegion *vga_io_memory;
|
||||
const MemoryRegionPortio *vga_ports, *vbe_ports;
|
||||
|
||||
vga_common_init(s, OBJECT(dev));
|
||||
vga_common_init(s, OBJECT(dev), true);
|
||||
s->legacy_address_space = isa_address_space(isadev);
|
||||
vga_io_memory = vga_init_io(s, OBJECT(dev), &vga_ports, &vbe_ports);
|
||||
isa_register_portio_list(isadev, 0x3b0, vga_ports, s, "vga");
|
||||
|
@@ -147,7 +147,7 @@ static int pci_std_vga_initfn(PCIDevice *dev)
|
||||
VGACommonState *s = &d->vga;
|
||||
|
||||
/* vga + console init */
|
||||
vga_common_init(s, OBJECT(dev));
|
||||
vga_common_init(s, OBJECT(dev), true);
|
||||
vga_init(s, OBJECT(dev), pci_address_space(dev), pci_address_space_io(dev),
|
||||
true);
|
||||
|
||||
@@ -179,12 +179,51 @@ static int pci_std_vga_initfn(PCIDevice *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pci_secondary_vga_initfn(PCIDevice *dev)
|
||||
{
|
||||
PCIVGAState *d = DO_UPCAST(PCIVGAState, dev, dev);
|
||||
VGACommonState *s = &d->vga;
|
||||
|
||||
/* vga + console init */
|
||||
vga_common_init(s, OBJECT(dev), false);
|
||||
s->con = graphic_console_init(DEVICE(dev), 0, s->hw_ops, s);
|
||||
|
||||
/* mmio bar */
|
||||
memory_region_init(&d->mmio, OBJECT(dev), "vga.mmio", 4096);
|
||||
memory_region_init_io(&d->ioport, OBJECT(dev), &pci_vga_ioport_ops, d,
|
||||
"vga ioports remapped", PCI_VGA_IOPORT_SIZE);
|
||||
memory_region_init_io(&d->bochs, OBJECT(dev), &pci_vga_bochs_ops, d,
|
||||
"bochs dispi interface", PCI_VGA_BOCHS_SIZE);
|
||||
|
||||
memory_region_add_subregion(&d->mmio, PCI_VGA_IOPORT_OFFSET,
|
||||
&d->ioport);
|
||||
memory_region_add_subregion(&d->mmio, PCI_VGA_BOCHS_OFFSET,
|
||||
&d->bochs);
|
||||
|
||||
pci_register_bar(&d->dev, 0, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->vram);
|
||||
pci_register_bar(&d->dev, 2, PCI_BASE_ADDRESS_SPACE_MEMORY, &d->mmio);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pci_secondary_vga_reset(DeviceState *dev)
|
||||
{
|
||||
PCIVGAState *d = DO_UPCAST(PCIVGAState, dev.qdev, dev);
|
||||
|
||||
vga_common_reset(&d->vga);
|
||||
}
|
||||
|
||||
static Property vga_pci_properties[] = {
|
||||
DEFINE_PROP_UINT32("vgamem_mb", PCIVGAState, vga.vram_size_mb, 16),
|
||||
DEFINE_PROP_BIT("mmio", PCIVGAState, flags, PCI_VGA_FLAG_ENABLE_MMIO, true),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static Property secondary_pci_properties[] = {
|
||||
DEFINE_PROP_UINT32("vgamem_mb", PCIVGAState, vga.vram_size_mb, 16),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static void vga_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
@@ -201,6 +240,20 @@ static void vga_class_init(ObjectClass *klass, void *data)
|
||||
set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
|
||||
}
|
||||
|
||||
static void secondary_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
PCIDeviceClass *k = PCI_DEVICE_CLASS(klass);
|
||||
|
||||
k->init = pci_secondary_vga_initfn;
|
||||
k->vendor_id = PCI_VENDOR_ID_QEMU;
|
||||
k->device_id = PCI_DEVICE_ID_QEMU_VGA;
|
||||
k->class_id = PCI_CLASS_DISPLAY_OTHER;
|
||||
dc->vmsd = &vmstate_vga_pci;
|
||||
dc->props = secondary_pci_properties;
|
||||
dc->reset = pci_secondary_vga_reset;
|
||||
}
|
||||
|
||||
static const TypeInfo vga_info = {
|
||||
.name = "VGA",
|
||||
.parent = TYPE_PCI_DEVICE,
|
||||
@@ -208,9 +261,17 @@ static const TypeInfo vga_info = {
|
||||
.class_init = vga_class_init,
|
||||
};
|
||||
|
||||
static const TypeInfo secondary_info = {
|
||||
.name = "secondary-vga",
|
||||
.parent = TYPE_PCI_DEVICE,
|
||||
.instance_size = sizeof(PCIVGAState),
|
||||
.class_init = secondary_class_init,
|
||||
};
|
||||
|
||||
static void vga_register_types(void)
|
||||
{
|
||||
type_register_static(&vga_info);
|
||||
type_register_static(&secondary_info);
|
||||
}
|
||||
|
||||
type_init(vga_register_types)
|
||||
|
@@ -171,6 +171,10 @@ static void vga_update_memory_access(VGACommonState *s)
|
||||
MemoryRegion *region, *old_region = s->chain4_alias;
|
||||
hwaddr base, offset, size;
|
||||
|
||||
if (s->legacy_address_space == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
s->chain4_alias = NULL;
|
||||
|
||||
if ((s->sr[VGA_SEQ_PLANE_WRITE] & VGA_SR02_ALL_PLANES) ==
|
||||
@@ -2252,7 +2256,7 @@ static const GraphicHwOps vga_ops = {
|
||||
.text_update = vga_update_text,
|
||||
};
|
||||
|
||||
void vga_common_init(VGACommonState *s, Object *obj)
|
||||
void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate)
|
||||
{
|
||||
int i, j, v, b;
|
||||
|
||||
@@ -2289,7 +2293,7 @@ void vga_common_init(VGACommonState *s, Object *obj)
|
||||
|
||||
s->is_vbe_vmstate = 1;
|
||||
memory_region_init_ram(&s->vram, obj, "vga.vram", s->vram_size);
|
||||
vmstate_register_ram_global(&s->vram);
|
||||
vmstate_register_ram(&s->vram, global_vmstate ? NULL : DEVICE(obj));
|
||||
xen_register_framebuffer(&s->vram);
|
||||
s->vram_ptr = memory_region_get_ram_ptr(&s->vram);
|
||||
s->get_bpp = vga_get_bpp;
|
||||
|
@@ -177,7 +177,7 @@ static inline int c6_to_8(int v)
|
||||
return (v << 2) | (b << 1) | b;
|
||||
}
|
||||
|
||||
void vga_common_init(VGACommonState *s, Object *obj);
|
||||
void vga_common_init(VGACommonState *s, Object *obj, bool global_vmstate);
|
||||
void vga_init(VGACommonState *s, Object *obj, MemoryRegion *address_space,
|
||||
MemoryRegion *address_space_io, bool init_vga_ports);
|
||||
MemoryRegion *vga_init_io(VGACommonState *s, Object *obj,
|
||||
|
@@ -1207,7 +1207,7 @@ static void vmsvga_init(DeviceState *dev, struct vmsvga_state_s *s,
|
||||
vmstate_register_ram_global(&s->fifo_ram);
|
||||
s->fifo_ptr = memory_region_get_ram_ptr(&s->fifo_ram);
|
||||
|
||||
vga_common_init(&s->vga, OBJECT(dev));
|
||||
vga_common_init(&s->vga, OBJECT(dev), true);
|
||||
vga_init(&s->vga, OBJECT(dev), address_space, io, true);
|
||||
vmstate_register(NULL, 0, &vmstate_vga_common, &s->vga);
|
||||
s->new_depth = 32;
|
||||
|
@@ -1660,7 +1660,7 @@ struct soc_dma_s *omap_dma_init(hwaddr base, qemu_irq *irqs,
|
||||
}
|
||||
|
||||
omap_dma_setcaps(s);
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irq(omap_dma_clk_update, s, 0));
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irqs(omap_dma_clk_update, s, 1)[0]);
|
||||
omap_dma_reset(s->dma);
|
||||
omap_dma_clk_update(s, 0, 1);
|
||||
|
||||
@@ -2082,7 +2082,7 @@ struct soc_dma_s *omap_dma4_init(hwaddr base, qemu_irq *irqs,
|
||||
s->intr_update = omap_dma_interrupts_4_update;
|
||||
|
||||
omap_dma_setcaps(s);
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irq(omap_dma_clk_update, s, 0));
|
||||
omap_clk_adduser(s->clk, qemu_allocate_irqs(omap_dma_clk_update, s, 1)[0]);
|
||||
omap_dma_reset(s->dma);
|
||||
omap_dma_clk_update(s, 0, !!s->dma->freq);
|
||||
|
||||
|
@@ -203,15 +203,6 @@ static bool is_version_0 (void *opaque, int version_id)
|
||||
return version_id == 0;
|
||||
}
|
||||
|
||||
static bool vmstate_scoop_validate(void *opaque, int version_id)
|
||||
{
|
||||
ScoopInfo *s = opaque;
|
||||
|
||||
return !(s->prev_level & 0xffff0000) &&
|
||||
!(s->gpio_level & 0xffff0000) &&
|
||||
!(s->gpio_dir & 0xffff0000);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_scoop_regs = {
|
||||
.name = "scoop",
|
||||
.version_id = 1,
|
||||
@@ -224,7 +215,6 @@ static const VMStateDescription vmstate_scoop_regs = {
|
||||
VMSTATE_UINT32(gpio_level, ScoopInfo),
|
||||
VMSTATE_UINT32(gpio_dir, ScoopInfo),
|
||||
VMSTATE_UINT32(prev_level, ScoopInfo),
|
||||
VMSTATE_VALIDATE("irq levels are 16 bit", vmstate_scoop_validate),
|
||||
VMSTATE_UINT16(mcr, ScoopInfo),
|
||||
VMSTATE_UINT16(cdr, ScoopInfo),
|
||||
VMSTATE_UINT16(ccr, ScoopInfo),
|
||||
|
@@ -71,7 +71,7 @@ static void eeprom_write_data(SMBusDevice *dev, uint8_t cmd, uint8_t *buf, int l
|
||||
printf("eeprom_write_byte: addr=0x%02x cmd=0x%02x val=0x%02x\n",
|
||||
dev->i2c.address, cmd, buf[0]);
|
||||
#endif
|
||||
/* An page write operation is not a valid SMBus command.
|
||||
/* A page write operation is not a valid SMBus command.
|
||||
It is a block write without a length byte. Fortunately we
|
||||
get the full block anyway. */
|
||||
/* TODO: Should this set the current location? */
|
||||
|
@@ -1410,16 +1410,15 @@ void acpi_build(PcGuestInfo *guest_info, AcpiBuildTables *tables)
|
||||
/* ACPI tables pointed to by RSDT */
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
build_fadt(tables->table_data, tables->linker, &pm, facs, dsdt);
|
||||
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
|
||||
build_ssdt(tables->table_data, tables->linker, &cpu, &pm, &misc, &pci,
|
||||
guest_info);
|
||||
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
build_madt(tables->table_data, tables->linker, &cpu, guest_info);
|
||||
|
||||
build_madt(tables->table_data, tables->linker, &cpu, guest_info);
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
if (misc.has_hpet) {
|
||||
acpi_add_table(table_offsets, tables->table_data);
|
||||
build_hpet(tables->table_data, tables->linker);
|
||||
}
|
||||
if (guest_info->numa_nodes) {
|
||||
|
@@ -1258,7 +1258,6 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
|
||||
if (pos != 0 && kvm_device_msix_supported(kvm_state)) {
|
||||
int bar_nr;
|
||||
uint32_t msix_table_entry;
|
||||
uint16_t msix_max;
|
||||
|
||||
if (!check_irqchip_in_kernel()) {
|
||||
return -ENOTSUP;
|
||||
@@ -1270,10 +1269,9 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
|
||||
}
|
||||
pci_dev->msix_cap = pos;
|
||||
|
||||
msix_max = (pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) &
|
||||
PCI_MSIX_FLAGS_QSIZE) + 1;
|
||||
msix_max = MIN(msix_max, KVM_MAX_MSIX_PER_DEV);
|
||||
pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS, msix_max - 1);
|
||||
pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS,
|
||||
pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) &
|
||||
PCI_MSIX_FLAGS_QSIZE);
|
||||
|
||||
/* Only enable and function mask bits are writable */
|
||||
pci_set_word(pci_dev->wmask + pos + PCI_MSIX_FLAGS,
|
||||
@@ -1283,7 +1281,9 @@ static int assigned_device_pci_cap_init(PCIDevice *pci_dev)
|
||||
bar_nr = msix_table_entry & PCI_MSIX_FLAGS_BIRMASK;
|
||||
msix_table_entry &= ~PCI_MSIX_FLAGS_BIRMASK;
|
||||
dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry;
|
||||
dev->msix_max = msix_max;
|
||||
dev->msix_max = pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS);
|
||||
dev->msix_max &= PCI_MSIX_FLAGS_QSIZE;
|
||||
dev->msix_max += 1;
|
||||
}
|
||||
|
||||
/* Minimal PM support, nothing writable, device appears to NAK changes */
|
||||
|
@@ -655,7 +655,7 @@ static FWCfgState *bochs_bios_init(void)
|
||||
acpi_tables, acpi_tables_len);
|
||||
fw_cfg_add_i32(fw_cfg, FW_CFG_IRQ0_OVERRIDE, kvm_allows_irq0_override());
|
||||
|
||||
smbios_table = smbios_get_table_legacy(&smbios_len);
|
||||
smbios_table = smbios_get_table(&smbios_len);
|
||||
if (smbios_table)
|
||||
fw_cfg_add_bytes(fw_cfg, FW_CFG_SMBIOS_ENTRIES,
|
||||
smbios_table, smbios_len);
|
||||
|
@@ -60,7 +60,7 @@ static const int ide_irq[MAX_IDE_BUS] = { 14, 15 };
|
||||
|
||||
static bool has_pci_info;
|
||||
static bool has_acpi_build = true;
|
||||
static bool smbios_defaults = true;
|
||||
static bool smbios_type1_defaults = true;
|
||||
/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
|
||||
* host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
|
||||
* pages in the host.
|
||||
@@ -143,10 +143,10 @@ static void pc_init1(QEMUMachineInitArgs *args,
|
||||
guest_info->has_pci_info = has_pci_info;
|
||||
guest_info->isapc_ram_fw = !pci_enabled;
|
||||
|
||||
if (smbios_defaults) {
|
||||
if (smbios_type1_defaults) {
|
||||
/* These values are guest ABI, do not change */
|
||||
smbios_set_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
|
||||
args->machine->name);
|
||||
smbios_set_type1_defaults("QEMU", "Standard PC (i440FX + PIIX, 1996)",
|
||||
args->machine->name);
|
||||
}
|
||||
|
||||
/* allocate ram and load rom/bios */
|
||||
@@ -264,7 +264,7 @@ static void pc_init_pci(QEMUMachineInitArgs *args)
|
||||
|
||||
static void pc_compat_1_7(QEMUMachineInitArgs *args)
|
||||
{
|
||||
smbios_defaults = false;
|
||||
smbios_type1_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
|
||||
@@ -345,10 +345,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
|
||||
{
|
||||
has_pci_info = false;
|
||||
has_acpi_build = false;
|
||||
smbios_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
rom_file_has_mr = false;
|
||||
smbios_type1_defaults = false;
|
||||
x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI);
|
||||
enable_compat_apic_id_mode();
|
||||
pc_init1(args, 1, 0);
|
||||
@@ -358,10 +355,7 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
|
||||
{
|
||||
has_pci_info = false;
|
||||
has_acpi_build = false;
|
||||
smbios_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
rom_file_has_mr = false;
|
||||
smbios_type1_defaults = false;
|
||||
if (!args->cpu_model) {
|
||||
args->cpu_model = "486";
|
||||
}
|
||||
|
@@ -50,7 +50,7 @@
|
||||
|
||||
static bool has_pci_info;
|
||||
static bool has_acpi_build = true;
|
||||
static bool smbios_defaults = true;
|
||||
static bool smbios_type1_defaults = true;
|
||||
/* Make sure that guest addresses aligned at 1Gbyte boundaries get mapped to
|
||||
* host addresses aligned at 1Gbyte boundaries. This way we can use 1GByte
|
||||
* pages in the host.
|
||||
@@ -130,10 +130,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
||||
guest_info->isapc_ram_fw = false;
|
||||
guest_info->has_acpi_build = has_acpi_build;
|
||||
|
||||
if (smbios_defaults) {
|
||||
if (smbios_type1_defaults) {
|
||||
/* These values are guest ABI, do not change */
|
||||
smbios_set_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
|
||||
args->machine->name);
|
||||
smbios_set_type1_defaults("QEMU", "Standard PC (Q35 + ICH9, 2009)",
|
||||
args->machine->name);
|
||||
}
|
||||
|
||||
/* allocate ram and load rom/bios */
|
||||
@@ -242,7 +242,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)
|
||||
|
||||
static void pc_compat_1_7(QEMUMachineInitArgs *args)
|
||||
{
|
||||
smbios_defaults = false;
|
||||
smbios_type1_defaults = false;
|
||||
gigabyte_align = false;
|
||||
option_rom_has_mr = true;
|
||||
x86_cpu_compat_disable_kvm_features(FEAT_1_ECX, CPUID_EXT_X2APIC);
|
||||
@@ -351,7 +351,7 @@ static QEMUMachine pc_q35_machine_v1_4 = {
|
||||
.name = "pc-q35-1.4",
|
||||
.init = pc_q35_init_1_4,
|
||||
.compat_props = (GlobalProperty[]) {
|
||||
PC_Q35_COMPAT_1_4,
|
||||
PC_COMPAT_1_4,
|
||||
{ /* end of list */ }
|
||||
},
|
||||
};
|
||||
|
@@ -21,8 +21,9 @@
|
||||
#include "hw/i386/smbios.h"
|
||||
#include "hw/loader.h"
|
||||
|
||||
|
||||
/* legacy structures and constants for <= 2.0 machines */
|
||||
/*
|
||||
* Structures shared with the BIOS
|
||||
*/
|
||||
struct smbios_header {
|
||||
uint16_t length;
|
||||
uint8_t type;
|
||||
@@ -45,9 +46,6 @@ struct smbios_table {
|
||||
|
||||
static uint8_t *smbios_entries;
|
||||
static size_t smbios_entries_len;
|
||||
/* end: legacy structures & constants for <= 2.0 machines */
|
||||
|
||||
|
||||
static int smbios_type4_count = 0;
|
||||
static bool smbios_immutable;
|
||||
|
||||
@@ -189,8 +187,6 @@ static void smbios_check_collision(int type, int entry)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* legacy setup functions for <= 2.0 machines */
|
||||
static void smbios_add_field(int type, int offset, const void *data, size_t len)
|
||||
{
|
||||
struct smbios_field *field;
|
||||
@@ -260,8 +256,8 @@ static void smbios_build_type_1_fields(void)
|
||||
}
|
||||
}
|
||||
|
||||
void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
const char *version)
|
||||
void smbios_set_type1_defaults(const char *manufacturer,
|
||||
const char *product, const char *version)
|
||||
{
|
||||
if (!type1.manufacturer) {
|
||||
type1.manufacturer = manufacturer;
|
||||
@@ -274,7 +270,7 @@ void smbios_set_defaults(const char *manufacturer, const char *product,
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t *smbios_get_table_legacy(size_t *length)
|
||||
uint8_t *smbios_get_table(size_t *length)
|
||||
{
|
||||
if (!smbios_immutable) {
|
||||
smbios_build_type_0_fields();
|
||||
@@ -285,8 +281,6 @@ uint8_t *smbios_get_table_legacy(size_t *length)
|
||||
*length = smbios_entries_len;
|
||||
return smbios_entries;
|
||||
}
|
||||
/* end: legacy setup functions for <= 2.0 machines */
|
||||
|
||||
|
||||
static void save_opt(const char **dest, QemuOpts *opts, const char *name)
|
||||
{
|
||||
|
@@ -438,9 +438,9 @@ static void check_cmd(AHCIState *s, int port)
|
||||
|
||||
if ((pr->cmd & PORT_CMD_START) && pr->cmd_issue) {
|
||||
for (slot = 0; (slot < 32) && pr->cmd_issue; slot++) {
|
||||
if ((pr->cmd_issue & (1 << slot)) &&
|
||||
if ((pr->cmd_issue & (1U << slot)) &&
|
||||
!handle_cmd(s, port, slot)) {
|
||||
pr->cmd_issue &= ~(1 << slot);
|
||||
pr->cmd_issue &= ~(1U << slot);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1293,7 +1293,7 @@ const VMStateDescription vmstate_ahci = {
|
||||
VMSTATE_UINT32(control_regs.impl, AHCIState),
|
||||
VMSTATE_UINT32(control_regs.version, AHCIState),
|
||||
VMSTATE_UINT32(idp_index, AHCIState),
|
||||
VMSTATE_INT32_EQUAL(ports, AHCIState),
|
||||
VMSTATE_INT32(ports, AHCIState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
};
|
||||
|
@@ -594,7 +594,7 @@ static void microdrive_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
MicroDriveState *md = MICRODRIVE(dev);
|
||||
|
||||
ide_init2(&md->bus, qemu_allocate_irq(md_set_irq, md, 0));
|
||||
ide_init2(&md->bus, qemu_allocate_irqs(md_set_irq, md, 1)[0]);
|
||||
}
|
||||
|
||||
static void microdrive_init(Object *obj)
|
||||
|
@@ -1070,21 +1070,9 @@ static int tsc210x_load(QEMUFile *f, void *opaque, int version_id)
|
||||
s->enabled = qemu_get_byte(f);
|
||||
s->host_mode = qemu_get_byte(f);
|
||||
s->function = qemu_get_byte(f);
|
||||
if (s->function < 0 || s->function >= ARRAY_SIZE(mode_regs)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->nextfunction = qemu_get_byte(f);
|
||||
if (s->nextfunction < 0 || s->nextfunction >= ARRAY_SIZE(mode_regs)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->precision = qemu_get_byte(f);
|
||||
if (s->precision < 0 || s->precision >= ARRAY_SIZE(resolution)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->nextprecision = qemu_get_byte(f);
|
||||
if (s->nextprecision < 0 || s->nextprecision >= ARRAY_SIZE(resolution)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->filter = qemu_get_byte(f);
|
||||
s->pin_func = qemu_get_byte(f);
|
||||
s->ref = qemu_get_byte(f);
|
||||
|
@@ -23,11 +23,20 @@
|
||||
static void aw_a10_pic_update(AwA10PICState *s)
|
||||
{
|
||||
uint8_t i;
|
||||
int irq = 0, fiq = 0;
|
||||
int irq = 0, fiq = 0, pending;
|
||||
|
||||
s->vector = 0;
|
||||
|
||||
for (i = 0; i < AW_A10_PIC_REG_NUM; i++) {
|
||||
irq |= s->irq_pending[i] & ~s->mask[i];
|
||||
fiq |= s->select[i] & s->irq_pending[i] & ~s->mask[i];
|
||||
|
||||
if (!s->vector) {
|
||||
pending = ffs(s->irq_pending[i] & ~s->mask[i]);
|
||||
if (pending) {
|
||||
s->vector = (i * 32 + pending - 1) * 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qemu_set_irq(s->parent_irq, !!irq);
|
||||
@@ -40,6 +49,8 @@ static void aw_a10_pic_set_irq(void *opaque, int irq, int level)
|
||||
|
||||
if (level) {
|
||||
set_bit(irq % 32, (void *)&s->irq_pending[irq / 32]);
|
||||
} else {
|
||||
clear_bit(irq % 32, (void *)&s->irq_pending[irq / 32]);
|
||||
}
|
||||
aw_a10_pic_update(s);
|
||||
}
|
||||
@@ -84,9 +95,6 @@ static void aw_a10_pic_write(void *opaque, hwaddr offset, uint64_t value,
|
||||
uint8_t index = (offset & 0xc) / 4;
|
||||
|
||||
switch (offset) {
|
||||
case AW_A10_PIC_VECTOR:
|
||||
s->vector = value & ~0x3;
|
||||
break;
|
||||
case AW_A10_PIC_BASE_ADDR:
|
||||
s->base_addr = value & ~0x3;
|
||||
case AW_A10_PIC_PROTECT:
|
||||
@@ -96,7 +104,11 @@ static void aw_a10_pic_write(void *opaque, hwaddr offset, uint64_t value,
|
||||
s->nmi = value;
|
||||
break;
|
||||
case AW_A10_PIC_IRQ_PENDING ... AW_A10_PIC_IRQ_PENDING + 8:
|
||||
s->irq_pending[index] &= ~value;
|
||||
/*
|
||||
* The register is read-only; nevertheless, Linux (including
|
||||
* the version originally shipped by Allwinner) pretends to
|
||||
* write to the register. Just ignore it.
|
||||
*/
|
||||
break;
|
||||
case AW_A10_PIC_FIQ_PENDING ... AW_A10_PIC_FIQ_PENDING + 8:
|
||||
s->fiq_pending[index] &= ~value;
|
||||
|
@@ -412,7 +412,7 @@ static const MemoryRegionOps pic_elcr_ioport_ops = {
|
||||
},
|
||||
};
|
||||
|
||||
static void pic_realize(DeviceState *dev, Error **errp)
|
||||
static void pic_realize(DeviceState *dev, Error **err)
|
||||
{
|
||||
PICCommonState *s = PIC_COMMON(dev);
|
||||
PICClass *pc = PIC_GET_CLASS(dev);
|
||||
@@ -425,7 +425,7 @@ static void pic_realize(DeviceState *dev, Error **errp)
|
||||
qdev_init_gpio_out(dev, s->int_out, ARRAY_SIZE(s->int_out));
|
||||
qdev_init_gpio_in(dev, pic_set_irq, 8);
|
||||
|
||||
pc->parent_realize(dev, errp);
|
||||
pc->parent_realize(dev, err);
|
||||
}
|
||||
|
||||
void pic_info(Monitor *mon, const QDict *qdict)
|
||||
|
@@ -41,7 +41,6 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "hw/pci/msi.h"
|
||||
#include "qemu/bitops.h"
|
||||
#include "qapi/qmp/qerror.h"
|
||||
|
||||
//#define DEBUG_OPENPIC
|
||||
|
||||
@@ -1417,7 +1416,7 @@ static void openpic_load_IRQ_queue(QEMUFile* f, IRQQueue *q)
|
||||
static int openpic_load(QEMUFile* f, void *opaque, int version_id)
|
||||
{
|
||||
OpenPICState *opp = (OpenPICState *)opaque;
|
||||
unsigned int i, nb_cpus;
|
||||
unsigned int i;
|
||||
|
||||
if (version_id != 1) {
|
||||
return -EINVAL;
|
||||
@@ -1429,11 +1428,7 @@ static int openpic_load(QEMUFile* f, void *opaque, int version_id)
|
||||
qemu_get_be32s(f, &opp->spve);
|
||||
qemu_get_be32s(f, &opp->tfrr);
|
||||
|
||||
qemu_get_be32s(f, &nb_cpus);
|
||||
if (opp->nb_cpus != nb_cpus) {
|
||||
return -EINVAL;
|
||||
}
|
||||
assert(nb_cpus > 0 && nb_cpus <= MAX_CPU);
|
||||
qemu_get_be32s(f, &opp->nb_cpus);
|
||||
|
||||
for (i = 0; i < opp->nb_cpus; i++) {
|
||||
qemu_get_sbe32s(f, &opp->dst[i].ctpr);
|
||||
@@ -1572,13 +1567,6 @@ static void openpic_realize(DeviceState *dev, Error **errp)
|
||||
{NULL}
|
||||
};
|
||||
|
||||
if (opp->nb_cpus > MAX_CPU) {
|
||||
error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE,
|
||||
TYPE_OPENPIC, "nb_cpus", (uint64_t)opp->nb_cpus,
|
||||
(uint64_t)0, (uint64_t)MAX_CPU);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (opp->model) {
|
||||
case OPENPIC_MODEL_FSL_MPIC_20:
|
||||
default:
|
||||
|
@@ -135,9 +135,9 @@ CBus *cbus_init(qemu_irq dat)
|
||||
CBusPriv *s = (CBusPriv *) g_malloc0(sizeof(*s));
|
||||
|
||||
s->dat_out = dat;
|
||||
s->cbus.clk = qemu_allocate_irq(cbus_clk, s, 0);
|
||||
s->cbus.dat = qemu_allocate_irq(cbus_dat, s, 0);
|
||||
s->cbus.sel = qemu_allocate_irq(cbus_sel, s, 0);
|
||||
s->cbus.clk = qemu_allocate_irqs(cbus_clk, s, 1)[0];
|
||||
s->cbus.dat = qemu_allocate_irqs(cbus_dat, s, 1)[0];
|
||||
s->cbus.sel = qemu_allocate_irqs(cbus_sel, s, 1)[0];
|
||||
|
||||
s->sel = 1;
|
||||
s->clk = 0;
|
||||
|
@@ -68,7 +68,6 @@ static const VMStateDescription vmstate_imx_ccm = {
|
||||
VMSTATE_UINT32(pmcr0, IMXCCMState),
|
||||
VMSTATE_UINT32(pmcr1, IMXCCMState),
|
||||
VMSTATE_UINT32(pll_refclk_freq, IMXCCMState),
|
||||
VMSTATE_END_OF_LIST()
|
||||
},
|
||||
.post_load = imx_ccm_post_load,
|
||||
};
|
||||
|
@@ -19,102 +19,155 @@
|
||||
#include "hw/sysbus.h"
|
||||
#include "sysemu/sysemu.h"
|
||||
|
||||
#ifdef ZYNQ_ARM_SLCR_ERR_DEBUG
|
||||
#define DB_PRINT(...) do { \
|
||||
fprintf(stderr, ": %s: ", __func__); \
|
||||
fprintf(stderr, ## __VA_ARGS__); \
|
||||
} while (0);
|
||||
#else
|
||||
#define DB_PRINT(...)
|
||||
#ifndef ZYNQ_SLCR_ERR_DEBUG
|
||||
#define ZYNQ_SLCR_ERR_DEBUG 0
|
||||
#endif
|
||||
|
||||
#define DB_PRINT(...) do { \
|
||||
if (ZYNQ_SLCR_ERR_DEBUG) { \
|
||||
fprintf(stderr, ": %s: ", __func__); \
|
||||
fprintf(stderr, ## __VA_ARGS__); \
|
||||
} \
|
||||
} while (0);
|
||||
|
||||
#define XILINX_LOCK_KEY 0x767b
|
||||
#define XILINX_UNLOCK_KEY 0xdf0d
|
||||
|
||||
#define R_PSS_RST_CTRL_SOFT_RST 0x1
|
||||
|
||||
typedef enum {
|
||||
ARM_PLL_CTRL,
|
||||
DDR_PLL_CTRL,
|
||||
IO_PLL_CTRL,
|
||||
PLL_STATUS,
|
||||
ARM_PPL_CFG,
|
||||
DDR_PLL_CFG,
|
||||
IO_PLL_CFG,
|
||||
PLL_BG_CTRL,
|
||||
PLL_MAX
|
||||
} PLLValues;
|
||||
enum {
|
||||
SCL = 0x000 / 4,
|
||||
LOCK,
|
||||
UNLOCK,
|
||||
LOCKSTA,
|
||||
|
||||
typedef enum {
|
||||
ARM_CLK_CTRL,
|
||||
DDR_CLK_CTRL,
|
||||
DCI_CLK_CTRL,
|
||||
APER_CLK_CTRL,
|
||||
USB0_CLK_CTRL,
|
||||
USB1_CLK_CTRL,
|
||||
GEM0_RCLK_CTRL,
|
||||
GEM1_RCLK_CTRL,
|
||||
GEM0_CLK_CTRL,
|
||||
GEM1_CLK_CTRL,
|
||||
SMC_CLK_CTRL,
|
||||
LQSPI_CLK_CTRL,
|
||||
SDIO_CLK_CTRL,
|
||||
UART_CLK_CTRL,
|
||||
SPI_CLK_CTRL,
|
||||
CAN_CLK_CTRL,
|
||||
CAN_MIOCLK_CTRL,
|
||||
DBG_CLK_CTRL,
|
||||
PCAP_CLK_CTRL,
|
||||
TOPSW_CLK_CTRL,
|
||||
CLK_MAX
|
||||
} ClkValues;
|
||||
ARM_PLL_CTRL = 0x100 / 4,
|
||||
DDR_PLL_CTRL,
|
||||
IO_PLL_CTRL,
|
||||
PLL_STATUS,
|
||||
ARM_PLL_CFG,
|
||||
DDR_PLL_CFG,
|
||||
IO_PLL_CFG,
|
||||
|
||||
typedef enum {
|
||||
CLK_CTRL,
|
||||
THR_CTRL,
|
||||
THR_CNT,
|
||||
THR_STA,
|
||||
FPGA_MAX
|
||||
} FPGAValues;
|
||||
ARM_CLK_CTRL = 0x120 / 4,
|
||||
DDR_CLK_CTRL,
|
||||
DCI_CLK_CTRL,
|
||||
APER_CLK_CTRL,
|
||||
USB0_CLK_CTRL,
|
||||
USB1_CLK_CTRL,
|
||||
GEM0_RCLK_CTRL,
|
||||
GEM1_RCLK_CTRL,
|
||||
GEM0_CLK_CTRL,
|
||||
GEM1_CLK_CTRL,
|
||||
SMC_CLK_CTRL,
|
||||
LQSPI_CLK_CTRL,
|
||||
SDIO_CLK_CTRL,
|
||||
UART_CLK_CTRL,
|
||||
SPI_CLK_CTRL,
|
||||
CAN_CLK_CTRL,
|
||||
CAN_MIOCLK_CTRL,
|
||||
DBG_CLK_CTRL,
|
||||
PCAP_CLK_CTRL,
|
||||
TOPSW_CLK_CTRL,
|
||||
|
||||
typedef enum {
|
||||
SYNC_CTRL,
|
||||
SYNC_STATUS,
|
||||
BANDGAP_TRIP,
|
||||
CC_TEST,
|
||||
PLL_PREDIVISOR,
|
||||
CLK_621_TRUE,
|
||||
PICTURE_DBG,
|
||||
PICTURE_DBG_UCNT,
|
||||
PICTURE_DBG_LCNT,
|
||||
MISC_MAX
|
||||
} MiscValues;
|
||||
#define FPGA_CTRL_REGS(n, start) \
|
||||
FPGA ## n ## _CLK_CTRL = (start) / 4, \
|
||||
FPGA ## n ## _THR_CTRL, \
|
||||
FPGA ## n ## _THR_CNT, \
|
||||
FPGA ## n ## _THR_STA,
|
||||
FPGA_CTRL_REGS(0, 0x170)
|
||||
FPGA_CTRL_REGS(1, 0x180)
|
||||
FPGA_CTRL_REGS(2, 0x190)
|
||||
FPGA_CTRL_REGS(3, 0x1a0)
|
||||
|
||||
typedef enum {
|
||||
PSS,
|
||||
DDDR,
|
||||
DMAC = 3,
|
||||
USB,
|
||||
GEM,
|
||||
SDIO,
|
||||
SPI,
|
||||
CAN,
|
||||
I2C,
|
||||
UART,
|
||||
GPIO,
|
||||
LQSPI,
|
||||
SMC,
|
||||
OCM,
|
||||
DEVCI,
|
||||
FPGA,
|
||||
A9_CPU,
|
||||
RS_AWDT,
|
||||
RST_REASON,
|
||||
RST_REASON_CLR,
|
||||
REBOOT_STATUS,
|
||||
BOOT_MODE,
|
||||
RESET_MAX
|
||||
} ResetValues;
|
||||
BANDGAP_TRIP = 0x1b8 / 4,
|
||||
PLL_PREDIVISOR = 0x1c0 / 4,
|
||||
CLK_621_TRUE,
|
||||
|
||||
PSS_RST_CTRL = 0x200 / 4,
|
||||
DDR_RST_CTRL,
|
||||
TOPSW_RESET_CTRL,
|
||||
DMAC_RST_CTRL,
|
||||
USB_RST_CTRL,
|
||||
GEM_RST_CTRL,
|
||||
SDIO_RST_CTRL,
|
||||
SPI_RST_CTRL,
|
||||
CAN_RST_CTRL,
|
||||
I2C_RST_CTRL,
|
||||
UART_RST_CTRL,
|
||||
GPIO_RST_CTRL,
|
||||
LQSPI_RST_CTRL,
|
||||
SMC_RST_CTRL,
|
||||
OCM_RST_CTRL,
|
||||
FPGA_RST_CTRL = 0x240 / 4,
|
||||
A9_CPU_RST_CTRL,
|
||||
|
||||
RS_AWDT_CTRL = 0x24c / 4,
|
||||
RST_REASON,
|
||||
|
||||
REBOOT_STATUS = 0x258 / 4,
|
||||
BOOT_MODE,
|
||||
|
||||
APU_CTRL = 0x300 / 4,
|
||||
WDT_CLK_SEL,
|
||||
|
||||
TZ_DMA_NS = 0x440 / 4,
|
||||
TZ_DMA_IRQ_NS,
|
||||
TZ_DMA_PERIPH_NS,
|
||||
|
||||
PSS_IDCODE = 0x530 / 4,
|
||||
|
||||
DDR_URGENT = 0x600 / 4,
|
||||
DDR_CAL_START = 0x60c / 4,
|
||||
DDR_REF_START = 0x614 / 4,
|
||||
DDR_CMD_STA,
|
||||
DDR_URGENT_SEL,
|
||||
DDR_DFI_STATUS,
|
||||
|
||||
MIO = 0x700 / 4,
|
||||
#define MIO_LENGTH 54
|
||||
|
||||
MIO_LOOPBACK = 0x804 / 4,
|
||||
MIO_MST_TRI0,
|
||||
MIO_MST_TRI1,
|
||||
|
||||
SD0_WP_CD_SEL = 0x830 / 4,
|
||||
SD1_WP_CD_SEL,
|
||||
|
||||
LVL_SHFTR_EN = 0x900 / 4,
|
||||
OCM_CFG = 0x910 / 4,
|
||||
|
||||
CPU_RAM = 0xa00 / 4,
|
||||
|
||||
IOU = 0xa30 / 4,
|
||||
|
||||
DMAC_RAM = 0xa50 / 4,
|
||||
|
||||
AFI0 = 0xa60 / 4,
|
||||
AFI1 = AFI0 + 3,
|
||||
AFI2 = AFI1 + 3,
|
||||
AFI3 = AFI2 + 3,
|
||||
#define AFI_LENGTH 3
|
||||
|
||||
OCM = 0xa90 / 4,
|
||||
|
||||
DEVCI_RAM = 0xaa0 / 4,
|
||||
|
||||
CSG_RAM = 0xab0 / 4,
|
||||
|
||||
GPIOB_CTRL = 0xb00 / 4,
|
||||
GPIOB_CFG_CMOS18,
|
||||
GPIOB_CFG_CMOS25,
|
||||
GPIOB_CFG_CMOS33,
|
||||
GPIOB_CFG_HSTL = 0xb14 / 4,
|
||||
GPIOB_DRVR_BIAS_CTRL,
|
||||
|
||||
DDRIOB = 0xb40 / 4,
|
||||
#define DDRIOB_LENGTH 14
|
||||
};
|
||||
|
||||
#define ZYNQ_SLCR_MMIO_SIZE 0x1000
|
||||
#define ZYNQ_SLCR_NUM_REGS (ZYNQ_SLCR_MMIO_SIZE / 4)
|
||||
|
||||
#define TYPE_ZYNQ_SLCR "xilinx,zynq_slcr"
|
||||
#define ZYNQ_SLCR(obj) OBJECT_CHECK(ZynqSLCRState, (obj), TYPE_ZYNQ_SLCR)
|
||||
@@ -124,42 +177,7 @@ typedef struct ZynqSLCRState {
|
||||
|
||||
MemoryRegion iomem;
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint16_t scl;
|
||||
uint16_t lockval;
|
||||
uint32_t pll[PLL_MAX]; /* 0x100 - 0x11C */
|
||||
uint32_t clk[CLK_MAX]; /* 0x120 - 0x16C */
|
||||
uint32_t fpga[4][FPGA_MAX]; /* 0x170 - 0x1AC */
|
||||
uint32_t misc[MISC_MAX]; /* 0x1B0 - 0x1D8 */
|
||||
uint32_t reset[RESET_MAX]; /* 0x200 - 0x25C */
|
||||
uint32_t apu_ctrl; /* 0x300 */
|
||||
uint32_t wdt_clk_sel; /* 0x304 */
|
||||
uint32_t tz_ocm[3]; /* 0x400 - 0x408 */
|
||||
uint32_t tz_ddr; /* 0x430 */
|
||||
uint32_t tz_dma[3]; /* 0x440 - 0x448 */
|
||||
uint32_t tz_misc[3]; /* 0x450 - 0x458 */
|
||||
uint32_t tz_fpga[2]; /* 0x484 - 0x488 */
|
||||
uint32_t dbg_ctrl; /* 0x500 */
|
||||
uint32_t pss_idcode; /* 0x530 */
|
||||
uint32_t ddr[8]; /* 0x600 - 0x620 - 0x604-missing */
|
||||
uint32_t mio[54]; /* 0x700 - 0x7D4 */
|
||||
uint32_t mio_func[4]; /* 0x800 - 0x810 */
|
||||
uint32_t sd[2]; /* 0x830 - 0x834 */
|
||||
uint32_t lvl_shftr_en; /* 0x900 */
|
||||
uint32_t ocm_cfg; /* 0x910 */
|
||||
uint32_t cpu_ram[8]; /* 0xA00 - 0xA1C */
|
||||
uint32_t iou[7]; /* 0xA30 - 0xA48 */
|
||||
uint32_t dmac_ram; /* 0xA50 */
|
||||
uint32_t afi[4][3]; /* 0xA60 - 0xA8C */
|
||||
uint32_t ocm[3]; /* 0xA90 - 0xA98 */
|
||||
uint32_t devci_ram; /* 0xAA0 */
|
||||
uint32_t csg_ram; /* 0xAB0 */
|
||||
uint32_t gpiob[12]; /* 0xB00 - 0xB2C */
|
||||
uint32_t ddriob[14]; /* 0xB40 - 0xB74 */
|
||||
};
|
||||
uint8_t data[0x1000];
|
||||
};
|
||||
uint32_t regs[ZYNQ_SLCR_NUM_REGS];
|
||||
} ZynqSLCRState;
|
||||
|
||||
static void zynq_slcr_reset(DeviceState *d)
|
||||
@@ -169,177 +187,169 @@ static void zynq_slcr_reset(DeviceState *d)
|
||||
|
||||
DB_PRINT("RESET\n");
|
||||
|
||||
s->lockval = 1;
|
||||
s->regs[LOCKSTA] = 1;
|
||||
/* 0x100 - 0x11C */
|
||||
s->pll[ARM_PLL_CTRL] = 0x0001A008;
|
||||
s->pll[DDR_PLL_CTRL] = 0x0001A008;
|
||||
s->pll[IO_PLL_CTRL] = 0x0001A008;
|
||||
s->pll[PLL_STATUS] = 0x0000003F;
|
||||
s->pll[ARM_PPL_CFG] = 0x00014000;
|
||||
s->pll[DDR_PLL_CFG] = 0x00014000;
|
||||
s->pll[IO_PLL_CFG] = 0x00014000;
|
||||
s->regs[ARM_PLL_CTRL] = 0x0001A008;
|
||||
s->regs[DDR_PLL_CTRL] = 0x0001A008;
|
||||
s->regs[IO_PLL_CTRL] = 0x0001A008;
|
||||
s->regs[PLL_STATUS] = 0x0000003F;
|
||||
s->regs[ARM_PLL_CFG] = 0x00014000;
|
||||
s->regs[DDR_PLL_CFG] = 0x00014000;
|
||||
s->regs[IO_PLL_CFG] = 0x00014000;
|
||||
|
||||
/* 0x120 - 0x16C */
|
||||
s->clk[ARM_CLK_CTRL] = 0x1F000400;
|
||||
s->clk[DDR_CLK_CTRL] = 0x18400003;
|
||||
s->clk[DCI_CLK_CTRL] = 0x01E03201;
|
||||
s->clk[APER_CLK_CTRL] = 0x01FFCCCD;
|
||||
s->clk[USB0_CLK_CTRL] = s->clk[USB1_CLK_CTRL] = 0x00101941;
|
||||
s->clk[GEM0_RCLK_CTRL] = s->clk[GEM1_RCLK_CTRL] = 0x00000001;
|
||||
s->clk[GEM0_CLK_CTRL] = s->clk[GEM1_CLK_CTRL] = 0x00003C01;
|
||||
s->clk[SMC_CLK_CTRL] = 0x00003C01;
|
||||
s->clk[LQSPI_CLK_CTRL] = 0x00002821;
|
||||
s->clk[SDIO_CLK_CTRL] = 0x00001E03;
|
||||
s->clk[UART_CLK_CTRL] = 0x00003F03;
|
||||
s->clk[SPI_CLK_CTRL] = 0x00003F03;
|
||||
s->clk[CAN_CLK_CTRL] = 0x00501903;
|
||||
s->clk[DBG_CLK_CTRL] = 0x00000F03;
|
||||
s->clk[PCAP_CLK_CTRL] = 0x00000F01;
|
||||
s->regs[ARM_CLK_CTRL] = 0x1F000400;
|
||||
s->regs[DDR_CLK_CTRL] = 0x18400003;
|
||||
s->regs[DCI_CLK_CTRL] = 0x01E03201;
|
||||
s->regs[APER_CLK_CTRL] = 0x01FFCCCD;
|
||||
s->regs[USB0_CLK_CTRL] = s->regs[USB1_CLK_CTRL] = 0x00101941;
|
||||
s->regs[GEM0_RCLK_CTRL] = s->regs[GEM1_RCLK_CTRL] = 0x00000001;
|
||||
s->regs[GEM0_CLK_CTRL] = s->regs[GEM1_CLK_CTRL] = 0x00003C01;
|
||||
s->regs[SMC_CLK_CTRL] = 0x00003C01;
|
||||
s->regs[LQSPI_CLK_CTRL] = 0x00002821;
|
||||
s->regs[SDIO_CLK_CTRL] = 0x00001E03;
|
||||
s->regs[UART_CLK_CTRL] = 0x00003F03;
|
||||
s->regs[SPI_CLK_CTRL] = 0x00003F03;
|
||||
s->regs[CAN_CLK_CTRL] = 0x00501903;
|
||||
s->regs[DBG_CLK_CTRL] = 0x00000F03;
|
||||
s->regs[PCAP_CLK_CTRL] = 0x00000F01;
|
||||
|
||||
/* 0x170 - 0x1AC */
|
||||
s->fpga[0][CLK_CTRL] = s->fpga[1][CLK_CTRL] = s->fpga[2][CLK_CTRL] =
|
||||
s->fpga[3][CLK_CTRL] = 0x00101800;
|
||||
s->fpga[0][THR_STA] = s->fpga[1][THR_STA] = s->fpga[2][THR_STA] =
|
||||
s->fpga[3][THR_STA] = 0x00010000;
|
||||
s->regs[FPGA0_CLK_CTRL] = s->regs[FPGA1_CLK_CTRL] = s->regs[FPGA2_CLK_CTRL]
|
||||
= s->regs[FPGA3_CLK_CTRL] = 0x00101800;
|
||||
s->regs[FPGA0_THR_STA] = s->regs[FPGA1_THR_STA] = s->regs[FPGA2_THR_STA]
|
||||
= s->regs[FPGA3_THR_STA] = 0x00010000;
|
||||
|
||||
/* 0x1B0 - 0x1D8 */
|
||||
s->misc[BANDGAP_TRIP] = 0x0000001F;
|
||||
s->misc[PLL_PREDIVISOR] = 0x00000001;
|
||||
s->misc[CLK_621_TRUE] = 0x00000001;
|
||||
s->regs[BANDGAP_TRIP] = 0x0000001F;
|
||||
s->regs[PLL_PREDIVISOR] = 0x00000001;
|
||||
s->regs[CLK_621_TRUE] = 0x00000001;
|
||||
|
||||
/* 0x200 - 0x25C */
|
||||
s->reset[FPGA] = 0x01F33F0F;
|
||||
s->reset[RST_REASON] = 0x00000040;
|
||||
s->regs[FPGA_RST_CTRL] = 0x01F33F0F;
|
||||
s->regs[RST_REASON] = 0x00000040;
|
||||
|
||||
s->regs[BOOT_MODE] = 0x00000001;
|
||||
|
||||
/* 0x700 - 0x7D4 */
|
||||
for (i = 0; i < 54; i++) {
|
||||
s->mio[i] = 0x00001601;
|
||||
s->regs[MIO + i] = 0x00001601;
|
||||
}
|
||||
for (i = 2; i <= 8; i++) {
|
||||
s->mio[i] = 0x00000601;
|
||||
s->regs[MIO + i] = 0x00000601;
|
||||
}
|
||||
|
||||
/* MIO_MST_TRI0, MIO_MST_TRI1 */
|
||||
s->mio_func[2] = s->mio_func[3] = 0xFFFFFFFF;
|
||||
s->regs[MIO_MST_TRI0] = s->regs[MIO_MST_TRI1] = 0xFFFFFFFF;
|
||||
|
||||
s->cpu_ram[0] = s->cpu_ram[1] = s->cpu_ram[3] =
|
||||
s->cpu_ram[4] = s->cpu_ram[7] = 0x00010101;
|
||||
s->cpu_ram[2] = s->cpu_ram[5] = 0x01010101;
|
||||
s->cpu_ram[6] = 0x00000001;
|
||||
s->regs[CPU_RAM + 0] = s->regs[CPU_RAM + 1] = s->regs[CPU_RAM + 3]
|
||||
= s->regs[CPU_RAM + 4] = s->regs[CPU_RAM + 7]
|
||||
= 0x00010101;
|
||||
s->regs[CPU_RAM + 2] = s->regs[CPU_RAM + 5] = 0x01010101;
|
||||
s->regs[CPU_RAM + 6] = 0x00000001;
|
||||
|
||||
s->iou[0] = s->iou[1] = s->iou[2] = s->iou[3] = 0x09090909;
|
||||
s->iou[4] = s->iou[5] = 0x00090909;
|
||||
s->iou[6] = 0x00000909;
|
||||
s->regs[IOU + 0] = s->regs[IOU + 1] = s->regs[IOU + 2] = s->regs[IOU + 3]
|
||||
= 0x09090909;
|
||||
s->regs[IOU + 4] = s->regs[IOU + 5] = 0x00090909;
|
||||
s->regs[IOU + 6] = 0x00000909;
|
||||
|
||||
s->dmac_ram = 0x00000009;
|
||||
s->regs[DMAC_RAM] = 0x00000009;
|
||||
|
||||
s->afi[0][0] = s->afi[0][1] = 0x09090909;
|
||||
s->afi[1][0] = s->afi[1][1] = 0x09090909;
|
||||
s->afi[2][0] = s->afi[2][1] = 0x09090909;
|
||||
s->afi[3][0] = s->afi[3][1] = 0x09090909;
|
||||
s->afi[0][2] = s->afi[1][2] = s->afi[2][2] = s->afi[3][2] = 0x00000909;
|
||||
s->regs[AFI0 + 0] = s->regs[AFI0 + 1] = 0x09090909;
|
||||
s->regs[AFI1 + 0] = s->regs[AFI1 + 1] = 0x09090909;
|
||||
s->regs[AFI2 + 0] = s->regs[AFI2 + 1] = 0x09090909;
|
||||
s->regs[AFI3 + 0] = s->regs[AFI3 + 1] = 0x09090909;
|
||||
s->regs[AFI0 + 2] = s->regs[AFI1 + 2] = s->regs[AFI2 + 2]
|
||||
= s->regs[AFI3 + 2] = 0x00000909;
|
||||
|
||||
s->ocm[0] = 0x01010101;
|
||||
s->ocm[1] = s->ocm[2] = 0x09090909;
|
||||
s->regs[OCM + 0] = 0x01010101;
|
||||
s->regs[OCM + 1] = s->regs[OCM + 2] = 0x09090909;
|
||||
|
||||
s->devci_ram = 0x00000909;
|
||||
s->csg_ram = 0x00000001;
|
||||
s->regs[DEVCI_RAM] = 0x00000909;
|
||||
s->regs[CSG_RAM] = 0x00000001;
|
||||
|
||||
s->ddriob[0] = s->ddriob[1] = s->ddriob[2] = s->ddriob[3] = 0x00000e00;
|
||||
s->ddriob[4] = s->ddriob[5] = s->ddriob[6] = 0x00000e00;
|
||||
s->ddriob[12] = 0x00000021;
|
||||
s->regs[DDRIOB + 0] = s->regs[DDRIOB + 1] = s->regs[DDRIOB + 2]
|
||||
= s->regs[DDRIOB + 3] = 0x00000e00;
|
||||
s->regs[DDRIOB + 4] = s->regs[DDRIOB + 5] = s->regs[DDRIOB + 6]
|
||||
= 0x00000e00;
|
||||
s->regs[DDRIOB + 12] = 0x00000021;
|
||||
}
|
||||
|
||||
static inline uint32_t zynq_slcr_read_imp(void *opaque,
|
||||
hwaddr offset)
|
||||
{
|
||||
ZynqSLCRState *s = (ZynqSLCRState *)opaque;
|
||||
|
||||
static bool zynq_slcr_check_offset(hwaddr offset, bool rnw)
|
||||
{
|
||||
switch (offset) {
|
||||
case 0x0: /* SCL */
|
||||
return s->scl;
|
||||
case 0x4: /* LOCK */
|
||||
case 0x8: /* UNLOCK */
|
||||
DB_PRINT("Reading SCLR_LOCK/UNLOCK is not enabled\n");
|
||||
return 0;
|
||||
case 0x0C: /* LOCKSTA */
|
||||
return s->lockval;
|
||||
case 0x100 ... 0x11C:
|
||||
return s->pll[(offset - 0x100) / 4];
|
||||
case 0x120 ... 0x16C:
|
||||
return s->clk[(offset - 0x120) / 4];
|
||||
case 0x170 ... 0x1AC:
|
||||
return s->fpga[0][(offset - 0x170) / 4];
|
||||
case 0x1B0 ... 0x1D8:
|
||||
return s->misc[(offset - 0x1B0) / 4];
|
||||
case 0x200 ... 0x258:
|
||||
return s->reset[(offset - 0x200) / 4];
|
||||
case 0x25c:
|
||||
return 1;
|
||||
case 0x300:
|
||||
return s->apu_ctrl;
|
||||
case 0x304:
|
||||
return s->wdt_clk_sel;
|
||||
case 0x400 ... 0x408:
|
||||
return s->tz_ocm[(offset - 0x400) / 4];
|
||||
case 0x430:
|
||||
return s->tz_ddr;
|
||||
case 0x440 ... 0x448:
|
||||
return s->tz_dma[(offset - 0x440) / 4];
|
||||
case 0x450 ... 0x458:
|
||||
return s->tz_misc[(offset - 0x450) / 4];
|
||||
case 0x484 ... 0x488:
|
||||
return s->tz_fpga[(offset - 0x484) / 4];
|
||||
case 0x500:
|
||||
return s->dbg_ctrl;
|
||||
case 0x530:
|
||||
return s->pss_idcode;
|
||||
case 0x600 ... 0x620:
|
||||
if (offset == 0x604) {
|
||||
goto bad_reg;
|
||||
}
|
||||
return s->ddr[(offset - 0x600) / 4];
|
||||
case 0x700 ... 0x7D4:
|
||||
return s->mio[(offset - 0x700) / 4];
|
||||
case 0x800 ... 0x810:
|
||||
return s->mio_func[(offset - 0x800) / 4];
|
||||
case 0x830 ... 0x834:
|
||||
return s->sd[(offset - 0x830) / 4];
|
||||
case 0x900:
|
||||
return s->lvl_shftr_en;
|
||||
case 0x910:
|
||||
return s->ocm_cfg;
|
||||
case 0xA00 ... 0xA1C:
|
||||
return s->cpu_ram[(offset - 0xA00) / 4];
|
||||
case 0xA30 ... 0xA48:
|
||||
return s->iou[(offset - 0xA30) / 4];
|
||||
case 0xA50:
|
||||
return s->dmac_ram;
|
||||
case 0xA60 ... 0xA8C:
|
||||
return s->afi[0][(offset - 0xA60) / 4];
|
||||
case 0xA90 ... 0xA98:
|
||||
return s->ocm[(offset - 0xA90) / 4];
|
||||
case 0xAA0:
|
||||
return s->devci_ram;
|
||||
case 0xAB0:
|
||||
return s->csg_ram;
|
||||
case 0xB00 ... 0xB2C:
|
||||
return s->gpiob[(offset - 0xB00) / 4];
|
||||
case 0xB40 ... 0xB74:
|
||||
return s->ddriob[(offset - 0xB40) / 4];
|
||||
case LOCK:
|
||||
case UNLOCK:
|
||||
case DDR_CAL_START:
|
||||
case DDR_REF_START:
|
||||
return !rnw; /* Write only */
|
||||
case LOCKSTA:
|
||||
case FPGA0_THR_STA:
|
||||
case FPGA1_THR_STA:
|
||||
case FPGA2_THR_STA:
|
||||
case FPGA3_THR_STA:
|
||||
case BOOT_MODE:
|
||||
case PSS_IDCODE:
|
||||
case DDR_CMD_STA:
|
||||
case DDR_DFI_STATUS:
|
||||
case PLL_STATUS:
|
||||
return rnw;/* read only */
|
||||
case SCL:
|
||||
case ARM_PLL_CTRL ... IO_PLL_CTRL:
|
||||
case ARM_PLL_CFG ... IO_PLL_CFG:
|
||||
case ARM_CLK_CTRL ... TOPSW_CLK_CTRL:
|
||||
case FPGA0_CLK_CTRL ... FPGA0_THR_CNT:
|
||||
case FPGA1_CLK_CTRL ... FPGA1_THR_CNT:
|
||||
case FPGA2_CLK_CTRL ... FPGA2_THR_CNT:
|
||||
case FPGA3_CLK_CTRL ... FPGA3_THR_CNT:
|
||||
case BANDGAP_TRIP:
|
||||
case PLL_PREDIVISOR:
|
||||
case CLK_621_TRUE:
|
||||
case PSS_RST_CTRL ... A9_CPU_RST_CTRL:
|
||||
case RS_AWDT_CTRL:
|
||||
case RST_REASON:
|
||||
case REBOOT_STATUS:
|
||||
case APU_CTRL:
|
||||
case WDT_CLK_SEL:
|
||||
case TZ_DMA_NS ... TZ_DMA_PERIPH_NS:
|
||||
case DDR_URGENT:
|
||||
case DDR_URGENT_SEL:
|
||||
case MIO ... MIO + MIO_LENGTH - 1:
|
||||
case MIO_LOOPBACK ... MIO_MST_TRI1:
|
||||
case SD0_WP_CD_SEL:
|
||||
case SD1_WP_CD_SEL:
|
||||
case LVL_SHFTR_EN:
|
||||
case OCM_CFG:
|
||||
case CPU_RAM:
|
||||
case IOU:
|
||||
case DMAC_RAM:
|
||||
case AFI0 ... AFI3 + AFI_LENGTH - 1:
|
||||
case OCM:
|
||||
case DEVCI_RAM:
|
||||
case CSG_RAM:
|
||||
case GPIOB_CTRL ... GPIOB_CFG_CMOS33:
|
||||
case GPIOB_CFG_HSTL:
|
||||
case GPIOB_DRVR_BIAS_CTRL:
|
||||
case DDRIOB ... DDRIOB + DDRIOB_LENGTH - 1:
|
||||
return true;
|
||||
default:
|
||||
bad_reg:
|
||||
DB_PRINT("Bad register offset 0x%x\n", (int)offset);
|
||||
return 0;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t zynq_slcr_read(void *opaque, hwaddr offset,
|
||||
unsigned size)
|
||||
{
|
||||
uint32_t ret = zynq_slcr_read_imp(opaque, offset);
|
||||
ZynqSLCRState *s = opaque;
|
||||
offset /= 4;
|
||||
uint32_t ret = s->regs[offset];
|
||||
|
||||
DB_PRINT("addr: %08x data: %08x\n", (unsigned)offset, (unsigned)ret);
|
||||
if (!zynq_slcr_check_offset(offset, true)) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "zynq_slcr: Invalid read access to "
|
||||
" addr %" HWADDR_PRIx "\n", offset * 4);
|
||||
}
|
||||
|
||||
DB_PRINT("addr: %08" HWADDR_PRIx " data: %08" PRIx32 "\n", offset * 4, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -347,148 +357,55 @@ static void zynq_slcr_write(void *opaque, hwaddr offset,
|
||||
uint64_t val, unsigned size)
|
||||
{
|
||||
ZynqSLCRState *s = (ZynqSLCRState *)opaque;
|
||||
offset /= 4;
|
||||
|
||||
DB_PRINT("offset: %08x data: %08x\n", (unsigned)offset, (unsigned)val);
|
||||
DB_PRINT("addr: %08" HWADDR_PRIx " data: %08" PRIx64 "\n", offset * 4, val);
|
||||
|
||||
if (!zynq_slcr_check_offset(offset, false)) {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "zynq_slcr: Invalid write access to "
|
||||
"addr %" HWADDR_PRIx "\n", offset * 4);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (offset) {
|
||||
case 0x00: /* SCL */
|
||||
s->scl = val & 0x1;
|
||||
return;
|
||||
case 0x4: /* SLCR_LOCK */
|
||||
case SCL:
|
||||
s->regs[SCL] = val & 0x1;
|
||||
return;
|
||||
case LOCK:
|
||||
if ((val & 0xFFFF) == XILINX_LOCK_KEY) {
|
||||
DB_PRINT("XILINX LOCK 0xF8000000 + 0x%x <= 0x%x\n", (int)offset,
|
||||
(unsigned)val & 0xFFFF);
|
||||
s->lockval = 1;
|
||||
s->regs[LOCKSTA] = 1;
|
||||
} else {
|
||||
DB_PRINT("WRONG XILINX LOCK KEY 0xF8000000 + 0x%x <= 0x%x\n",
|
||||
(int)offset, (unsigned)val & 0xFFFF);
|
||||
}
|
||||
return;
|
||||
case 0x8: /* SLCR_UNLOCK */
|
||||
case UNLOCK:
|
||||
if ((val & 0xFFFF) == XILINX_UNLOCK_KEY) {
|
||||
DB_PRINT("XILINX UNLOCK 0xF8000000 + 0x%x <= 0x%x\n", (int)offset,
|
||||
(unsigned)val & 0xFFFF);
|
||||
s->lockval = 0;
|
||||
s->regs[LOCKSTA] = 0;
|
||||
} else {
|
||||
DB_PRINT("WRONG XILINX UNLOCK KEY 0xF8000000 + 0x%x <= 0x%x\n",
|
||||
(int)offset, (unsigned)val & 0xFFFF);
|
||||
}
|
||||
return;
|
||||
case 0xc: /* LOCKSTA */
|
||||
DB_PRINT("Writing SCLR_LOCKSTA is not enabled\n");
|
||||
}
|
||||
|
||||
if (!s->regs[LOCKSTA]) {
|
||||
s->regs[offset / 4] = val;
|
||||
} else {
|
||||
DB_PRINT("SCLR registers are locked. Unlock them first\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!s->lockval) {
|
||||
switch (offset) {
|
||||
case 0x100 ... 0x11C:
|
||||
if (offset == 0x10C) {
|
||||
goto bad_reg;
|
||||
}
|
||||
s->pll[(offset - 0x100) / 4] = val;
|
||||
break;
|
||||
case 0x120 ... 0x16C:
|
||||
s->clk[(offset - 0x120) / 4] = val;
|
||||
break;
|
||||
case 0x170 ... 0x1AC:
|
||||
s->fpga[0][(offset - 0x170) / 4] = val;
|
||||
break;
|
||||
case 0x1B0 ... 0x1D8:
|
||||
s->misc[(offset - 0x1B0) / 4] = val;
|
||||
break;
|
||||
case 0x200 ... 0x25C:
|
||||
if (offset == 0x250) {
|
||||
goto bad_reg;
|
||||
}
|
||||
s->reset[(offset - 0x200) / 4] = val;
|
||||
if (offset == 0x200 && (val & R_PSS_RST_CTRL_SOFT_RST)) {
|
||||
qemu_system_reset_request();
|
||||
}
|
||||
break;
|
||||
case 0x300:
|
||||
s->apu_ctrl = val;
|
||||
break;
|
||||
case 0x304:
|
||||
s->wdt_clk_sel = val;
|
||||
break;
|
||||
case 0x400 ... 0x408:
|
||||
s->tz_ocm[(offset - 0x400) / 4] = val;
|
||||
break;
|
||||
case 0x430:
|
||||
s->tz_ddr = val;
|
||||
break;
|
||||
case 0x440 ... 0x448:
|
||||
s->tz_dma[(offset - 0x440) / 4] = val;
|
||||
break;
|
||||
case 0x450 ... 0x458:
|
||||
s->tz_misc[(offset - 0x450) / 4] = val;
|
||||
break;
|
||||
case 0x484 ... 0x488:
|
||||
s->tz_fpga[(offset - 0x484) / 4] = val;
|
||||
break;
|
||||
case 0x500:
|
||||
s->dbg_ctrl = val;
|
||||
break;
|
||||
case 0x530:
|
||||
s->pss_idcode = val;
|
||||
break;
|
||||
case 0x600 ... 0x620:
|
||||
if (offset == 0x604) {
|
||||
goto bad_reg;
|
||||
}
|
||||
s->ddr[(offset - 0x600) / 4] = val;
|
||||
break;
|
||||
case 0x700 ... 0x7D4:
|
||||
s->mio[(offset - 0x700) / 4] = val;
|
||||
break;
|
||||
case 0x800 ... 0x810:
|
||||
s->mio_func[(offset - 0x800) / 4] = val;
|
||||
break;
|
||||
case 0x830 ... 0x834:
|
||||
s->sd[(offset - 0x830) / 4] = val;
|
||||
break;
|
||||
case 0x900:
|
||||
s->lvl_shftr_en = val;
|
||||
break;
|
||||
case 0x910:
|
||||
break;
|
||||
case 0xA00 ... 0xA1C:
|
||||
s->cpu_ram[(offset - 0xA00) / 4] = val;
|
||||
break;
|
||||
case 0xA30 ... 0xA48:
|
||||
s->iou[(offset - 0xA30) / 4] = val;
|
||||
break;
|
||||
case 0xA50:
|
||||
s->dmac_ram = val;
|
||||
break;
|
||||
case 0xA60 ... 0xA8C:
|
||||
s->afi[0][(offset - 0xA60) / 4] = val;
|
||||
break;
|
||||
case 0xA90:
|
||||
s->ocm[0] = val;
|
||||
break;
|
||||
case 0xAA0:
|
||||
s->devci_ram = val;
|
||||
break;
|
||||
case 0xAB0:
|
||||
s->csg_ram = val;
|
||||
break;
|
||||
case 0xB00 ... 0xB2C:
|
||||
if (offset == 0xB20 || offset == 0xB2C) {
|
||||
goto bad_reg;
|
||||
}
|
||||
s->gpiob[(offset - 0xB00) / 4] = val;
|
||||
break;
|
||||
case 0xB40 ... 0xB74:
|
||||
s->ddriob[(offset - 0xB40) / 4] = val;
|
||||
break;
|
||||
default:
|
||||
bad_reg:
|
||||
DB_PRINT("Bad register write %x <= %08x\n", (int)offset,
|
||||
(unsigned)val);
|
||||
switch (offset) {
|
||||
case PSS_RST_CTRL:
|
||||
if (val & R_PSS_RST_CTRL_SOFT_RST) {
|
||||
qemu_system_reset_request();
|
||||
}
|
||||
} else {
|
||||
DB_PRINT("SCLR registers are locked. Unlock them first\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -498,23 +415,22 @@ static const MemoryRegionOps slcr_ops = {
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
static int zynq_slcr_init(SysBusDevice *dev)
|
||||
static void zynq_slcr_init(Object *obj)
|
||||
{
|
||||
ZynqSLCRState *s = ZYNQ_SLCR(dev);
|
||||
ZynqSLCRState *s = ZYNQ_SLCR(obj);
|
||||
|
||||
memory_region_init_io(&s->iomem, OBJECT(s), &slcr_ops, s, "slcr", 0x1000);
|
||||
sysbus_init_mmio(dev, &s->iomem);
|
||||
|
||||
return 0;
|
||||
memory_region_init_io(&s->iomem, obj, &slcr_ops, s, "slcr",
|
||||
ZYNQ_SLCR_MMIO_SIZE);
|
||||
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_zynq_slcr = {
|
||||
.name = "zynq_slcr",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.minimum_version_id_old = 1,
|
||||
.version_id = 2,
|
||||
.minimum_version_id = 2,
|
||||
.minimum_version_id_old = 2,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT8_ARRAY(data, ZynqSLCRState, 0x1000),
|
||||
VMSTATE_UINT32_ARRAY(regs, ZynqSLCRState, ZYNQ_SLCR_NUM_REGS),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
@@ -522,9 +438,7 @@ static const VMStateDescription vmstate_zynq_slcr = {
|
||||
static void zynq_slcr_class_init(ObjectClass *klass, void *data)
|
||||
{
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
SysBusDeviceClass *sdc = SYS_BUS_DEVICE_CLASS(klass);
|
||||
|
||||
sdc->init = zynq_slcr_init;
|
||||
dc->vmsd = &vmstate_zynq_slcr;
|
||||
dc->reset = zynq_slcr_reset;
|
||||
}
|
||||
@@ -534,6 +448,7 @@ static const TypeInfo zynq_slcr_info = {
|
||||
.name = TYPE_ZYNQ_SLCR,
|
||||
.parent = TYPE_SYS_BUS_DEVICE,
|
||||
.instance_size = sizeof(ZynqSLCRState),
|
||||
.instance_init = zynq_slcr_init,
|
||||
};
|
||||
|
||||
static void zynq_slcr_register_types(void)
|
||||
|
@@ -27,11 +27,11 @@ static uint8_t padding[60];
|
||||
static void mii_set_link(RTL8201CPState *mii, bool link_ok)
|
||||
{
|
||||
if (link_ok) {
|
||||
mii->bmsr |= MII_BMSR_LINK_ST;
|
||||
mii->bmsr |= MII_BMSR_LINK_ST | MII_BMSR_AN_COMP;
|
||||
mii->anlpar |= MII_ANAR_TXFD | MII_ANAR_10FD | MII_ANAR_10 |
|
||||
MII_ANAR_CSMACD;
|
||||
} else {
|
||||
mii->bmsr &= ~MII_BMSR_LINK_ST;
|
||||
mii->bmsr &= ~(MII_BMSR_LINK_ST | MII_BMSR_AN_COMP);
|
||||
mii->anlpar = MII_ANAR_TX;
|
||||
}
|
||||
}
|
||||
@@ -391,9 +391,11 @@ static void aw_emac_write(void *opaque, hwaddr offset, uint64_t value,
|
||||
break;
|
||||
case EMAC_INT_CTL_REG:
|
||||
s->int_ctl = value;
|
||||
aw_emac_update_irq(s);
|
||||
break;
|
||||
case EMAC_INT_STA_REG:
|
||||
s->int_sta &= ~value;
|
||||
aw_emac_update_irq(s);
|
||||
break;
|
||||
case EMAC_MAC_MADR_REG:
|
||||
s->phy_target = value;
|
||||
|
@@ -1093,7 +1093,7 @@ static uint64_t gem_read(void *opaque, hwaddr offset, unsigned size)
|
||||
uint32_t phy_addr, reg_num;
|
||||
|
||||
phy_addr = (retval & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;
|
||||
if (phy_addr == BOARD_PHY_ADDRESS) {
|
||||
if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {
|
||||
reg_num = (retval & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;
|
||||
retval &= 0xFFFF0000;
|
||||
retval |= gem_phy_read(s, reg_num);
|
||||
@@ -1193,7 +1193,7 @@ static void gem_write(void *opaque, hwaddr offset, uint64_t val,
|
||||
uint32_t phy_addr, reg_num;
|
||||
|
||||
phy_addr = (val & GEM_PHYMNTNC_ADDR) >> GEM_PHYMNTNC_ADDR_SHFT;
|
||||
if (phy_addr == BOARD_PHY_ADDRESS) {
|
||||
if (phy_addr == BOARD_PHY_ADDRESS || phy_addr == 0) {
|
||||
reg_num = (val & GEM_PHYMNTNC_REG) >> GEM_PHYMNTNC_REG_SHIFT;
|
||||
gem_phy_write(s, reg_num, val);
|
||||
}
|
||||
|
@@ -8,7 +8,6 @@
|
||||
*/
|
||||
#include "hw/sysbus.h"
|
||||
#include "net/net.h"
|
||||
#include "migration/migration.h"
|
||||
#include <zlib.h>
|
||||
|
||||
//#define DEBUG_STELLARIS_ENET 1
|
||||
@@ -76,7 +75,6 @@ typedef struct {
|
||||
NICConf conf;
|
||||
qemu_irq irq;
|
||||
MemoryRegion mmio;
|
||||
Error *migration_blocker;
|
||||
} stellaris_enet_state;
|
||||
|
||||
static void stellaris_enet_update(stellaris_enet_state *s)
|
||||
@@ -255,19 +253,17 @@ static void stellaris_enet_write(void *opaque, hwaddr offset,
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
|
||||
}
|
||||
} else {
|
||||
if (s->tx_fifo_len + 4 <= ARRAY_SIZE(s->tx_fifo)) {
|
||||
s->tx_fifo[s->tx_fifo_len++] = value;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 8;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 16;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
|
||||
}
|
||||
s->tx_fifo[s->tx_fifo_len++] = value;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 8;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 16;
|
||||
s->tx_fifo[s->tx_fifo_len++] = value >> 24;
|
||||
if (s->tx_fifo_len >= s->tx_frame_len) {
|
||||
/* We don't implement explicit CRC, so just chop it off. */
|
||||
if ((s->tctl & SE_TCTL_CRC) == 0)
|
||||
s->tx_frame_len -= 4;
|
||||
if ((s->tctl & SE_TCTL_PADEN) && s->tx_frame_len < 60) {
|
||||
memset(&s->tx_fifo[s->tx_frame_len], 0, 60 - s->tx_frame_len);
|
||||
s->tx_frame_len = 60;
|
||||
s->tx_fifo_len = 60;
|
||||
}
|
||||
qemu_send_packet(qemu_get_queue(s->nic), s->tx_fifo,
|
||||
s->tx_frame_len);
|
||||
@@ -364,7 +360,7 @@ static int stellaris_enet_load(QEMUFile *f, void *opaque, int version_id)
|
||||
stellaris_enet_state *s = (stellaris_enet_state *)opaque;
|
||||
int i;
|
||||
|
||||
if (1)
|
||||
if (version_id != 1)
|
||||
return -EINVAL;
|
||||
|
||||
s->ris = qemu_get_be32(f);
|
||||
@@ -425,10 +421,6 @@ static int stellaris_enet_init(SysBusDevice *sbd)
|
||||
stellaris_enet_reset(s);
|
||||
register_savevm(dev, "stellaris_enet", -1, 1,
|
||||
stellaris_enet_save, stellaris_enet_load, s);
|
||||
|
||||
error_setg(&s->migration_blocker,
|
||||
"stellaris_enet does not support migration");
|
||||
migrate_add_blocker(s->migration_blocker);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -436,9 +428,6 @@ static void stellaris_enet_unrealize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
stellaris_enet_state *s = STELLARIS_ENET(dev);
|
||||
|
||||
migrate_del_blocker(s->migration_blocker);
|
||||
error_free(s->migration_blocker);
|
||||
|
||||
unregister_savevm(DEVICE(s), "stellaris_enet", s);
|
||||
|
||||
memory_region_destroy(&s->mmio);
|
||||
|
@@ -863,14 +863,6 @@ static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void virtio_net_hdr_swap(struct virtio_net_hdr *hdr)
|
||||
{
|
||||
tswap16s(&hdr->hdr_len);
|
||||
tswap16s(&hdr->gso_size);
|
||||
tswap16s(&hdr->csum_start);
|
||||
tswap16s(&hdr->csum_offset);
|
||||
}
|
||||
|
||||
/* dhclient uses AF_PACKET but doesn't pass auxdata to the kernel so
|
||||
* it never finds out that the packets don't have valid checksums. This
|
||||
* causes dhclient to get upset. Fedora's carried a patch for ages to
|
||||
@@ -906,7 +898,6 @@ static void receive_header(VirtIONet *n, const struct iovec *iov, int iov_cnt,
|
||||
void *wbuf = (void *)buf;
|
||||
work_around_broken_dhclient(wbuf, wbuf + n->host_hdr_len,
|
||||
size - n->host_hdr_len);
|
||||
virtio_net_hdr_swap(wbuf);
|
||||
iov_from_buf(iov, iov_cnt, 0, buf, sizeof(struct virtio_net_hdr));
|
||||
} else {
|
||||
struct virtio_net_hdr hdr = {
|
||||
@@ -1115,14 +1106,6 @@ static int32_t virtio_net_flush_tx(VirtIONetQueue *q)
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (n->has_vnet_hdr) {
|
||||
if (out_sg[0].iov_len < n->guest_hdr_len) {
|
||||
error_report("virtio-net header incorrect");
|
||||
exit(1);
|
||||
}
|
||||
virtio_net_hdr_swap((void *) out_sg[0].iov_base);
|
||||
}
|
||||
|
||||
/*
|
||||
* If host wants to see the guest header as is, we can
|
||||
* pass it on unchanged. Otherwise, copy just the parts
|
||||
@@ -1379,17 +1362,10 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
|
||||
if (n->mac_table.in_use <= MAC_TABLE_ENTRIES) {
|
||||
qemu_get_buffer(f, n->mac_table.macs,
|
||||
n->mac_table.in_use * ETH_ALEN);
|
||||
} else {
|
||||
int64_t i;
|
||||
|
||||
/* Overflow detected - can happen if source has a larger MAC table.
|
||||
* We simply set overflow flag so there's no need to maintain the
|
||||
* table of addresses, discard them all.
|
||||
* Note: 64 bit math to avoid integer overflow.
|
||||
*/
|
||||
for (i = 0; i < (int64_t)n->mac_table.in_use * ETH_ALEN; ++i) {
|
||||
qemu_get_byte(f);
|
||||
}
|
||||
} else if (n->mac_table.in_use) {
|
||||
uint8_t *buf = g_malloc0(n->mac_table.in_use);
|
||||
qemu_get_buffer(f, buf, n->mac_table.in_use * ETH_ALEN);
|
||||
g_free(buf);
|
||||
n->mac_table.multi_overflow = n->mac_table.uni_overflow = 1;
|
||||
n->mac_table.in_use = 0;
|
||||
}
|
||||
@@ -1431,11 +1407,6 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id)
|
||||
}
|
||||
|
||||
n->curr_queues = qemu_get_be16(f);
|
||||
if (n->curr_queues > n->max_queues) {
|
||||
error_report("virtio-net: curr_queues %x > max_queues %x",
|
||||
n->curr_queues, n->max_queues);
|
||||
return -1;
|
||||
}
|
||||
for (i = 1; i < n->curr_queues; i++) {
|
||||
n->vqs[i].tx_waiting = qemu_get_be32(f);
|
||||
}
|
||||
|
@@ -830,7 +830,6 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
||||
}
|
||||
|
||||
pci_dev->bus = bus;
|
||||
pci_dev->devfn = devfn;
|
||||
dma_as = pci_device_iommu_address_space(pci_dev);
|
||||
|
||||
memory_region_init_alias(&pci_dev->bus_master_enable_region,
|
||||
@@ -840,6 +839,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,
|
||||
address_space_init(&pci_dev->bus_master_as, &pci_dev->bus_master_enable_region,
|
||||
name);
|
||||
|
||||
pci_dev->devfn = devfn;
|
||||
pstrcpy(pci_dev->name, sizeof(pci_dev->name), name);
|
||||
pci_dev->irq_state = 0;
|
||||
pci_config_alloc(pci_dev);
|
||||
|
@@ -795,13 +795,6 @@ static const VMStateDescription vmstate_pcie_aer_err = {
|
||||
}
|
||||
};
|
||||
|
||||
static bool pcie_aer_state_log_num_valid(void *opaque, int version_id)
|
||||
{
|
||||
PCIEAERLog *s = opaque;
|
||||
|
||||
return s->log_num <= s->log_max;
|
||||
}
|
||||
|
||||
const VMStateDescription vmstate_pcie_aer_log = {
|
||||
.name = "PCIE_AER_ERROR_LOG",
|
||||
.version_id = 1,
|
||||
@@ -809,8 +802,7 @@ const VMStateDescription vmstate_pcie_aer_log = {
|
||||
.minimum_version_id_old = 1,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT16(log_num, PCIEAERLog),
|
||||
VMSTATE_UINT16_EQUAL(log_max, PCIEAERLog),
|
||||
VMSTATE_VALIDATE("log_num <= log_max", pcie_aer_state_log_num_valid),
|
||||
VMSTATE_UINT16(log_max, PCIEAERLog),
|
||||
VMSTATE_STRUCT_VARRAY_POINTER_UINT16(log, PCIEAERLog, log_num,
|
||||
vmstate_pcie_aer_err, PCIEAERErr),
|
||||
VMSTATE_END_OF_LIST()
|
||||
|
@@ -195,7 +195,7 @@ static void pxa2xx_pcmcia_initfn(Object *obj)
|
||||
memory_region_add_subregion(&s->container_mem, 0x0c000000,
|
||||
&s->common_iomem);
|
||||
|
||||
s->slot.irq = qemu_allocate_irq(pxa2xx_pcmcia_set_irq, s, 0);
|
||||
s->slot.irq = qemu_allocate_irqs(pxa2xx_pcmcia_set_irq, s, 1)[0];
|
||||
|
||||
object_property_add_link(obj, "card", TYPE_PCMCIA_CARD,
|
||||
(Object **)&s->card,
|
||||
|
@@ -343,21 +343,6 @@ static void rtas_ibm_change_msi(PowerPCCPU *cpu, sPAPREnvironment *spapr,
|
||||
|
||||
/* There is no cached config, allocate MSIs */
|
||||
if (!phb->msi_table[ndev].nvec) {
|
||||
int max_irqs = 0;
|
||||
if (ret_intr_type == RTAS_TYPE_MSI) {
|
||||
max_irqs = msi_nr_vectors_allocated(pdev);
|
||||
} else if (ret_intr_type == RTAS_TYPE_MSIX) {
|
||||
max_irqs = pdev->msix_entries_nr;
|
||||
}
|
||||
if (!max_irqs) {
|
||||
error_report("Requested interrupt type %d is not enabled for device#%d",
|
||||
ret_intr_type, ndev);
|
||||
rtas_st(rets, 0, -1); /* Hardware error */
|
||||
return;
|
||||
}
|
||||
if (req_num > max_irqs) {
|
||||
req_num = max_irqs;
|
||||
}
|
||||
irq = spapr_allocate_irq_block(req_num, false,
|
||||
ret_intr_type == RTAS_TYPE_MSI);
|
||||
if (irq < 0) {
|
||||
|
@@ -734,11 +734,9 @@ out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw)
|
||||
static void copy_irb_to_guest(IRB *dest, const IRB *src)
|
||||
{
|
||||
int i;
|
||||
uint16_t stctl = src->scsw.ctrl & SCSW_CTRL_MASK_STCTL;
|
||||
uint16_t actl = src->scsw.ctrl & SCSW_CTRL_MASK_ACTL;
|
||||
|
||||
copy_scsw_to_guest(&dest->scsw, &src->scsw);
|
||||
|
||||
@@ -748,22 +746,8 @@ static void copy_irb_to_guest(IRB *dest, const IRB *src, PMCW *pmcw)
|
||||
for (i = 0; i < ARRAY_SIZE(dest->ecw); i++) {
|
||||
dest->ecw[i] = cpu_to_be32(src->ecw[i]);
|
||||
}
|
||||
/* extended measurements enabled? */
|
||||
if ((src->scsw.flags & SCSW_FLAGS_MASK_ESWF) ||
|
||||
!(pmcw->flags & PMCW_FLAGS_MASK_TF) ||
|
||||
!(pmcw->chars & PMCW_CHARS_MASK_XMWME)) {
|
||||
return;
|
||||
}
|
||||
/* extended measurements pending? */
|
||||
if (!(stctl & SCSW_STCTL_STATUS_PEND)) {
|
||||
return;
|
||||
}
|
||||
if ((stctl & SCSW_STCTL_PRIMARY) ||
|
||||
(stctl == SCSW_STCTL_SECONDARY) ||
|
||||
((stctl & SCSW_STCTL_INTERMEDIATE) && (actl & SCSW_ACTL_SUSP))) {
|
||||
for (i = 0; i < ARRAY_SIZE(dest->emw); i++) {
|
||||
dest->emw[i] = cpu_to_be32(src->emw[i]);
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE(dest->emw); i++) {
|
||||
dest->emw[i] = cpu_to_be32(src->emw[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -809,7 +793,7 @@ int css_do_tsch(SubchDev *sch, IRB *target_irb)
|
||||
}
|
||||
}
|
||||
/* Store the irb to the guest. */
|
||||
copy_irb_to_guest(target_irb, &irb, p);
|
||||
copy_irb_to_guest(target_irb, &irb);
|
||||
|
||||
/* Clear conditions on subchannel, if applicable. */
|
||||
if (stctl & SCSW_STCTL_STATUS_PEND) {
|
||||
|
@@ -1106,21 +1106,6 @@ static int megasas_dcmd_ld_get_list(MegasasState *s, MegasasCmd *cmd)
|
||||
return MFI_STAT_OK;
|
||||
}
|
||||
|
||||
static int megasas_dcmd_ld_list_query(MegasasState *s, MegasasCmd *cmd)
|
||||
{
|
||||
uint16_t flags;
|
||||
|
||||
/* mbox0 contains flags */
|
||||
flags = le16_to_cpu(cmd->frame->dcmd.mbox[0]);
|
||||
trace_megasas_dcmd_ld_list_query(cmd->index, flags);
|
||||
if (flags == MR_LD_QUERY_TYPE_ALL ||
|
||||
flags == MR_LD_QUERY_TYPE_EXPOSED_TO_HOST) {
|
||||
return megasas_dcmd_ld_get_list(s, cmd);
|
||||
}
|
||||
|
||||
return MFI_STAT_OK;
|
||||
}
|
||||
|
||||
static int megasas_ld_get_info_submit(SCSIDevice *sdev, int lun,
|
||||
MegasasCmd *cmd)
|
||||
{
|
||||
@@ -1424,8 +1409,6 @@ static const struct dcmd_cmd_tbl_t {
|
||||
megasas_dcmd_dummy },
|
||||
{ MFI_DCMD_LD_GET_LIST, "LD_GET_LIST",
|
||||
megasas_dcmd_ld_get_list},
|
||||
{ MFI_DCMD_LD_LIST_QUERY, "LD_LIST_QUERY",
|
||||
megasas_dcmd_ld_list_query },
|
||||
{ MFI_DCMD_LD_GET_INFO, "LD_GET_INFO",
|
||||
megasas_dcmd_ld_get_info },
|
||||
{ MFI_DCMD_LD_GET_PROP, "LD_GET_PROP",
|
||||
|
@@ -164,7 +164,6 @@ typedef enum {
|
||||
MFI_DCMD_PD_BLINK = 0x02070100,
|
||||
MFI_DCMD_PD_UNBLINK = 0x02070200,
|
||||
MFI_DCMD_LD_GET_LIST = 0x03010000,
|
||||
MFI_DCMD_LD_LIST_QUERY = 0x03010100,
|
||||
MFI_DCMD_LD_GET_INFO = 0x03020000,
|
||||
MFI_DCMD_LD_GET_PROP = 0x03030000,
|
||||
MFI_DCMD_LD_SET_PROP = 0x03040000,
|
||||
@@ -412,14 +411,6 @@ typedef enum {
|
||||
MR_PD_QUERY_TYPE_EXPOSED_TO_HOST = 5, /*query for system drives */
|
||||
} mfi_pd_query_type;
|
||||
|
||||
typedef enum {
|
||||
MR_LD_QUERY_TYPE_ALL = 0,
|
||||
MR_LD_QUERY_TYPE_EXPOSED_TO_HOST = 1,
|
||||
MR_LD_QUERY_TYPE_USED_TGT_IDS = 2,
|
||||
MR_LD_QUERY_TYPE_CLUSTER_ACCESS = 3,
|
||||
MR_LD_QUERY_TYPE_CLUSTER_LOCALE = 4,
|
||||
} mfi_ld_query_type;
|
||||
|
||||
/*
|
||||
* Other propertities and definitions
|
||||
*/
|
||||
|
@@ -2520,7 +2520,7 @@ static SCSIRequest *scsi_block_new_request(SCSIDevice *d, uint32_t tag,
|
||||
* ones (such as WRITE SAME or EXTENDED COPY, etc.). So, without
|
||||
* O_DIRECT everything must go through SG_IO.
|
||||
*/
|
||||
if (!(bdrv_get_flags(s->qdev.conf.bs) & BDRV_O_NOCACHE)) {
|
||||
if (bdrv_get_flags(s->qdev.conf.bs) & BDRV_O_NOCACHE) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -196,10 +196,6 @@ static void vhost_scsi_set_status(VirtIODevice *vdev, uint8_t val)
|
||||
}
|
||||
}
|
||||
|
||||
static void vhost_dummy_handle_output(VirtIODevice *vdev, VirtQueue *vq)
|
||||
{
|
||||
}
|
||||
|
||||
static void vhost_scsi_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(dev);
|
||||
@@ -221,9 +217,7 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
|
||||
}
|
||||
}
|
||||
|
||||
virtio_scsi_common_realize(dev, &err, vhost_dummy_handle_output,
|
||||
vhost_dummy_handle_output,
|
||||
vhost_dummy_handle_output);
|
||||
virtio_scsi_common_realize(dev, &err);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
|
@@ -147,15 +147,6 @@ static void *virtio_scsi_load_request(QEMUFile *f, SCSIRequest *sreq)
|
||||
qemu_get_be32s(f, &n);
|
||||
assert(n < vs->conf.num_queues);
|
||||
qemu_get_buffer(f, (unsigned char *)&req->elem, sizeof(req->elem));
|
||||
/* TODO: add a way for SCSIBusInfo's load_request to fail,
|
||||
* and fail migration instead of asserting here.
|
||||
* When we do, we might be able to re-enable NDEBUG below.
|
||||
*/
|
||||
#ifdef NDEBUG
|
||||
#error building with NDEBUG is not supported
|
||||
#endif
|
||||
assert(req->elem.in_num <= ARRAY_SIZE(req->elem.in_sg));
|
||||
assert(req->elem.out_num <= ARRAY_SIZE(req->elem.out_sg));
|
||||
virtio_scsi_parse_req(s, vs->cmd_vqs[n], req);
|
||||
|
||||
scsi_req_ref(sreq);
|
||||
@@ -498,7 +489,7 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
|
||||
uint32_t event, uint32_t reason)
|
||||
{
|
||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
|
||||
VirtIOSCSIReq *req;
|
||||
VirtIOSCSIReq *req = virtio_scsi_pop_req(s, vs->event_vq);
|
||||
VirtIOSCSIEvent *evt;
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(s);
|
||||
int in_size;
|
||||
@@ -507,7 +498,6 @@ static void virtio_scsi_push_event(VirtIOSCSI *s, SCSIDevice *dev,
|
||||
return;
|
||||
}
|
||||
|
||||
req = virtio_scsi_pop_req(s, vs->event_vq);
|
||||
if (!req) {
|
||||
s->events_dropped = true;
|
||||
return;
|
||||
@@ -605,9 +595,7 @@ static struct SCSIBusInfo virtio_scsi_scsi_info = {
|
||||
.load_request = virtio_scsi_load_request,
|
||||
};
|
||||
|
||||
void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
|
||||
HandleOutput ctrl, HandleOutput evt,
|
||||
HandleOutput cmd)
|
||||
void virtio_scsi_common_realize(DeviceState *dev, Error **errp)
|
||||
{
|
||||
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
|
||||
VirtIOSCSICommon *s = VIRTIO_SCSI_COMMON(dev);
|
||||
@@ -621,12 +609,12 @@ void virtio_scsi_common_realize(DeviceState *dev, Error **errp,
|
||||
s->cdb_size = VIRTIO_SCSI_CDB_SIZE;
|
||||
|
||||
s->ctrl_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,
|
||||
ctrl);
|
||||
virtio_scsi_handle_ctrl);
|
||||
s->event_vq = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,
|
||||
evt);
|
||||
virtio_scsi_handle_event);
|
||||
for (i = 0; i < s->conf.num_queues; i++) {
|
||||
s->cmd_vqs[i] = virtio_add_queue(vdev, VIRTIO_SCSI_VQ_SIZE,
|
||||
cmd);
|
||||
virtio_scsi_handle_cmd);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -637,9 +625,7 @@ static void virtio_scsi_device_realize(DeviceState *dev, Error **errp)
|
||||
static int virtio_scsi_id;
|
||||
Error *err = NULL;
|
||||
|
||||
virtio_scsi_common_realize(dev, &err, virtio_scsi_handle_ctrl,
|
||||
virtio_scsi_handle_event,
|
||||
virtio_scsi_handle_cmd);
|
||||
virtio_scsi_common_realize(dev, &err);
|
||||
if (err != NULL) {
|
||||
error_propagate(errp, err);
|
||||
return;
|
||||
|
@@ -625,7 +625,7 @@ struct omap_mmc_s *omap2_mmc_init(struct omap_target_agent_s *ta,
|
||||
exit(1);
|
||||
}
|
||||
|
||||
s->cdet = qemu_allocate_irq(omap_mmc_cover_cb, s, 0);
|
||||
s->cdet = qemu_allocate_irqs(omap_mmc_cover_cb, s, 1)[0];
|
||||
sd_set_cb(s->card, NULL, s->cdet);
|
||||
|
||||
return s;
|
||||
|
@@ -1168,8 +1168,8 @@ static void sdhci_initfn(Object *obj)
|
||||
if (s->card == NULL) {
|
||||
exit(1);
|
||||
}
|
||||
s->eject_cb = qemu_allocate_irq(sdhci_insert_eject_cb, s, 0);
|
||||
s->ro_cb = qemu_allocate_irq(sdhci_card_readonly_cb, s, 0);
|
||||
s->eject_cb = qemu_allocate_irqs(sdhci_insert_eject_cb, s, 1)[0];
|
||||
s->ro_cb = qemu_allocate_irqs(sdhci_card_readonly_cb, s, 1)[0];
|
||||
sd_set_cb(s->card, s->ro_cb, s->eject_cb);
|
||||
|
||||
s->insert_timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, sdhci_raise_insertion_irq, s);
|
||||
@@ -1184,8 +1184,8 @@ static void sdhci_uninitfn(Object *obj)
|
||||
timer_free(s->insert_timer);
|
||||
timer_del(s->transfer_timer);
|
||||
timer_free(s->transfer_timer);
|
||||
qemu_free_irq(s->eject_cb);
|
||||
qemu_free_irq(s->ro_cb);
|
||||
qemu_free_irqs(&s->eject_cb);
|
||||
qemu_free_irqs(&s->ro_cb);
|
||||
|
||||
if (s->fifo_buffer) {
|
||||
g_free(s->fifo_buffer);
|
||||
|
@@ -230,17 +230,8 @@ static int ssi_sd_load(QEMUFile *f, void *opaque, int version_id)
|
||||
for (i = 0; i < 5; i++)
|
||||
s->response[i] = qemu_get_be32(f);
|
||||
s->arglen = qemu_get_be32(f);
|
||||
if (s->mode == SSI_SD_CMDARG &&
|
||||
(s->arglen < 0 || s->arglen >= ARRAY_SIZE(s->cmdarg))) {
|
||||
return -EINVAL;
|
||||
}
|
||||
s->response_pos = qemu_get_be32(f);
|
||||
s->stopping = qemu_get_be32(f);
|
||||
if (s->mode == SSI_SD_RESPONSE &&
|
||||
(s->response_pos < 0 || s->response_pos >= ARRAY_SIZE(s->response) ||
|
||||
(!s->stopping && s->arglen > ARRAY_SIZE(s->response)))) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
ss->cs = qemu_get_be32(f);
|
||||
|
||||
|
@@ -838,5 +838,6 @@ SH7750State *sh7750_init(SuperHCPU *cpu, MemoryRegion *sysmem)
|
||||
qemu_irq sh7750_irl(SH7750State *s)
|
||||
{
|
||||
sh_intc_toggle_source(sh_intc_source(&s->intc, IRL), 1, 0); /* enable */
|
||||
return qemu_allocate_irq(sh_intc_set_irl, sh_intc_source(&s->intc, IRL), 0);
|
||||
return qemu_allocate_irqs(sh_intc_set_irl, sh_intc_source(&s->intc, IRL),
|
||||
1)[0];
|
||||
}
|
||||
|
@@ -240,25 +240,11 @@ static const MemoryRegionOps pl022_ops = {
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
static int pl022_post_load(void *opaque, int version_id)
|
||||
{
|
||||
PL022State *s = opaque;
|
||||
|
||||
if (s->tx_fifo_head < 0 ||
|
||||
s->tx_fifo_head >= ARRAY_SIZE(s->tx_fifo) ||
|
||||
s->rx_fifo_head < 0 ||
|
||||
s->rx_fifo_head >= ARRAY_SIZE(s->rx_fifo)) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const VMStateDescription vmstate_pl022 = {
|
||||
.name = "pl022_ssp",
|
||||
.version_id = 1,
|
||||
.minimum_version_id = 1,
|
||||
.minimum_version_id_old = 1,
|
||||
.post_load = pl022_post_load,
|
||||
.fields = (VMStateField[]) {
|
||||
VMSTATE_UINT32(cr0, PL022State),
|
||||
VMSTATE_UINT32(cr1, PL022State),
|
||||
|
@@ -19,6 +19,15 @@
|
||||
#include "sysemu/sysemu.h"
|
||||
#include "hw/timer/allwinner-a10-pit.h"
|
||||
|
||||
static void a10_pit_update_irq(AwA10PITState *s)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) {
|
||||
qemu_set_irq(s->irq[i], !!(s->irq_status & s->irq_enable & (1 << i)));
|
||||
}
|
||||
}
|
||||
|
||||
static uint64_t a10_pit_read(void *opaque, hwaddr offset, unsigned size)
|
||||
{
|
||||
AwA10PITState *s = AW_A10_PIT(opaque);
|
||||
@@ -65,6 +74,22 @@ static uint64_t a10_pit_read(void *opaque, hwaddr offset, unsigned size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void a10_pit_set_freq(AwA10PITState *s, int index)
|
||||
{
|
||||
uint32_t prescaler, source, source_freq;
|
||||
|
||||
prescaler = 1 << extract32(s->control[index], 4, 3);
|
||||
source = extract32(s->control[index], 2, 2);
|
||||
source_freq = s->clk_freq[source];
|
||||
|
||||
if (source_freq) {
|
||||
ptimer_set_freq(s->timer[index], source_freq / prescaler);
|
||||
} else {
|
||||
qemu_log_mask(LOG_GUEST_ERROR, "%s: Invalid clock source %u\n",
|
||||
__func__, source);
|
||||
}
|
||||
}
|
||||
|
||||
static void a10_pit_write(void *opaque, hwaddr offset, uint64_t value,
|
||||
unsigned size)
|
||||
{
|
||||
@@ -74,9 +99,11 @@ static void a10_pit_write(void *opaque, hwaddr offset, uint64_t value,
|
||||
switch (offset) {
|
||||
case AW_A10_PIT_TIMER_IRQ_EN:
|
||||
s->irq_enable = value;
|
||||
a10_pit_update_irq(s);
|
||||
break;
|
||||
case AW_A10_PIT_TIMER_IRQ_ST:
|
||||
s->irq_status &= ~value;
|
||||
a10_pit_update_irq(s);
|
||||
break;
|
||||
case AW_A10_PIT_TIMER_BASE ... AW_A10_PIT_TIMER_BASE_END:
|
||||
index = offset & 0xf0;
|
||||
@@ -85,6 +112,7 @@ static void a10_pit_write(void *opaque, hwaddr offset, uint64_t value,
|
||||
switch (offset & 0x0f) {
|
||||
case AW_A10_PIT_TIMER_CONTROL:
|
||||
s->control[index] = value;
|
||||
a10_pit_set_freq(s, index);
|
||||
if (s->control[index] & AW_A10_PIT_TIMER_RELOAD) {
|
||||
ptimer_set_count(s->timer[index], s->interval[index]);
|
||||
}
|
||||
@@ -150,6 +178,14 @@ static const MemoryRegionOps a10_pit_ops = {
|
||||
.endianness = DEVICE_NATIVE_ENDIAN,
|
||||
};
|
||||
|
||||
static Property a10_pit_properties[] = {
|
||||
DEFINE_PROP_UINT32("clk0-freq", AwA10PITState, clk_freq[0], 0),
|
||||
DEFINE_PROP_UINT32("clk1-freq", AwA10PITState, clk_freq[1], 0),
|
||||
DEFINE_PROP_UINT32("clk2-freq", AwA10PITState, clk_freq[2], 0),
|
||||
DEFINE_PROP_UINT32("clk3-freq", AwA10PITState, clk_freq[3], 0),
|
||||
DEFINE_PROP_END_OF_LIST(),
|
||||
};
|
||||
|
||||
static const VMStateDescription vmstate_a10_pit = {
|
||||
.name = "a10.pit",
|
||||
.version_id = 1,
|
||||
@@ -178,11 +214,14 @@ static void a10_pit_reset(DeviceState *dev)
|
||||
|
||||
s->irq_enable = 0;
|
||||
s->irq_status = 0;
|
||||
a10_pit_update_irq(s);
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
s->control[i] = AW_A10_PIT_DEFAULT_CLOCK;
|
||||
s->interval[i] = 0;
|
||||
s->count[i] = 0;
|
||||
ptimer_stop(s->timer[i]);
|
||||
a10_pit_set_freq(s, i);
|
||||
}
|
||||
s->watch_dog_mode = 0;
|
||||
s->watch_dog_control = 0;
|
||||
@@ -193,18 +232,17 @@ static void a10_pit_reset(DeviceState *dev)
|
||||
|
||||
static void a10_pit_timer_cb(void *opaque)
|
||||
{
|
||||
AwA10PITState *s = AW_A10_PIT(opaque);
|
||||
uint8_t i;
|
||||
AwA10TimerContext *tc = opaque;
|
||||
AwA10PITState *s = tc->container;
|
||||
uint8_t i = tc->index;
|
||||
|
||||
for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) {
|
||||
if (s->control[i] & AW_A10_PIT_TIMER_EN) {
|
||||
s->irq_status |= 1 << i;
|
||||
if (s->control[i] & AW_A10_PIT_TIMER_MODE) {
|
||||
ptimer_stop(s->timer[i]);
|
||||
s->control[i] &= ~AW_A10_PIT_TIMER_EN;
|
||||
}
|
||||
qemu_irq_pulse(s->irq[i]);
|
||||
if (s->control[i] & AW_A10_PIT_TIMER_EN) {
|
||||
s->irq_status |= 1 << i;
|
||||
if (s->control[i] & AW_A10_PIT_TIMER_MODE) {
|
||||
ptimer_stop(s->timer[i]);
|
||||
s->control[i] &= ~AW_A10_PIT_TIMER_EN;
|
||||
}
|
||||
a10_pit_update_irq(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,9 +261,12 @@ static void a10_pit_init(Object *obj)
|
||||
sysbus_init_mmio(sbd, &s->iomem);
|
||||
|
||||
for (i = 0; i < AW_A10_PIT_TIMER_NR; i++) {
|
||||
bh[i] = qemu_bh_new(a10_pit_timer_cb, s);
|
||||
AwA10TimerContext *tc = &s->timer_context[i];
|
||||
|
||||
tc->container = s;
|
||||
tc->index = i;
|
||||
bh[i] = qemu_bh_new(a10_pit_timer_cb, tc);
|
||||
s->timer[i] = ptimer_init(bh[i]);
|
||||
ptimer_set_freq(s->timer[i], 240000);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -234,6 +275,7 @@ static void a10_pit_class_init(ObjectClass *klass, void *data)
|
||||
DeviceClass *dc = DEVICE_CLASS(klass);
|
||||
|
||||
dc->reset = a10_pit_reset;
|
||||
dc->props = a10_pit_properties;
|
||||
dc->desc = "allwinner a10 timer";
|
||||
dc->vmsd = &vmstate_a10_pit;
|
||||
}
|
||||
|
@@ -346,11 +346,13 @@ static void cadence_ttc_write(void *opaque, hwaddr offset,
|
||||
case 0x34:
|
||||
case 0x38:
|
||||
s->reg_match[0] = value & 0xffff;
|
||||
break;
|
||||
|
||||
case 0x3c: /* match register */
|
||||
case 0x40:
|
||||
case 0x44:
|
||||
s->reg_match[1] = value & 0xffff;
|
||||
break;
|
||||
|
||||
case 0x48: /* match register */
|
||||
case 0x4c:
|
||||
|
@@ -239,18 +239,6 @@ static int hpet_pre_load(void *opaque)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool hpet_validate_num_timers(void *opaque, int version_id)
|
||||
{
|
||||
HPETState *s = opaque;
|
||||
|
||||
if (s->num_timers < HPET_MIN_TIMERS) {
|
||||
return false;
|
||||
} else if (s->num_timers > HPET_MAX_TIMERS) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static int hpet_post_load(void *opaque, int version_id)
|
||||
{
|
||||
HPETState *s = opaque;
|
||||
@@ -319,7 +307,6 @@ static const VMStateDescription vmstate_hpet = {
|
||||
VMSTATE_UINT64(isr, HPETState),
|
||||
VMSTATE_UINT64(hpet_counter, HPETState),
|
||||
VMSTATE_UINT8_V(num_timers, HPETState, 2),
|
||||
VMSTATE_VALIDATE("num_timers in range", hpet_validate_num_timers),
|
||||
VMSTATE_STRUCT_VARRAY_UINT8(timer, HPETState, num_timers, 0,
|
||||
vmstate_hpet_timer, HPETTimer),
|
||||
VMSTATE_END_OF_LIST()
|
||||
|
@@ -322,7 +322,7 @@ static void pit_post_load(PITCommonState *s)
|
||||
}
|
||||
}
|
||||
|
||||
static void pit_realizefn(DeviceState *dev, Error **errp)
|
||||
static void pit_realizefn(DeviceState *dev, Error **err)
|
||||
{
|
||||
PITCommonState *pit = PIT_COMMON(dev);
|
||||
PITClass *pc = PIT_GET_CLASS(dev);
|
||||
@@ -338,7 +338,7 @@ static void pit_realizefn(DeviceState *dev, Error **errp)
|
||||
|
||||
qdev_init_gpio_in(dev, pit_irq_control, 1);
|
||||
|
||||
pc->parent_realize(dev, errp);
|
||||
pc->parent_realize(dev, err);
|
||||
}
|
||||
|
||||
static Property pit_properties[] = {
|
||||
|
@@ -852,7 +852,7 @@ static void rtc_realizefn(DeviceState *dev, Error **errp)
|
||||
check_update_timer(s);
|
||||
|
||||
s->clock_reset_notifier.notify = rtc_notify_clock_reset;
|
||||
qemu_clock_register_reset_notifier(rtc_clock,
|
||||
qemu_clock_register_reset_notifier(QEMU_CLOCK_REALTIME,
|
||||
&s->clock_reset_notifier);
|
||||
|
||||
s->suspend_notifier.notify = rtc_notify_suspend;
|
||||
|
@@ -227,7 +227,7 @@ static void omap_gp_timer_clk_update(void *opaque, int line, int on)
|
||||
static void omap_gp_timer_clk_setup(struct omap_gp_timer_s *timer)
|
||||
{
|
||||
omap_clk_adduser(timer->clk,
|
||||
qemu_allocate_irq(omap_gp_timer_clk_update, timer, 0));
|
||||
qemu_allocate_irqs(omap_gp_timer_clk_update, timer, 1)[0]);
|
||||
timer->rate = omap_clk_getrate(timer->clk);
|
||||
}
|
||||
|
||||
@@ -476,7 +476,7 @@ struct omap_gp_timer_s *omap_gp_timer_init(struct omap_target_agent_s *ta,
|
||||
s->clk = fclk;
|
||||
s->timer = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_gp_timer_tick, s);
|
||||
s->match = timer_new_ns(QEMU_CLOCK_VIRTUAL, omap_gp_timer_match, s);
|
||||
s->in = qemu_allocate_irq(omap_gp_timer_input, s, 0);
|
||||
s->in = qemu_allocate_irqs(omap_gp_timer_input, s, 1)[0];
|
||||
omap_gp_timer_reset(s);
|
||||
omap_gp_timer_clk_setup(s);
|
||||
|
||||
|
@@ -26,6 +26,10 @@ common-obj-y += ccid-card-passthru.o
|
||||
common-obj-$(CONFIG_SMARTCARD_NSS) += ccid-card-emulated.o
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_POSIX),y)
|
||||
common-obj-$(CONFIG_USB_STORAGE_MTP) += dev-mtp.o
|
||||
endif
|
||||
|
||||
# usb redirection
|
||||
common-obj-$(CONFIG_USB_REDIR) += redirect.o quirks.o
|
||||
|
||||
|
@@ -49,9 +49,7 @@ static int usb_device_post_load(void *opaque, int version_id)
|
||||
} else {
|
||||
dev->attached = 1;
|
||||
}
|
||||
if (dev->setup_index < 0 ||
|
||||
dev->setup_len < 0 ||
|
||||
dev->setup_index >= sizeof(dev->data_buf) ||
|
||||
if (dev->setup_index >= sizeof(dev->data_buf) ||
|
||||
dev->setup_len >= sizeof(dev->data_buf)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@ typedef struct msos_compat_hdr {
|
||||
typedef struct msos_compat_func {
|
||||
uint8_t bFirstInterfaceNumber;
|
||||
uint8_t reserved_1;
|
||||
uint8_t compatibleId[8];
|
||||
char compatibleId[8];
|
||||
uint8_t subCompatibleId[8];
|
||||
uint8_t reserved_2[6];
|
||||
} QEMU_PACKED msos_compat_func;
|
||||
@@ -59,6 +59,10 @@ static int usb_desc_msos_compat(const USBDesc *desc, uint8_t *dest)
|
||||
func = (void *)(dest + length);
|
||||
func->bFirstInterfaceNumber = 0;
|
||||
func->reserved_1 = 0x01;
|
||||
if (desc->msos->CompatibleID) {
|
||||
snprintf(func->compatibleId, sizeof(func->compatibleId),
|
||||
"%s", desc->msos->CompatibleID);
|
||||
}
|
||||
length += sizeof(*func);
|
||||
count++;
|
||||
|
||||
|
@@ -184,6 +184,7 @@ struct USBDescOther {
|
||||
};
|
||||
|
||||
struct USBDescMSOS {
|
||||
const char *CompatibleID;
|
||||
const wchar_t *Label;
|
||||
bool SelectiveSuspendEnabled;
|
||||
};
|
||||
|
@@ -19,7 +19,6 @@
|
||||
*/
|
||||
|
||||
#include "qemu-common.h"
|
||||
#include "qemu/error-report.h"
|
||||
#include "hw/usb.h"
|
||||
#include "hw/usb/desc.h"
|
||||
#include "sysemu/bt.h"
|
||||
@@ -507,14 +506,6 @@ static int usb_bt_initfn(USBDevice *dev)
|
||||
|
||||
usb_desc_create_serial(dev);
|
||||
usb_desc_init(dev);
|
||||
s->dev.opaque = s;
|
||||
if (!s->hci) {
|
||||
s->hci = bt_new_hci(qemu_find_bt_vlan(0));
|
||||
}
|
||||
s->hci->opaque = s;
|
||||
s->hci->evt_recv = usb_bt_out_hci_packet_event;
|
||||
s->hci->acl_recv = usb_bt_out_hci_packet_acl;
|
||||
usb_bt_handle_reset(&s->dev);
|
||||
s->intr = usb_ep_get(dev, USB_TOKEN_IN, USB_EVT_EP);
|
||||
|
||||
return 0;
|
||||
@@ -525,7 +516,6 @@ static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
|
||||
USBDevice *dev;
|
||||
struct USBBtState *s;
|
||||
HCIInfo *hci;
|
||||
const char *name = "usb-bt-dongle";
|
||||
|
||||
if (*cmdline) {
|
||||
hci = hci_init(cmdline);
|
||||
@@ -535,17 +525,19 @@ static USBDevice *usb_bt_init(USBBus *bus, const char *cmdline)
|
||||
|
||||
if (!hci)
|
||||
return NULL;
|
||||
dev = usb_create(bus, name);
|
||||
dev = usb_create_simple(bus, "usb-bt-dongle");
|
||||
if (!dev) {
|
||||
error_report("Failed to create USB device '%s'", name);
|
||||
return NULL;
|
||||
}
|
||||
s = DO_UPCAST(struct USBBtState, dev, dev);
|
||||
s->dev.opaque = s;
|
||||
|
||||
s->hci = hci;
|
||||
if (qdev_init(&dev->qdev) < 0) {
|
||||
error_report("Failed to initialize USB device '%s'", name);
|
||||
return NULL;
|
||||
}
|
||||
s->hci->opaque = s;
|
||||
s->hci->evt_recv = usb_bt_out_hci_packet_event;
|
||||
s->hci->acl_recv = usb_bt_out_hci_packet_acl;
|
||||
|
||||
usb_bt_handle_reset(&s->dev);
|
||||
|
||||
return dev;
|
||||
}
|
||||
|
1103
hw/usb/dev-mtp.c
Normal file
1103
hw/usb/dev-mtp.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -3703,7 +3703,6 @@ static const VMStateDescription vmstate_xhci_event = {
|
||||
VMSTATE_UINT32(flags, XHCIEvent),
|
||||
VMSTATE_UINT8(slotid, XHCIEvent),
|
||||
VMSTATE_UINT8(epid, XHCIEvent),
|
||||
VMSTATE_END_OF_LIST()
|
||||
}
|
||||
};
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user