Skip to content

Commit 5115272

Browse files
hw/arm/apple-silicon/mt-spi: move vmstate crap up to the struct definitions
1 parent 2b1ed8a commit 5115272

File tree

1 file changed

+60
-60
lines changed

1 file changed

+60
-60
lines changed

hw/arm/apple-silicon/mt-spi.c

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,40 @@ typedef struct AppleMTSPIBuffer {
4040
uint32_t read_pos;
4141
} AppleMTSPIBuffer;
4242

43+
static const VMStateDescription vmstate_apple_mt_spi_buffer = {
44+
.name = "AppleMTSPIBuffer",
45+
.version_id = 0,
46+
.minimum_version_id = 0,
47+
.fields =
48+
(const VMStateField[]){
49+
VMSTATE_UINT32(capacity, AppleMTSPIBuffer),
50+
VMSTATE_VBUFFER_ALLOC_UINT32(data, AppleMTSPIBuffer, 0, NULL,
51+
capacity),
52+
VMSTATE_UINT32(len, AppleMTSPIBuffer),
53+
VMSTATE_UINT32(read_pos, AppleMTSPIBuffer),
54+
VMSTATE_END_OF_LIST(),
55+
},
56+
};
57+
4358
typedef struct AppleMTSPILLPacket {
4459
AppleMTSPIBuffer buf;
4560
uint8_t type;
4661
QTAILQ_ENTRY(AppleMTSPILLPacket) next;
4762
} AppleMTSPILLPacket;
4863

