Revision b280fcdf
b/hw/sbi.c | ||
---|---|---|
22 | 22 |
* THE SOFTWARE. |
23 | 23 |
*/ |
24 | 24 |
|
25 |
#include "hw.h" |
|
26 |
#include "sun4m.h" |
|
27 |
#include "console.h" |
|
28 | 25 |
#include "sysbus.h" |
29 | 26 |
|
30 | 27 |
//#define DEBUG_IRQ |
... | ... | |
96 | 93 |
sbi_mem_writel, |
97 | 94 |
}; |
98 | 95 |
|
99 |
static void sbi_save(QEMUFile *f, void *opaque) |
|
100 |
{ |
|
101 |
SBIState *s = opaque; |
|
102 |
unsigned int i; |
|
103 |
|
|
104 |
for (i = 0; i < MAX_CPUS; i++) { |
|
105 |
qemu_put_be32s(f, &s->intreg_pending[i]); |
|
106 |
} |
|
107 |
} |
|
108 |
|
|
109 |
static int sbi_load(QEMUFile *f, void *opaque, int version_id) |
|
110 |
{ |
|
111 |
SBIState *s = opaque; |
|
112 |
unsigned int i; |
|
113 |
|
|
114 |
if (version_id != 1) |
|
115 |
return -EINVAL; |
|
116 |
|
|
117 |
for (i = 0; i < MAX_CPUS; i++) { |
|
118 |
qemu_get_be32s(f, &s->intreg_pending[i]); |
|
96 |
static const VMStateDescription vmstate_sbi = { |
|
97 |
.name ="sbi", |
|
98 |
.version_id = 1, |
|
99 |
.minimum_version_id = 1, |
|
100 |
.minimum_version_id_old = 1, |
|
101 |
.fields = (VMStateField []) { |
|
102 |
VMSTATE_UINT32_ARRAY(intreg_pending, SBIState, MAX_CPUS), |
|
103 |
VMSTATE_END_OF_LIST() |
|
119 | 104 |
} |
105 |
}; |
|
120 | 106 |
|
121 |
return 0; |
|
122 |
} |
|
123 |
|
|
124 |
static void sbi_reset(void *opaque) |
|
107 |
static void sbi_reset(DeviceState *d) |
|
125 | 108 |
{ |
126 |
SBIState *s = opaque;
|
|
109 |
SBIState *s = container_of(d, SBIState, busdev.qdev);
|
|
127 | 110 |
unsigned int i; |
128 | 111 |
|
129 | 112 |
for (i = 0; i < MAX_CPUS; i++) { |
... | ... | |
145 | 128 |
sbi_io_memory = cpu_register_io_memory(sbi_mem_read, sbi_mem_write, s); |
146 | 129 |
sysbus_init_mmio(dev, SBI_SIZE, sbi_io_memory); |
147 | 130 |
|
148 |
register_savevm("sbi", -1, 1, sbi_save, sbi_load, s); |
|
149 |
qemu_register_reset(sbi_reset, s); |
|
150 |
sbi_reset(s); |
|
131 |
sbi_reset(&s->busdev.qdev); |
|
132 |
|
|
151 | 133 |
return 0; |
152 | 134 |
} |
153 | 135 |
|
... | ... | |
155 | 137 |
.init = sbi_init1, |
156 | 138 |
.qdev.name = "sbi", |
157 | 139 |
.qdev.size = sizeof(SBIState), |
140 |
.qdev.vmsd = &vmstate_sbi, |
|
141 |
.qdev.reset = sbi_reset, |
|
158 | 142 |
}; |
159 | 143 |
|
160 | 144 |
static void sbi_register_devices(void) |
Also available in: Unified diff