aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2014-03-31 22:11:29 +0100
committerPeter Maydell <peter.maydell@linaro.org>2014-03-31 22:11:30 +0100
commit95224e87a71d3190f46bf543ec9bc59ae36050eb (patch)
treece74fe55855beb42d02fcdd6cd088315ec1e250f /hw
parent63678e17cf399ff81b93417fe7bee8d6ef6b6b1b (diff)
parent7373fc76930fc0994bab1bc2defd1d3a2b2adaa3 (diff)
Merge remote-tracking branch 'remotes/afaerber/tags/qom-devices-for-2.0' into staging
QOM/QTest infrastructure fixes * Revised QTest SIGABRT fix * Test cleanups for non-POSIX hosts * QTest test cases for NVMe, virtio-9p, pvpanic, i82801b11 * QTest API addition for reading events * TMP105 fix and regression test # gpg: Signature made Mon 31 Mar 2014 22:08:10 BST using RSA key ID 3E7E013F # gpg: Good signature from "Andreas Färber <afaerber@suse.de>" # gpg: aka "Andreas Färber <afaerber@suse.com>" * remotes/afaerber/tags/qom-devices-for-2.0: tmp105-test: Test QOM property and precision tmp105-test: Add a second sensor and test that one tmp105-test: Wrap simple building blocks for testing tmp105: Read temperature in milli-celsius tests: Add i82801b11 qtest pvpanic-test: Assert pause event qtest: Factor out qtest_qmp_receive() tests: Add pvpanic qtest tests: Add virtio-9p qtest tests: Add nvme qtest nvme: Permit zero-length block devices tests: Correctly skip qtest on non-POSIX hosts tests: Skip POSIX-only tests on Windows tests: Remove unsupported tests for MinGW qtest: Keep list of qtest instances for SIGABRT handler Revert "qtest: Fix crash if SIGABRT during qtest_init()" Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw')
-rw-r--r--hw/block/nvme.c4
-rw-r--r--hw/misc/tmp105.c8
2 files changed, 7 insertions, 5 deletions
diff --git a/hw/block/nvme.c b/hw/block/nvme.c
index 2882ffefce..5fd8f89822 100644
--- a/hw/block/nvme.c
+++ b/hw/block/nvme.c
@@ -752,8 +752,8 @@ static int nvme_init(PCIDevice *pci_dev)
return -1;
}
- bs_size = bdrv_getlength(n->conf.bs);
- if (bs_size <= 0) {
+ bs_size = bdrv_getlength(n->conf.bs);
+ if (bs_size < 0) {
return -1;
}
diff --git a/hw/misc/tmp105.c b/hw/misc/tmp105.c
index 155e03df80..63aa3d6277 100644
--- a/hw/misc/tmp105.c
+++ b/hw/misc/tmp105.c
@@ -56,12 +56,14 @@ static void tmp105_get_temperature(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
TMP105State *s = TMP105(obj);
- int64_t value = s->temperature;
+ int64_t value = s->temperature * 1000 / 256;
visit_type_int(v, &value, name, errp);
}
-/* Units are 0.001 centigrades relative to 0 C. */
+/* Units are 0.001 centigrades relative to 0 C. s->temperature is 8.8
+ * fixed point, so units are 1/256 centigrades. A simple ratio will do.
+ */
static void tmp105_set_temperature(Object *obj, Visitor *v, void *opaque,
const char *name, Error **errp)
{
@@ -78,7 +80,7 @@ static void tmp105_set_temperature(Object *obj, Visitor *v, void *opaque,
return;
}
- s->temperature = ((int16_t) (temp * 0x800 / 128000)) << 4;
+ s->temperature = (int16_t) (temp * 256 / 1000);
tmp105_alarm_update(s);
}