64+
static const VMStateDescription vmstate_apple_mt_spi_ll_packet = {
65+
.name = "AppleMTSPILLPacket",
66+
.version_id = 0,
67+
.minimum_version_id = 0,
68+
.fields =
69+
(const VMStateField[]){
70+
VMSTATE_STRUCT(buf, AppleMTSPILLPacket, 0,
71+
vmstate_apple_mt_spi_buffer, AppleMTSPIBuffer),
72+
VMSTATE_UINT8(type, AppleMTSPILLPacket),
73+
VMSTATE_END_OF_LIST(),
74+
},
75+
};
76+
4977
struct AppleMTSPIState {
5078
SSIPeripheral parent_obj;
5179

@@ -72,6 +100,38 @@ struct AppleMTSPIState {
72100
uint32_t display_height;
73101
};
74102

103+
static const VMStateDescription vmstate_apple_mt_spi = {
104+
.name = "AppleMTSPIState",
105+
.version_id = 0,
106+
.minimum_version_id = 0,
107+
.fields =
108+
(const VMStateField[]){
109+
VMSTATE_SSI_PERIPHERAL(parent_obj, AppleMTSPIState),
110+
VMSTATE_STRUCT(tx, AppleMTSPIState, 0, vmstate_apple_mt_spi_buffer,
111+
AppleMTSPIBuffer),
112+
VMSTATE_STRUCT(rx, AppleMTSPIState, 0, vmstate_apple_mt_spi_buffer,
113+
AppleMTSPIBuffer),
114+
VMSTATE_STRUCT(pending_hbpp, AppleMTSPIState, 0,
115+
vmstate_apple_mt_spi_buffer, AppleMTSPIBuffer),
116+
VMSTATE_QTAILQ_V(pending_fw, AppleMTSPIState, 0,
117+
vmstate_apple_mt_spi_ll_packet, AppleMTSPILLPacket,
118+
next),
119+
VMSTATE_UINT8(frame, AppleMTSPIState),
120+
VMSTATE_TIMER_PTR(timer, AppleMTSPIState),
121+
VMSTATE_TIMER_PTR(end_timer, AppleMTSPIState),
122+
VMSTATE_INT16(x, AppleMTSPIState),
123+
VMSTATE_INT16(y, AppleMTSPIState),
124+
VMSTATE_INT16(prev_x, AppleMTSPIState),
125+
VMSTATE_INT16(prev_y, AppleMTSPIState),
126+
VMSTATE_UINT64(prev_ts, AppleMTSPIState),
127+
VMSTATE_INT32(btn_state, AppleMTSPIState),
128+
VMSTATE_INT32(prev_btn_state, AppleMTSPIState),
129+
VMSTATE_UINT32(display_width, AppleMTSPIState),
130+
VMSTATE_UINT32(display_height, AppleMTSPIState),
131+
VMSTATE_END_OF_LIST(),
132+
},
133+
};
134+
75135
// HBPP Command:
76136
// u8 packet_type
77137
// u1 unk0
@@ -956,66 +1016,6 @@ static const Property apple_mt_spi_props[] = {
9561016
DEFINE_PROP_UINT32("display_height", AppleMTSPIState, display_height, 0),
9571017
};
9581018

959-
static const VMStateDescription vmstate_apple_mt_spi_buffer = {
960-
.name = "AppleMTSPIBuffer",
961-
.version_id = 0,
962-
.minimum_version_id = 0,
963-
.fields =
964-
(const VMStateField[]){
965-
VMSTATE_UINT32(capacity, AppleMTSPIBuffer),
966-
VMSTATE_VBUFFER_ALLOC_UINT32(data, AppleMTSPIBuffer, 0, NULL,
967-
capacity),
968-
VMSTATE_UINT32(len, AppleMTSPIBuffer),
969-
VMSTATE_UINT32(read_pos, AppleMTSPIBuffer),
970-
VMSTATE_END_OF_LIST(),
971-
},
972-
};
973-
974-
static const VMStateDescription vmstate_apple_mt_spi_ll_packet = {
975-
.name = "AppleMTSPILLPacket",
976-
.version_id = 0,
977-
.minimum_version_id = 0,
978-
.fields =
979-
(const VMStateField[]){
980-
VMSTATE_STRUCT(buf, AppleMTSPILLPacket, 0,
981-
vmstate_apple_mt_spi_buffer, AppleMTSPIBuffer),
982-
VMSTATE_UINT8(type, AppleMTSPILLPacket),
983-
VMSTATE_END_OF_LIST(),
984-
},
985-
};
986-
987-
static const VMStateDescription vmstate_apple_mt_spi = {
988-
.name = "AppleMTSPIState",
989-
.version_id = 0,
990-
.minimum_version_id = 0,
991-
.fields =
992-
(const VMStateField[]){
993-
VMSTATE_SSI_PERIPHERAL(parent_obj, AppleMTSPIState),
994-
VMSTATE_STRUCT(tx, AppleMTSPIState, 0, vmstate_apple_mt_spi_buffer,
995-
AppleMTSPIBuffer),
996-
VMSTATE_STRUCT(rx, AppleMTSPIState, 0, vmstate_apple_mt_spi_buffer,
997-
AppleMTSPIBuffer),
998-
VMSTATE_STRUCT(pending_hbpp, AppleMTSPIState, 0,
999-
vmstate_apple_mt_spi_buffer, AppleMTSPIBuffer),
1000-
VMSTATE_QTAILQ_V(pending_fw, AppleMTSPIState, 0,
1001-
vmstate_apple_mt_spi_ll_packet, AppleMTSPILLPacket,
1002-
next),
1003-
VMSTATE_UINT8(frame, AppleMTSPIState),
1004-
VMSTATE_TIMER_PTR(timer, AppleMTSPIState),
1005-
VMSTATE_TIMER_PTR(end_timer, AppleMTSPIState),
1006-
VMSTATE_INT16(x, AppleMTSPIState),
1007-
VMSTATE_INT16(y, AppleMTSPIState),
1008-
VMSTATE_INT16(prev_x, AppleMTSPIState),
1009-
VMSTATE_INT16(prev_y, AppleMTSPIState),
1010-
VMSTATE_UINT64(prev_ts, AppleMTSPIState),
1011-
VMSTATE_INT32(btn_state, AppleMTSPIState),
1012-
VMSTATE_INT32(prev_btn_state, AppleMTSPIState),
1013-
VMSTATE_UINT32(display_width, AppleMTSPIState),
1014-
VMSTATE_UINT32(display_height, AppleMTSPIState),
1015-
VMSTATE_END_OF_LIST(),
1016-
},
1017-
};
1018-
10191019
static void apple_mt_spi_reset_enter(Object *obj, ResetType type)
10201020
{
10211021
AppleMTSPIState *s;

0 commit comments

Comments
 (0)