[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 12/17] hw/misc/bcm2835_property: Hold the temperature in the
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 12/17] hw/misc/bcm2835_property: Hold the temperature in the device state |
Date: |
Tue, 21 Apr 2020 14:16:21 +0200 |
We are going to modify this variable, move it to the device state.
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
include/hw/misc/bcm2835_property.h | 1 +
hw/misc/bcm2835_property.c | 8 +++++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/include/hw/misc/bcm2835_property.h
b/include/hw/misc/bcm2835_property.h
index b321f22499..010ad39ed0 100644
--- a/include/hw/misc/bcm2835_property.h
+++ b/include/hw/misc/bcm2835_property.h
@@ -31,6 +31,7 @@ typedef struct {
uint32_t board_rev;
uint32_t addr;
bool pending;
+ float64 temp_mC;
} BCM2835PropertyState;
#endif
diff --git a/hw/misc/bcm2835_property.c b/hw/misc/bcm2835_property.c
index 3e228ca0ae..bbe80affd4 100644
--- a/hw/misc/bcm2835_property.c
+++ b/hw/misc/bcm2835_property.c
@@ -143,7 +143,7 @@ static void bcm2835_property_mbox_push(BCM2835PropertyState
*s, uint32_t value)
/* Temperature */
case 0x00030006: /* Get temperature */
- stl_le_phys(&s->dma_as, value + 16, 25000);
+ stl_le_phys(&s->dma_as, value + 16, s->temp_mC);
resplen = 8;
break;
@@ -361,12 +361,13 @@ static const MemoryRegionOps bcm2835_property_ops = {
static const VMStateDescription vmstate_bcm2835_property = {
.name = TYPE_BCM2835_PROPERTY,
- .version_id = 1,
- .minimum_version_id = 1,
+ .version_id = 2,
+ .minimum_version_id = 2,
.fields = (VMStateField[]) {
VMSTATE_MACADDR(macaddr, BCM2835PropertyState),
VMSTATE_UINT32(addr, BCM2835PropertyState),
VMSTATE_BOOL(pending, BCM2835PropertyState),
+ VMSTATE_FLOAT64(temp_mC, BCM2835PropertyState),
VMSTATE_END_OF_LIST()
}
};
@@ -375,6 +376,7 @@ static void bcm2835_property_init(Object *obj)
{
BCM2835PropertyState *s = BCM2835_PROPERTY(obj);
+ s->temp_mC = 25e3;
memory_region_init_io(&s->iomem, OBJECT(s), &bcm2835_property_ops, s,
TYPE_BCM2835_PROPERTY, 0x10);
sysbus_init_mmio(SYS_BUS_DEVICE(s), &s->iomem);
--
2.21.1
- Re: [RFC PATCH 03/17] hw/misc/temp-sensor: Add 'info temp' HMP command, (continued)
- [RFC PATCH 01/17] hw/misc: Introduce the temperature sensor interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 06/17] hw/misc/tmp421: Add definition for SENSORS_COUNT, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 08/17] hw/misc/tmp421: Extract set_temp_mC() helper, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 04/17] hw/misc/tmp105: Extract get_temp_mC() and set_temp_mC() helpers, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 05/17] hw/misc/tmp105: Implement the 'temperature-sensor' qdev interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 09/17] hw/misc/tmp421: Implement the 'temperature-sensor' qdev interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 10/17] hw/misc/bcm2835_thermal: Hold the temperature in the device state, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 07/17] hw/misc/tmp421: Extract get_temp_mC() helper, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 11/17] hw/misc/bcm2835_thermal: Implement the 'temperature-sensor' interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 12/17] hw/misc/bcm2835_property: Hold the temperature in the device state,
Philippe Mathieu-Daudé <=
- [RFC PATCH 15/17] hw/ide/qdev: Implement the 'temperature-sensor' qdev interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 14/17] hw/display/ads7846: Implement the 'temperature-sensor' qdev interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 17/17] tests/qtest/tmp105-test: Trivial test for TempSensorClass, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 16/17] hw/misc/imx6ul_ccm: Implement the 'temperature-sensor' qdev interface, Philippe Mathieu-Daudé, 2020/04/21
- [RFC PATCH 13/17] hw/misc/bcm2835_property: Implement the 'temperature-sensor' interface, Philippe Mathieu-Daudé, 2020/04/21