aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
Diffstat (limited to 'hw')
-rw-r--r--hw/scsi/megasas.c17
-rw-r--r--hw/timer/etraxfs_timer.c34
2 files changed, 36 insertions, 15 deletions
diff --git a/hw/scsi/megasas.c b/hw/scsi/megasas.c
index de613c8..c9da5ce 100644
--- a/hw/scsi/megasas.c
+++ b/hw/scsi/megasas.c
@@ -383,8 +383,7 @@ static int megasas_setup_inquiry(uint8_t *cdb, int pg, int len)
cdb[1] = 0x1;
cdb[2] = pg;
}
- cdb[3] = (len >> 8) & 0xff;
- cdb[4] = (len & 0xff);
+ stw_be_p(&cdb[3], len);
return len;
}
@@ -400,18 +399,8 @@ static void megasas_encode_lba(uint8_t *cdb, uint64_t lba,
} else {
cdb[0] = READ_16;
}
- cdb[2] = (lba >> 56) & 0xff;
- cdb[3] = (lba >> 48) & 0xff;
- cdb[4] = (lba >> 40) & 0xff;
- cdb[5] = (lba >> 32) & 0xff;
- cdb[6] = (lba >> 24) & 0xff;
- cdb[7] = (lba >> 16) & 0xff;
- cdb[8] = (lba >> 8) & 0xff;
- cdb[9] = (lba) & 0xff;
- cdb[10] = (len >> 24) & 0xff;
- cdb[11] = (len >> 16) & 0xff;
- cdb[12] = (len >> 8) & 0xff;
- cdb[13] = (len) & 0xff;
+ stq_be_p(&cdb[2], lba);
+ stl_be_p(&cdb[2 + 8], len);
}
/*
diff --git a/hw/timer/etraxfs_timer.c b/hw/timer/etraxfs_timer.c
index 4ba6621..139e5b8 100644
--- a/hw/timer/etraxfs_timer.c
+++ b/hw/timer/etraxfs_timer.c
@@ -26,6 +26,7 @@
#include "hw/sysbus.h"
#include "sysemu/reset.h"
#include "sysemu/runstate.h"
+#include "migration/vmstate.h"
#include "qemu/module.h"
#include "qemu/timer.h"
#include "hw/irq.h"
@@ -64,7 +65,7 @@ struct ETRAXTimerState {
ptimer_state *ptimer_t1;
ptimer_state *ptimer_wd;
- int wd_hits;
+ uint32_t wd_hits;
/* Control registers. */
uint32_t rw_tmr0_div;
@@ -83,6 +84,36 @@ struct ETRAXTimerState {
uint32_t r_masked_intr;
};
+static const VMStateDescription vmstate_etraxfs = {
+ .name = "etraxfs",
+ .version_id = 0,
+ .minimum_version_id = 0,
+ .fields = (VMStateField[]) {
+ VMSTATE_PTIMER(ptimer_t0, ETRAXTimerState),
+ VMSTATE_PTIMER(ptimer_t1, ETRAXTimerState),
+ VMSTATE_PTIMER(ptimer_wd, ETRAXTimerState),
+
+ VMSTATE_UINT32(wd_hits, ETRAXTimerState),
+
+ VMSTATE_UINT32(rw_tmr0_div, ETRAXTimerState),
+ VMSTATE_UINT32(r_tmr0_data, ETRAXTimerState),
+ VMSTATE_UINT32(rw_tmr0_ctrl, ETRAXTimerState),
+
+ VMSTATE_UINT32(rw_tmr1_div, ETRAXTimerState),
+ VMSTATE_UINT32(r_tmr1_data, ETRAXTimerState),
+ VMSTATE_UINT32(rw_tmr1_ctrl, ETRAXTimerState),
+
+ VMSTATE_UINT32(rw_wd_ctrl, ETRAXTimerState),
+
+ VMSTATE_UINT32(rw_intr_mask, ETRAXTimerState),
+ VMSTATE_UINT32(rw_ack_intr, ETRAXTimerState),
+ VMSTATE_UINT32(r_intr, ETRAXTimerState),
+ VMSTATE_UINT32(r_masked_intr, ETRAXTimerState),
+
+ VMSTATE_END_OF_LIST()
+ }
+};
+
static uint64_t
timer_read(void *opaque, hwaddr addr, unsigned int size)
{
@@ -357,6 +388,7 @@ static void etraxfs_timer_class_init(ObjectClass *klass, void *data)
ResettableClass *rc = RESETTABLE_CLASS(klass);
dc->realize = etraxfs_timer_realize;
+ dc->vmsd = &vmstate_etraxfs;
rc->phases.enter = etraxfs_timer_reset_enter;
rc->phases.hold = etraxfs_timer_reset_hold;
}