Commit 279a65442eb53e74083b31fa629a10c0ed78e3f0
1 parent
fd07bef4
Add calls to pci_device_save/load
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@4766 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
2 changed files
with
17 additions
and
4 deletions
hw/ac97.c
@@ -1190,6 +1190,8 @@ static void ac97_save (QEMUFile *f, void *opaque) | @@ -1190,6 +1190,8 @@ static void ac97_save (QEMUFile *f, void *opaque) | ||
1190 | uint8_t active[LAST_INDEX]; | 1190 | uint8_t active[LAST_INDEX]; |
1191 | AC97LinkState *s = opaque; | 1191 | AC97LinkState *s = opaque; |
1192 | 1192 | ||
1193 | + pci_device_save (s->pci_dev, f); | ||
1194 | + | ||
1193 | qemu_put_be32s (f, &s->glob_cnt); | 1195 | qemu_put_be32s (f, &s->glob_cnt); |
1194 | qemu_put_be32s (f, &s->glob_sta); | 1196 | qemu_put_be32s (f, &s->glob_sta); |
1195 | qemu_put_be32s (f, &s->cas); | 1197 | qemu_put_be32s (f, &s->cas); |
@@ -1217,13 +1219,18 @@ static void ac97_save (QEMUFile *f, void *opaque) | @@ -1217,13 +1219,18 @@ static void ac97_save (QEMUFile *f, void *opaque) | ||
1217 | 1219 | ||
1218 | static int ac97_load (QEMUFile *f, void *opaque, int version_id) | 1220 | static int ac97_load (QEMUFile *f, void *opaque, int version_id) |
1219 | { | 1221 | { |
1222 | + int ret; | ||
1220 | size_t i; | 1223 | size_t i; |
1221 | uint8_t active[LAST_INDEX]; | 1224 | uint8_t active[LAST_INDEX]; |
1222 | AC97LinkState *s = opaque; | 1225 | AC97LinkState *s = opaque; |
1223 | 1226 | ||
1224 | - if (version_id != 1) | 1227 | + if (version_id != 2) |
1225 | return -EINVAL; | 1228 | return -EINVAL; |
1226 | 1229 | ||
1230 | + ret = pci_device_load (s->pci_dev, f); | ||
1231 | + if (ret) | ||
1232 | + return ret; | ||
1233 | + | ||
1227 | qemu_get_be32s (f, &s->glob_cnt); | 1234 | qemu_get_be32s (f, &s->glob_cnt); |
1228 | qemu_get_be32s (f, &s->glob_sta); | 1235 | qemu_get_be32s (f, &s->glob_sta); |
1229 | qemu_get_be32s (f, &s->cas); | 1236 | qemu_get_be32s (f, &s->cas); |
@@ -1370,7 +1377,7 @@ int ac97_init (PCIBus *bus, AudioState *audio) | @@ -1370,7 +1377,7 @@ int ac97_init (PCIBus *bus, AudioState *audio) | ||
1370 | 1377 | ||
1371 | pci_register_io_region (&d->dev, 0, 256 * 4, PCI_ADDRESS_SPACE_IO, ac97_map); | 1378 | pci_register_io_region (&d->dev, 0, 256 * 4, PCI_ADDRESS_SPACE_IO, ac97_map); |
1372 | pci_register_io_region (&d->dev, 1, 64 * 4, PCI_ADDRESS_SPACE_IO, ac97_map); | 1379 | pci_register_io_region (&d->dev, 1, 64 * 4, PCI_ADDRESS_SPACE_IO, ac97_map); |
1373 | - register_savevm ("ac97", 0, 1, ac97_save, ac97_load, s); | 1380 | + register_savevm ("ac97", 0, 2, ac97_save, ac97_load, s); |
1374 | qemu_register_reset (ac97_on_reset, s); | 1381 | qemu_register_reset (ac97_on_reset, s); |
1375 | AUD_register_card (audio, "ac97", &s->card); | 1382 | AUD_register_card (audio, "ac97", &s->card); |
1376 | ac97_on_reset (s); | 1383 | ac97_on_reset (s); |
hw/es1370.c
@@ -936,6 +936,7 @@ static void es1370_save (QEMUFile *f, void *opaque) | @@ -936,6 +936,7 @@ static void es1370_save (QEMUFile *f, void *opaque) | ||
936 | ES1370State *s = opaque; | 936 | ES1370State *s = opaque; |
937 | size_t i; | 937 | size_t i; |
938 | 938 | ||
939 | + pci_device_save (s->pci_dev, f); | ||
939 | for (i = 0; i < NB_CHANNELS; ++i) { | 940 | for (i = 0; i < NB_CHANNELS; ++i) { |
940 | struct chan *d = &s->chan[i]; | 941 | struct chan *d = &s->chan[i]; |
941 | qemu_put_be32s (f, &d->shift); | 942 | qemu_put_be32s (f, &d->shift); |
@@ -953,13 +954,18 @@ static void es1370_save (QEMUFile *f, void *opaque) | @@ -953,13 +954,18 @@ static void es1370_save (QEMUFile *f, void *opaque) | ||
953 | 954 | ||
954 | static int es1370_load (QEMUFile *f, void *opaque, int version_id) | 955 | static int es1370_load (QEMUFile *f, void *opaque, int version_id) |
955 | { | 956 | { |
957 | + int ret; | ||
956 | uint32_t ctl, sctl; | 958 | uint32_t ctl, sctl; |
957 | ES1370State *s = opaque; | 959 | ES1370State *s = opaque; |
958 | size_t i; | 960 | size_t i; |
959 | 961 | ||
960 | - if (version_id != 1) | 962 | + if (version_id != 2) |
961 | return -EINVAL; | 963 | return -EINVAL; |
962 | 964 | ||
965 | + ret = pci_device_load (s->pci_dev, f); | ||
966 | + if (ret) | ||
967 | + return ret; | ||
968 | + | ||
963 | for (i = 0; i < NB_CHANNELS; ++i) { | 969 | for (i = 0; i < NB_CHANNELS; ++i) { |
964 | struct chan *d = &s->chan[i]; | 970 | struct chan *d = &s->chan[i]; |
965 | qemu_get_be32s (f, &d->shift); | 971 | qemu_get_be32s (f, &d->shift); |
@@ -1056,7 +1062,7 @@ int es1370_init (PCIBus *bus, AudioState *audio) | @@ -1056,7 +1062,7 @@ int es1370_init (PCIBus *bus, AudioState *audio) | ||
1056 | s->pci_dev = &d->dev; | 1062 | s->pci_dev = &d->dev; |
1057 | 1063 | ||
1058 | pci_register_io_region (&d->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map); | 1064 | pci_register_io_region (&d->dev, 0, 256, PCI_ADDRESS_SPACE_IO, es1370_map); |
1059 | - register_savevm ("es1370", 0, 1, es1370_save, es1370_load, s); | 1065 | + register_savevm ("es1370", 0, 2, es1370_save, es1370_load, s); |
1060 | qemu_register_reset (es1370_on_reset, s); | 1066 | qemu_register_reset (es1370_on_reset, s); |
1061 | 1067 | ||
1062 | AUD_register_card (audio, "es1370", &s->card); | 1068 | AUD_register_card (audio, "es1370", &s->card); |